diff --git a/clients/client-accessanalyzer/src/pagination/GetFindingV2Paginator.ts b/clients/client-accessanalyzer/src/pagination/GetFindingV2Paginator.ts index ea6c55087934..92a63634dab3 100644 --- a/clients/client-accessanalyzer/src/pagination/GetFindingV2Paginator.ts +++ b/clients/client-accessanalyzer/src/pagination/GetFindingV2Paginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AccessAnalyzerClient } from "../AccessAnalyzerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetFindingV2Command"; import { AccessAnalyzerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AccessAnalyzerClient, - input: GetFindingV2CommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetFindingV2Command(input), ...args); -}; /** * @public */ -export async function* paginateGetFindingV2( +export const paginateGetFindingV2: ( config: AccessAnalyzerPaginationConfiguration, input: GetFindingV2CommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetFindingV2CommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AccessAnalyzerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AccessAnalyzerPaginationConfiguration, + GetFindingV2CommandInput, + GetFindingV2CommandOutput +>(AccessAnalyzerClient, GetFindingV2Command, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-accessanalyzer/src/pagination/ListAccessPreviewFindingsPaginator.ts b/clients/client-accessanalyzer/src/pagination/ListAccessPreviewFindingsPaginator.ts index 51550608fad8..17cf7c3aeb79 100644 --- a/clients/client-accessanalyzer/src/pagination/ListAccessPreviewFindingsPaginator.ts +++ b/clients/client-accessanalyzer/src/pagination/ListAccessPreviewFindingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AccessAnalyzerClient } from "../AccessAnalyzerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAccessPreviewFindingsCommand"; import { AccessAnalyzerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AccessAnalyzerClient, - input: ListAccessPreviewFindingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessPreviewFindingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessPreviewFindings( +export const paginateListAccessPreviewFindings: ( config: AccessAnalyzerPaginationConfiguration, input: ListAccessPreviewFindingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessPreviewFindingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AccessAnalyzerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AccessAnalyzerPaginationConfiguration, + ListAccessPreviewFindingsCommandInput, + ListAccessPreviewFindingsCommandOutput +>(AccessAnalyzerClient, ListAccessPreviewFindingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-accessanalyzer/src/pagination/ListAccessPreviewsPaginator.ts b/clients/client-accessanalyzer/src/pagination/ListAccessPreviewsPaginator.ts index 53e6a7ac9a26..f386fbf6dac7 100644 --- a/clients/client-accessanalyzer/src/pagination/ListAccessPreviewsPaginator.ts +++ b/clients/client-accessanalyzer/src/pagination/ListAccessPreviewsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AccessAnalyzerClient } from "../AccessAnalyzerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAccessPreviewsCommand"; import { AccessAnalyzerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AccessAnalyzerClient, - input: ListAccessPreviewsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessPreviewsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessPreviews( +export const paginateListAccessPreviews: ( config: AccessAnalyzerPaginationConfiguration, input: ListAccessPreviewsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessPreviewsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AccessAnalyzerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AccessAnalyzerPaginationConfiguration, + ListAccessPreviewsCommandInput, + ListAccessPreviewsCommandOutput +>(AccessAnalyzerClient, ListAccessPreviewsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-accessanalyzer/src/pagination/ListAnalyzedResourcesPaginator.ts b/clients/client-accessanalyzer/src/pagination/ListAnalyzedResourcesPaginator.ts index ee73281c073c..fe282c76c44e 100644 --- a/clients/client-accessanalyzer/src/pagination/ListAnalyzedResourcesPaginator.ts +++ b/clients/client-accessanalyzer/src/pagination/ListAnalyzedResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AccessAnalyzerClient } from "../AccessAnalyzerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAnalyzedResourcesCommand"; import { AccessAnalyzerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AccessAnalyzerClient, - input: ListAnalyzedResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnalyzedResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnalyzedResources( +export const paginateListAnalyzedResources: ( config: AccessAnalyzerPaginationConfiguration, input: ListAnalyzedResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnalyzedResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AccessAnalyzerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AccessAnalyzerPaginationConfiguration, + ListAnalyzedResourcesCommandInput, + ListAnalyzedResourcesCommandOutput +>(AccessAnalyzerClient, ListAnalyzedResourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-accessanalyzer/src/pagination/ListAnalyzersPaginator.ts b/clients/client-accessanalyzer/src/pagination/ListAnalyzersPaginator.ts index 9741a9c2d20e..e488c56c2f01 100644 --- a/clients/client-accessanalyzer/src/pagination/ListAnalyzersPaginator.ts +++ b/clients/client-accessanalyzer/src/pagination/ListAnalyzersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AccessAnalyzerClient } from "../AccessAnalyzerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAnalyzersCommand"; import { AccessAnalyzerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AccessAnalyzerClient, - input: ListAnalyzersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnalyzersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnalyzers( +export const paginateListAnalyzers: ( config: AccessAnalyzerPaginationConfiguration, input: ListAnalyzersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnalyzersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AccessAnalyzerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AccessAnalyzerPaginationConfiguration, + ListAnalyzersCommandInput, + ListAnalyzersCommandOutput +>(AccessAnalyzerClient, ListAnalyzersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-accessanalyzer/src/pagination/ListArchiveRulesPaginator.ts b/clients/client-accessanalyzer/src/pagination/ListArchiveRulesPaginator.ts index d68375be7dc1..3934f86b04c2 100644 --- a/clients/client-accessanalyzer/src/pagination/ListArchiveRulesPaginator.ts +++ b/clients/client-accessanalyzer/src/pagination/ListArchiveRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AccessAnalyzerClient } from "../AccessAnalyzerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListArchiveRulesCommand"; import { AccessAnalyzerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AccessAnalyzerClient, - input: ListArchiveRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListArchiveRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListArchiveRules( +export const paginateListArchiveRules: ( config: AccessAnalyzerPaginationConfiguration, input: ListArchiveRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListArchiveRulesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AccessAnalyzerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AccessAnalyzerPaginationConfiguration, + ListArchiveRulesCommandInput, + ListArchiveRulesCommandOutput +>(AccessAnalyzerClient, ListArchiveRulesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-accessanalyzer/src/pagination/ListFindingsPaginator.ts b/clients/client-accessanalyzer/src/pagination/ListFindingsPaginator.ts index a9253e823c57..e910668f0e0e 100644 --- a/clients/client-accessanalyzer/src/pagination/ListFindingsPaginator.ts +++ b/clients/client-accessanalyzer/src/pagination/ListFindingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AccessAnalyzerClient } from "../AccessAnalyzerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListFindingsCommand"; import { AccessAnalyzerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AccessAnalyzerClient, - input: ListFindingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFindingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFindings( +export const paginateListFindings: ( config: AccessAnalyzerPaginationConfiguration, input: ListFindingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFindingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AccessAnalyzerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AccessAnalyzerPaginationConfiguration, + ListFindingsCommandInput, + ListFindingsCommandOutput +>(AccessAnalyzerClient, ListFindingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-accessanalyzer/src/pagination/ListFindingsV2Paginator.ts b/clients/client-accessanalyzer/src/pagination/ListFindingsV2Paginator.ts index 127ee8d6c6ca..3dabf223e6c7 100644 --- a/clients/client-accessanalyzer/src/pagination/ListFindingsV2Paginator.ts +++ b/clients/client-accessanalyzer/src/pagination/ListFindingsV2Paginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AccessAnalyzerClient } from "../AccessAnalyzerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListFindingsV2Command"; import { AccessAnalyzerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AccessAnalyzerClient, - input: ListFindingsV2CommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFindingsV2Command(input), ...args); -}; /** * @public */ -export async function* paginateListFindingsV2( +export const paginateListFindingsV2: ( config: AccessAnalyzerPaginationConfiguration, input: ListFindingsV2CommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFindingsV2CommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AccessAnalyzerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AccessAnalyzerPaginationConfiguration, + ListFindingsV2CommandInput, + ListFindingsV2CommandOutput +>(AccessAnalyzerClient, ListFindingsV2Command, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-accessanalyzer/src/pagination/ListPolicyGenerationsPaginator.ts b/clients/client-accessanalyzer/src/pagination/ListPolicyGenerationsPaginator.ts index d04c3d17443a..2a74cef52746 100644 --- a/clients/client-accessanalyzer/src/pagination/ListPolicyGenerationsPaginator.ts +++ b/clients/client-accessanalyzer/src/pagination/ListPolicyGenerationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AccessAnalyzerClient } from "../AccessAnalyzerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPolicyGenerationsCommand"; import { AccessAnalyzerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AccessAnalyzerClient, - input: ListPolicyGenerationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPolicyGenerationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPolicyGenerations( +export const paginateListPolicyGenerations: ( config: AccessAnalyzerPaginationConfiguration, input: ListPolicyGenerationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPolicyGenerationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AccessAnalyzerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AccessAnalyzerPaginationConfiguration, + ListPolicyGenerationsCommandInput, + ListPolicyGenerationsCommandOutput +>(AccessAnalyzerClient, ListPolicyGenerationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-accessanalyzer/src/pagination/ValidatePolicyPaginator.ts b/clients/client-accessanalyzer/src/pagination/ValidatePolicyPaginator.ts index 229fc01e924a..030f01224ded 100644 --- a/clients/client-accessanalyzer/src/pagination/ValidatePolicyPaginator.ts +++ b/clients/client-accessanalyzer/src/pagination/ValidatePolicyPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AccessAnalyzerClient } from "../AccessAnalyzerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ValidatePolicyCommand"; import { AccessAnalyzerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AccessAnalyzerClient, - input: ValidatePolicyCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ValidatePolicyCommand(input), ...args); -}; /** * @public */ -export async function* paginateValidatePolicy( +export const paginateValidatePolicy: ( config: AccessAnalyzerPaginationConfiguration, input: ValidatePolicyCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ValidatePolicyCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AccessAnalyzerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AccessAnalyzerPaginationConfiguration, + ValidatePolicyCommandInput, + ValidatePolicyCommandOutput +>(AccessAnalyzerClient, ValidatePolicyCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-account/src/pagination/ListRegionsPaginator.ts b/clients/client-account/src/pagination/ListRegionsPaginator.ts index f910a68cbde6..eb11bd836565 100644 --- a/clients/client-account/src/pagination/ListRegionsPaginator.ts +++ b/clients/client-account/src/pagination/ListRegionsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AccountClient } from "../AccountClient"; import { ListRegionsCommand, ListRegionsCommandInput, ListRegionsCommandOutput } from "../commands/ListRegionsCommand"; import { AccountPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AccountClient, - input: ListRegionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRegionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRegions( +export const paginateListRegions: ( config: AccountPaginationConfiguration, input: ListRegionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRegionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AccountClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Account | AccountClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AccountPaginationConfiguration, + ListRegionsCommandInput, + ListRegionsCommandOutput +>(AccountClient, ListRegionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-acm-pca/package.json b/clients/client-acm-pca/package.json index 791eb9479ed6..e9a47ca0eacb 100644 --- a/clients/client-acm-pca/package.json +++ b/clients/client-acm-pca/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-acm-pca/src/pagination/ListCertificateAuthoritiesPaginator.ts b/clients/client-acm-pca/src/pagination/ListCertificateAuthoritiesPaginator.ts index 0042c74165e7..adf309f030e2 100644 --- a/clients/client-acm-pca/src/pagination/ListCertificateAuthoritiesPaginator.ts +++ b/clients/client-acm-pca/src/pagination/ListCertificateAuthoritiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ACMPCAClient } from "../ACMPCAClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCertificateAuthoritiesCommand"; import { ACMPCAPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ACMPCAClient, - input: ListCertificateAuthoritiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCertificateAuthoritiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCertificateAuthorities( +export const paginateListCertificateAuthorities: ( config: ACMPCAPaginationConfiguration, input: ListCertificateAuthoritiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCertificateAuthoritiesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ACMPCAClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ACMPCA | ACMPCAClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ACMPCAPaginationConfiguration, + ListCertificateAuthoritiesCommandInput, + ListCertificateAuthoritiesCommandOutput +>(ACMPCAClient, ListCertificateAuthoritiesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-acm-pca/src/pagination/ListPermissionsPaginator.ts b/clients/client-acm-pca/src/pagination/ListPermissionsPaginator.ts index e78d364048d1..0f1ae1014087 100644 --- a/clients/client-acm-pca/src/pagination/ListPermissionsPaginator.ts +++ b/clients/client-acm-pca/src/pagination/ListPermissionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ACMPCAClient } from "../ACMPCAClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPermissionsCommand"; import { ACMPCAPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ACMPCAClient, - input: ListPermissionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPermissionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPermissions( +export const paginateListPermissions: ( config: ACMPCAPaginationConfiguration, input: ListPermissionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPermissionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ACMPCAClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ACMPCA | ACMPCAClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ACMPCAPaginationConfiguration, + ListPermissionsCommandInput, + ListPermissionsCommandOutput +>(ACMPCAClient, ListPermissionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-acm-pca/src/pagination/ListTagsPaginator.ts b/clients/client-acm-pca/src/pagination/ListTagsPaginator.ts index a72f0d2952e6..3dab72fde38f 100644 --- a/clients/client-acm-pca/src/pagination/ListTagsPaginator.ts +++ b/clients/client-acm-pca/src/pagination/ListTagsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ACMPCAClient } from "../ACMPCAClient"; import { ListTagsCommand, ListTagsCommandInput, ListTagsCommandOutput } from "../commands/ListTagsCommand"; import { ACMPCAPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ACMPCAClient, - input: ListTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTags( +export const paginateListTags: ( config: ACMPCAPaginationConfiguration, input: ListTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ACMPCAClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ACMPCA | ACMPCAClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ACMPCAPaginationConfiguration, + ListTagsCommandInput, + ListTagsCommandOutput +>(ACMPCAClient, ListTagsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-acm/package.json b/clients/client-acm/package.json index f2d72b8a48b7..3182c64213ef 100644 --- a/clients/client-acm/package.json +++ b/clients/client-acm/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-acm/src/pagination/ListCertificatesPaginator.ts b/clients/client-acm/src/pagination/ListCertificatesPaginator.ts index 265e4851be72..c76466c4aa78 100644 --- a/clients/client-acm/src/pagination/ListCertificatesPaginator.ts +++ b/clients/client-acm/src/pagination/ListCertificatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ACMClient } from "../ACMClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCertificatesCommand"; import { ACMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ACMClient, - input: ListCertificatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCertificatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCertificates( +export const paginateListCertificates: ( config: ACMPaginationConfiguration, input: ListCertificatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCertificatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof ACMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ACM | ACMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ACMPaginationConfiguration, + ListCertificatesCommandInput, + ListCertificatesCommandOutput +>(ACMClient, ListCertificatesCommand, "NextToken", "NextToken", "MaxItems"); diff --git a/clients/client-alexa-for-business/package.json b/clients/client-alexa-for-business/package.json index 361eecc5b0f4..b76acd24535b 100644 --- a/clients/client-alexa-for-business/package.json +++ b/clients/client-alexa-for-business/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-alexa-for-business/src/pagination/ListBusinessReportSchedulesPaginator.ts b/clients/client-alexa-for-business/src/pagination/ListBusinessReportSchedulesPaginator.ts index a5491af157ec..af61a6c7618e 100644 --- a/clients/client-alexa-for-business/src/pagination/ListBusinessReportSchedulesPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/ListBusinessReportSchedulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListBusinessReportSchedulesCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: ListBusinessReportSchedulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBusinessReportSchedulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBusinessReportSchedules( +export const paginateListBusinessReportSchedules: ( config: AlexaForBusinessPaginationConfiguration, input: ListBusinessReportSchedulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBusinessReportSchedulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + ListBusinessReportSchedulesCommandInput, + ListBusinessReportSchedulesCommandOutput +>(AlexaForBusinessClient, ListBusinessReportSchedulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/ListConferenceProvidersPaginator.ts b/clients/client-alexa-for-business/src/pagination/ListConferenceProvidersPaginator.ts index 0262ce3e28c0..707714bbb2dc 100644 --- a/clients/client-alexa-for-business/src/pagination/ListConferenceProvidersPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/ListConferenceProvidersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListConferenceProvidersCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: ListConferenceProvidersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConferenceProvidersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConferenceProviders( +export const paginateListConferenceProviders: ( config: AlexaForBusinessPaginationConfiguration, input: ListConferenceProvidersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConferenceProvidersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + ListConferenceProvidersCommandInput, + ListConferenceProvidersCommandOutput +>(AlexaForBusinessClient, ListConferenceProvidersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/ListDeviceEventsPaginator.ts b/clients/client-alexa-for-business/src/pagination/ListDeviceEventsPaginator.ts index c4266e8ff1ad..3e87e1ab82be 100644 --- a/clients/client-alexa-for-business/src/pagination/ListDeviceEventsPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/ListDeviceEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListDeviceEventsCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: ListDeviceEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeviceEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeviceEvents( +export const paginateListDeviceEvents: ( config: AlexaForBusinessPaginationConfiguration, input: ListDeviceEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeviceEventsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + ListDeviceEventsCommandInput, + ListDeviceEventsCommandOutput +>(AlexaForBusinessClient, ListDeviceEventsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/ListGatewayGroupsPaginator.ts b/clients/client-alexa-for-business/src/pagination/ListGatewayGroupsPaginator.ts index be0879a76a75..b7d207411f3d 100644 --- a/clients/client-alexa-for-business/src/pagination/ListGatewayGroupsPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/ListGatewayGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListGatewayGroupsCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: ListGatewayGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGatewayGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGatewayGroups( +export const paginateListGatewayGroups: ( config: AlexaForBusinessPaginationConfiguration, input: ListGatewayGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGatewayGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + ListGatewayGroupsCommandInput, + ListGatewayGroupsCommandOutput +>(AlexaForBusinessClient, ListGatewayGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/ListGatewaysPaginator.ts b/clients/client-alexa-for-business/src/pagination/ListGatewaysPaginator.ts index 0c2fcd037da4..e1fb3dd5a885 100644 --- a/clients/client-alexa-for-business/src/pagination/ListGatewaysPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/ListGatewaysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListGatewaysCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: ListGatewaysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGatewaysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGateways( +export const paginateListGateways: ( config: AlexaForBusinessPaginationConfiguration, input: ListGatewaysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGatewaysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + ListGatewaysCommandInput, + ListGatewaysCommandOutput +>(AlexaForBusinessClient, ListGatewaysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/ListSkillsPaginator.ts b/clients/client-alexa-for-business/src/pagination/ListSkillsPaginator.ts index 13f10b5d5d91..d217e1641386 100644 --- a/clients/client-alexa-for-business/src/pagination/ListSkillsPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/ListSkillsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; import { ListSkillsCommand, ListSkillsCommandInput, ListSkillsCommandOutput } from "../commands/ListSkillsCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: ListSkillsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSkillsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSkills( +export const paginateListSkills: ( config: AlexaForBusinessPaginationConfiguration, input: ListSkillsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSkillsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + ListSkillsCommandInput, + ListSkillsCommandOutput +>(AlexaForBusinessClient, ListSkillsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/ListSkillsStoreCategoriesPaginator.ts b/clients/client-alexa-for-business/src/pagination/ListSkillsStoreCategoriesPaginator.ts index 3d688fa1a1ec..8097cd81dbe7 100644 --- a/clients/client-alexa-for-business/src/pagination/ListSkillsStoreCategoriesPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/ListSkillsStoreCategoriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSkillsStoreCategoriesCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: ListSkillsStoreCategoriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSkillsStoreCategoriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSkillsStoreCategories( +export const paginateListSkillsStoreCategories: ( config: AlexaForBusinessPaginationConfiguration, input: ListSkillsStoreCategoriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSkillsStoreCategoriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + ListSkillsStoreCategoriesCommandInput, + ListSkillsStoreCategoriesCommandOutput +>(AlexaForBusinessClient, ListSkillsStoreCategoriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/ListSkillsStoreSkillsByCategoryPaginator.ts b/clients/client-alexa-for-business/src/pagination/ListSkillsStoreSkillsByCategoryPaginator.ts index 36853b3f959e..eea7da724967 100644 --- a/clients/client-alexa-for-business/src/pagination/ListSkillsStoreSkillsByCategoryPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/ListSkillsStoreSkillsByCategoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSkillsStoreSkillsByCategoryCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: ListSkillsStoreSkillsByCategoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSkillsStoreSkillsByCategoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSkillsStoreSkillsByCategory( +export const paginateListSkillsStoreSkillsByCategory: ( config: AlexaForBusinessPaginationConfiguration, input: ListSkillsStoreSkillsByCategoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSkillsStoreSkillsByCategoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + ListSkillsStoreSkillsByCategoryCommandInput, + ListSkillsStoreSkillsByCategoryCommandOutput +>(AlexaForBusinessClient, ListSkillsStoreSkillsByCategoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/ListSmartHomeAppliancesPaginator.ts b/clients/client-alexa-for-business/src/pagination/ListSmartHomeAppliancesPaginator.ts index d1bf01b18231..40056a14ef56 100644 --- a/clients/client-alexa-for-business/src/pagination/ListSmartHomeAppliancesPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/ListSmartHomeAppliancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSmartHomeAppliancesCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: ListSmartHomeAppliancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSmartHomeAppliancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSmartHomeAppliances( +export const paginateListSmartHomeAppliances: ( config: AlexaForBusinessPaginationConfiguration, input: ListSmartHomeAppliancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSmartHomeAppliancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + ListSmartHomeAppliancesCommandInput, + ListSmartHomeAppliancesCommandOutput +>(AlexaForBusinessClient, ListSmartHomeAppliancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/ListTagsPaginator.ts b/clients/client-alexa-for-business/src/pagination/ListTagsPaginator.ts index 9f3e4d279573..127295a79dc8 100644 --- a/clients/client-alexa-for-business/src/pagination/ListTagsPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/ListTagsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; import { ListTagsCommand, ListTagsCommandInput, ListTagsCommandOutput } from "../commands/ListTagsCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: ListTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTags( +export const paginateListTags: ( config: AlexaForBusinessPaginationConfiguration, input: ListTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + ListTagsCommandInput, + ListTagsCommandOutput +>(AlexaForBusinessClient, ListTagsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/SearchAddressBooksPaginator.ts b/clients/client-alexa-for-business/src/pagination/SearchAddressBooksPaginator.ts index c30075317811..82872bc1f587 100644 --- a/clients/client-alexa-for-business/src/pagination/SearchAddressBooksPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/SearchAddressBooksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; @@ -9,42 +10,15 @@ import { } from "../commands/SearchAddressBooksCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: SearchAddressBooksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchAddressBooksCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchAddressBooks( +export const paginateSearchAddressBooks: ( config: AlexaForBusinessPaginationConfiguration, input: SearchAddressBooksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchAddressBooksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + SearchAddressBooksCommandInput, + SearchAddressBooksCommandOutput +>(AlexaForBusinessClient, SearchAddressBooksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/SearchContactsPaginator.ts b/clients/client-alexa-for-business/src/pagination/SearchContactsPaginator.ts index 678d35c74643..c5d918d6289c 100644 --- a/clients/client-alexa-for-business/src/pagination/SearchContactsPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/SearchContactsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; @@ -9,42 +10,15 @@ import { } from "../commands/SearchContactsCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: SearchContactsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchContactsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchContacts( +export const paginateSearchContacts: ( config: AlexaForBusinessPaginationConfiguration, input: SearchContactsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchContactsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + SearchContactsCommandInput, + SearchContactsCommandOutput +>(AlexaForBusinessClient, SearchContactsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/SearchDevicesPaginator.ts b/clients/client-alexa-for-business/src/pagination/SearchDevicesPaginator.ts index 883696422156..0178dcf62b27 100644 --- a/clients/client-alexa-for-business/src/pagination/SearchDevicesPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/SearchDevicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; @@ -9,42 +10,15 @@ import { } from "../commands/SearchDevicesCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: SearchDevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchDevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchDevices( +export const paginateSearchDevices: ( config: AlexaForBusinessPaginationConfiguration, input: SearchDevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchDevicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + SearchDevicesCommandInput, + SearchDevicesCommandOutput +>(AlexaForBusinessClient, SearchDevicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/SearchNetworkProfilesPaginator.ts b/clients/client-alexa-for-business/src/pagination/SearchNetworkProfilesPaginator.ts index c888acec5675..0f06a7d9e3fd 100644 --- a/clients/client-alexa-for-business/src/pagination/SearchNetworkProfilesPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/SearchNetworkProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; @@ -9,42 +10,15 @@ import { } from "../commands/SearchNetworkProfilesCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: SearchNetworkProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchNetworkProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchNetworkProfiles( +export const paginateSearchNetworkProfiles: ( config: AlexaForBusinessPaginationConfiguration, input: SearchNetworkProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchNetworkProfilesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + SearchNetworkProfilesCommandInput, + SearchNetworkProfilesCommandOutput +>(AlexaForBusinessClient, SearchNetworkProfilesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/SearchProfilesPaginator.ts b/clients/client-alexa-for-business/src/pagination/SearchProfilesPaginator.ts index 11cab3b8f6f7..8843f5a10025 100644 --- a/clients/client-alexa-for-business/src/pagination/SearchProfilesPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/SearchProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; @@ -9,42 +10,15 @@ import { } from "../commands/SearchProfilesCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: SearchProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchProfiles( +export const paginateSearchProfiles: ( config: AlexaForBusinessPaginationConfiguration, input: SearchProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchProfilesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + SearchProfilesCommandInput, + SearchProfilesCommandOutput +>(AlexaForBusinessClient, SearchProfilesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/SearchRoomsPaginator.ts b/clients/client-alexa-for-business/src/pagination/SearchRoomsPaginator.ts index 73999d8f43ef..06d437bfab88 100644 --- a/clients/client-alexa-for-business/src/pagination/SearchRoomsPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/SearchRoomsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; import { SearchRoomsCommand, SearchRoomsCommandInput, SearchRoomsCommandOutput } from "../commands/SearchRoomsCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: SearchRoomsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchRoomsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchRooms( +export const paginateSearchRooms: ( config: AlexaForBusinessPaginationConfiguration, input: SearchRoomsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchRoomsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + SearchRoomsCommandInput, + SearchRoomsCommandOutput +>(AlexaForBusinessClient, SearchRoomsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/SearchSkillGroupsPaginator.ts b/clients/client-alexa-for-business/src/pagination/SearchSkillGroupsPaginator.ts index 9cad61e7160d..e580682db0b9 100644 --- a/clients/client-alexa-for-business/src/pagination/SearchSkillGroupsPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/SearchSkillGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; @@ -9,42 +10,15 @@ import { } from "../commands/SearchSkillGroupsCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: SearchSkillGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchSkillGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchSkillGroups( +export const paginateSearchSkillGroups: ( config: AlexaForBusinessPaginationConfiguration, input: SearchSkillGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchSkillGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + SearchSkillGroupsCommandInput, + SearchSkillGroupsCommandOutput +>(AlexaForBusinessClient, SearchSkillGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-alexa-for-business/src/pagination/SearchUsersPaginator.ts b/clients/client-alexa-for-business/src/pagination/SearchUsersPaginator.ts index 4ea04b6df6d7..f3af638f59f0 100644 --- a/clients/client-alexa-for-business/src/pagination/SearchUsersPaginator.ts +++ b/clients/client-alexa-for-business/src/pagination/SearchUsersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AlexaForBusinessClient } from "../AlexaForBusinessClient"; import { SearchUsersCommand, SearchUsersCommandInput, SearchUsersCommandOutput } from "../commands/SearchUsersCommand"; import { AlexaForBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AlexaForBusinessClient, - input: SearchUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchUsers( +export const paginateSearchUsers: ( config: AlexaForBusinessPaginationConfiguration, input: SearchUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchUsersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AlexaForBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AlexaForBusinessPaginationConfiguration, + SearchUsersCommandInput, + SearchUsersCommandOutput +>(AlexaForBusinessClient, SearchUsersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-amp/src/pagination/ListRuleGroupsNamespacesPaginator.ts b/clients/client-amp/src/pagination/ListRuleGroupsNamespacesPaginator.ts index 259ccd001ac9..051a35b00710 100644 --- a/clients/client-amp/src/pagination/ListRuleGroupsNamespacesPaginator.ts +++ b/clients/client-amp/src/pagination/ListRuleGroupsNamespacesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AmpClient } from "../AmpClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRuleGroupsNamespacesCommand"; import { AmpPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AmpClient, - input: ListRuleGroupsNamespacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRuleGroupsNamespacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRuleGroupsNamespaces( +export const paginateListRuleGroupsNamespaces: ( config: AmpPaginationConfiguration, input: ListRuleGroupsNamespacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRuleGroupsNamespacesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AmpClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Amp | AmpClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AmpPaginationConfiguration, + ListRuleGroupsNamespacesCommandInput, + ListRuleGroupsNamespacesCommandOutput +>(AmpClient, ListRuleGroupsNamespacesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-amp/src/pagination/ListScrapersPaginator.ts b/clients/client-amp/src/pagination/ListScrapersPaginator.ts index 51024fd88630..7be8c7c408b6 100644 --- a/clients/client-amp/src/pagination/ListScrapersPaginator.ts +++ b/clients/client-amp/src/pagination/ListScrapersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AmpClient } from "../AmpClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListScrapersCommand"; import { AmpPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AmpClient, - input: ListScrapersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListScrapersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListScrapers( +export const paginateListScrapers: ( config: AmpPaginationConfiguration, input: ListScrapersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListScrapersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AmpClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Amp | AmpClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AmpPaginationConfiguration, + ListScrapersCommandInput, + ListScrapersCommandOutput +>(AmpClient, ListScrapersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-amp/src/pagination/ListWorkspacesPaginator.ts b/clients/client-amp/src/pagination/ListWorkspacesPaginator.ts index 0e6f59b9defc..a8295dacc94e 100644 --- a/clients/client-amp/src/pagination/ListWorkspacesPaginator.ts +++ b/clients/client-amp/src/pagination/ListWorkspacesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AmpClient } from "../AmpClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListWorkspacesCommand"; import { AmpPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AmpClient, - input: ListWorkspacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkspacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkspaces( +export const paginateListWorkspaces: ( config: AmpPaginationConfiguration, input: ListWorkspacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkspacesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AmpClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Amp | AmpClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AmpPaginationConfiguration, + ListWorkspacesCommandInput, + ListWorkspacesCommandOutput +>(AmpClient, ListWorkspacesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-amplify/src/pagination/ListAppsPaginator.ts b/clients/client-amplify/src/pagination/ListAppsPaginator.ts index e071db02e01c..c6e3938d0b4e 100644 --- a/clients/client-amplify/src/pagination/ListAppsPaginator.ts +++ b/clients/client-amplify/src/pagination/ListAppsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AmplifyClient } from "../AmplifyClient"; import { ListAppsCommand, ListAppsCommandInput, ListAppsCommandOutput } from "../commands/ListAppsCommand"; import { AmplifyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AmplifyClient, - input: ListAppsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApps( +export const paginateListApps: ( config: AmplifyPaginationConfiguration, input: ListAppsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AmplifyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Amplify | AmplifyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AmplifyPaginationConfiguration, + ListAppsCommandInput, + ListAppsCommandOutput +>(AmplifyClient, ListAppsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-amplify/src/pagination/ListBranchesPaginator.ts b/clients/client-amplify/src/pagination/ListBranchesPaginator.ts index d988b3f150fb..45dfaa18e20c 100644 --- a/clients/client-amplify/src/pagination/ListBranchesPaginator.ts +++ b/clients/client-amplify/src/pagination/ListBranchesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AmplifyClient } from "../AmplifyClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListBranchesCommand"; import { AmplifyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AmplifyClient, - input: ListBranchesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBranchesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBranches( +export const paginateListBranches: ( config: AmplifyPaginationConfiguration, input: ListBranchesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBranchesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AmplifyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Amplify | AmplifyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AmplifyPaginationConfiguration, + ListBranchesCommandInput, + ListBranchesCommandOutput +>(AmplifyClient, ListBranchesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-amplify/src/pagination/ListDomainAssociationsPaginator.ts b/clients/client-amplify/src/pagination/ListDomainAssociationsPaginator.ts index 9dc13a4d522b..4942093bfff7 100644 --- a/clients/client-amplify/src/pagination/ListDomainAssociationsPaginator.ts +++ b/clients/client-amplify/src/pagination/ListDomainAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AmplifyClient } from "../AmplifyClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListDomainAssociationsCommand"; import { AmplifyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AmplifyClient, - input: ListDomainAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomainAssociations( +export const paginateListDomainAssociations: ( config: AmplifyPaginationConfiguration, input: ListDomainAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainAssociationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AmplifyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Amplify | AmplifyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AmplifyPaginationConfiguration, + ListDomainAssociationsCommandInput, + ListDomainAssociationsCommandOutput +>(AmplifyClient, ListDomainAssociationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-amplify/src/pagination/ListJobsPaginator.ts b/clients/client-amplify/src/pagination/ListJobsPaginator.ts index 00fb2a9bef71..327146a622c8 100644 --- a/clients/client-amplify/src/pagination/ListJobsPaginator.ts +++ b/clients/client-amplify/src/pagination/ListJobsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AmplifyClient } from "../AmplifyClient"; import { ListJobsCommand, ListJobsCommandInput, ListJobsCommandOutput } from "../commands/ListJobsCommand"; import { AmplifyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AmplifyClient, - input: ListJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobs( +export const paginateListJobs: ( config: AmplifyPaginationConfiguration, input: ListJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AmplifyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Amplify | AmplifyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AmplifyPaginationConfiguration, + ListJobsCommandInput, + ListJobsCommandOutput +>(AmplifyClient, ListJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-amplifyuibuilder/src/pagination/ExportComponentsPaginator.ts b/clients/client-amplifyuibuilder/src/pagination/ExportComponentsPaginator.ts index ec5be50d4ab5..d0d4aee7108a 100644 --- a/clients/client-amplifyuibuilder/src/pagination/ExportComponentsPaginator.ts +++ b/clients/client-amplifyuibuilder/src/pagination/ExportComponentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AmplifyUIBuilderClient } from "../AmplifyUIBuilderClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ExportComponentsCommand"; import { AmplifyUIBuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AmplifyUIBuilderClient, - input: ExportComponentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ExportComponentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateExportComponents( +export const paginateExportComponents: ( config: AmplifyUIBuilderPaginationConfiguration, input: ExportComponentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ExportComponentsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof AmplifyUIBuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AmplifyUIBuilder | AmplifyUIBuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AmplifyUIBuilderPaginationConfiguration, + ExportComponentsCommandInput, + ExportComponentsCommandOutput +>(AmplifyUIBuilderClient, ExportComponentsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-amplifyuibuilder/src/pagination/ExportFormsPaginator.ts b/clients/client-amplifyuibuilder/src/pagination/ExportFormsPaginator.ts index 4ed34739ae6b..6df1360bd44c 100644 --- a/clients/client-amplifyuibuilder/src/pagination/ExportFormsPaginator.ts +++ b/clients/client-amplifyuibuilder/src/pagination/ExportFormsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AmplifyUIBuilderClient } from "../AmplifyUIBuilderClient"; import { ExportFormsCommand, ExportFormsCommandInput, ExportFormsCommandOutput } from "../commands/ExportFormsCommand"; import { AmplifyUIBuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AmplifyUIBuilderClient, - input: ExportFormsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ExportFormsCommand(input), ...args); -}; /** * @public */ -export async function* paginateExportForms( +export const paginateExportForms: ( config: AmplifyUIBuilderPaginationConfiguration, input: ExportFormsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ExportFormsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof AmplifyUIBuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AmplifyUIBuilder | AmplifyUIBuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AmplifyUIBuilderPaginationConfiguration, + ExportFormsCommandInput, + ExportFormsCommandOutput +>(AmplifyUIBuilderClient, ExportFormsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-amplifyuibuilder/src/pagination/ExportThemesPaginator.ts b/clients/client-amplifyuibuilder/src/pagination/ExportThemesPaginator.ts index d080d6d68db2..ef7a8efb809d 100644 --- a/clients/client-amplifyuibuilder/src/pagination/ExportThemesPaginator.ts +++ b/clients/client-amplifyuibuilder/src/pagination/ExportThemesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AmplifyUIBuilderClient } from "../AmplifyUIBuilderClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ExportThemesCommand"; import { AmplifyUIBuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AmplifyUIBuilderClient, - input: ExportThemesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ExportThemesCommand(input), ...args); -}; /** * @public */ -export async function* paginateExportThemes( +export const paginateExportThemes: ( config: AmplifyUIBuilderPaginationConfiguration, input: ExportThemesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ExportThemesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof AmplifyUIBuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AmplifyUIBuilder | AmplifyUIBuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AmplifyUIBuilderPaginationConfiguration, + ExportThemesCommandInput, + ExportThemesCommandOutput +>(AmplifyUIBuilderClient, ExportThemesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-amplifyuibuilder/src/pagination/ListCodegenJobsPaginator.ts b/clients/client-amplifyuibuilder/src/pagination/ListCodegenJobsPaginator.ts index 44978e1dbca3..1491819a821b 100644 --- a/clients/client-amplifyuibuilder/src/pagination/ListCodegenJobsPaginator.ts +++ b/clients/client-amplifyuibuilder/src/pagination/ListCodegenJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AmplifyUIBuilderClient } from "../AmplifyUIBuilderClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCodegenJobsCommand"; import { AmplifyUIBuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AmplifyUIBuilderClient, - input: ListCodegenJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCodegenJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCodegenJobs( +export const paginateListCodegenJobs: ( config: AmplifyUIBuilderPaginationConfiguration, input: ListCodegenJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCodegenJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AmplifyUIBuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AmplifyUIBuilder | AmplifyUIBuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AmplifyUIBuilderPaginationConfiguration, + ListCodegenJobsCommandInput, + ListCodegenJobsCommandOutput +>(AmplifyUIBuilderClient, ListCodegenJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-amplifyuibuilder/src/pagination/ListComponentsPaginator.ts b/clients/client-amplifyuibuilder/src/pagination/ListComponentsPaginator.ts index 586c652683f1..54af324ecbf7 100644 --- a/clients/client-amplifyuibuilder/src/pagination/ListComponentsPaginator.ts +++ b/clients/client-amplifyuibuilder/src/pagination/ListComponentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AmplifyUIBuilderClient } from "../AmplifyUIBuilderClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListComponentsCommand"; import { AmplifyUIBuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AmplifyUIBuilderClient, - input: ListComponentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComponentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComponents( +export const paginateListComponents: ( config: AmplifyUIBuilderPaginationConfiguration, input: ListComponentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComponentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AmplifyUIBuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AmplifyUIBuilder | AmplifyUIBuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AmplifyUIBuilderPaginationConfiguration, + ListComponentsCommandInput, + ListComponentsCommandOutput +>(AmplifyUIBuilderClient, ListComponentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-amplifyuibuilder/src/pagination/ListFormsPaginator.ts b/clients/client-amplifyuibuilder/src/pagination/ListFormsPaginator.ts index 246f6f174ec5..66edd9ad6fc4 100644 --- a/clients/client-amplifyuibuilder/src/pagination/ListFormsPaginator.ts +++ b/clients/client-amplifyuibuilder/src/pagination/ListFormsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AmplifyUIBuilderClient } from "../AmplifyUIBuilderClient"; import { ListFormsCommand, ListFormsCommandInput, ListFormsCommandOutput } from "../commands/ListFormsCommand"; import { AmplifyUIBuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AmplifyUIBuilderClient, - input: ListFormsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFormsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListForms( +export const paginateListForms: ( config: AmplifyUIBuilderPaginationConfiguration, input: ListFormsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFormsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AmplifyUIBuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AmplifyUIBuilder | AmplifyUIBuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AmplifyUIBuilderPaginationConfiguration, + ListFormsCommandInput, + ListFormsCommandOutput +>(AmplifyUIBuilderClient, ListFormsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-amplifyuibuilder/src/pagination/ListThemesPaginator.ts b/clients/client-amplifyuibuilder/src/pagination/ListThemesPaginator.ts index 97aa2e485c3f..aaee36bbec0b 100644 --- a/clients/client-amplifyuibuilder/src/pagination/ListThemesPaginator.ts +++ b/clients/client-amplifyuibuilder/src/pagination/ListThemesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AmplifyUIBuilderClient } from "../AmplifyUIBuilderClient"; import { ListThemesCommand, ListThemesCommandInput, ListThemesCommandOutput } from "../commands/ListThemesCommand"; import { AmplifyUIBuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AmplifyUIBuilderClient, - input: ListThemesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThemesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThemes( +export const paginateListThemes: ( config: AmplifyUIBuilderPaginationConfiguration, input: ListThemesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThemesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AmplifyUIBuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AmplifyUIBuilder | AmplifyUIBuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AmplifyUIBuilderPaginationConfiguration, + ListThemesCommandInput, + ListThemesCommandOutput +>(AmplifyUIBuilderClient, ListThemesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-api-gateway/src/pagination/GetApiKeysPaginator.ts b/clients/client-api-gateway/src/pagination/GetApiKeysPaginator.ts index 1f51566cddbc..970797512b7a 100644 --- a/clients/client-api-gateway/src/pagination/GetApiKeysPaginator.ts +++ b/clients/client-api-gateway/src/pagination/GetApiKeysPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { APIGatewayClient } from "../APIGatewayClient"; import { GetApiKeysCommand, GetApiKeysCommandInput, GetApiKeysCommandOutput } from "../commands/GetApiKeysCommand"; import { APIGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: APIGatewayClient, - input: GetApiKeysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetApiKeysCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetApiKeys( +export const paginateGetApiKeys: ( config: APIGatewayPaginationConfiguration, input: GetApiKeysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.position - let token: typeof input.position | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetApiKeysCommandOutput; - while (hasNext) { - input.position = token; - input["limit"] = config.pageSize; - if (config.client instanceof APIGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected APIGateway | APIGatewayClient"); - } - yield page; - const prevToken = token; - token = page.position; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + APIGatewayPaginationConfiguration, + GetApiKeysCommandInput, + GetApiKeysCommandOutput +>(APIGatewayClient, GetApiKeysCommand, "position", "position", "limit"); diff --git a/clients/client-api-gateway/src/pagination/GetBasePathMappingsPaginator.ts b/clients/client-api-gateway/src/pagination/GetBasePathMappingsPaginator.ts index b65457b6f934..078d6973c745 100644 --- a/clients/client-api-gateway/src/pagination/GetBasePathMappingsPaginator.ts +++ b/clients/client-api-gateway/src/pagination/GetBasePathMappingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { APIGatewayClient } from "../APIGatewayClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetBasePathMappingsCommand"; import { APIGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: APIGatewayClient, - input: GetBasePathMappingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetBasePathMappingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetBasePathMappings( +export const paginateGetBasePathMappings: ( config: APIGatewayPaginationConfiguration, input: GetBasePathMappingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.position - let token: typeof input.position | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetBasePathMappingsCommandOutput; - while (hasNext) { - input.position = token; - input["limit"] = config.pageSize; - if (config.client instanceof APIGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected APIGateway | APIGatewayClient"); - } - yield page; - const prevToken = token; - token = page.position; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + APIGatewayPaginationConfiguration, + GetBasePathMappingsCommandInput, + GetBasePathMappingsCommandOutput +>(APIGatewayClient, GetBasePathMappingsCommand, "position", "position", "limit"); diff --git a/clients/client-api-gateway/src/pagination/GetClientCertificatesPaginator.ts b/clients/client-api-gateway/src/pagination/GetClientCertificatesPaginator.ts index bbbae62de25b..bedbe9273816 100644 --- a/clients/client-api-gateway/src/pagination/GetClientCertificatesPaginator.ts +++ b/clients/client-api-gateway/src/pagination/GetClientCertificatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { APIGatewayClient } from "../APIGatewayClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetClientCertificatesCommand"; import { APIGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: APIGatewayClient, - input: GetClientCertificatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetClientCertificatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetClientCertificates( +export const paginateGetClientCertificates: ( config: APIGatewayPaginationConfiguration, input: GetClientCertificatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.position - let token: typeof input.position | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetClientCertificatesCommandOutput; - while (hasNext) { - input.position = token; - input["limit"] = config.pageSize; - if (config.client instanceof APIGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected APIGateway | APIGatewayClient"); - } - yield page; - const prevToken = token; - token = page.position; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + APIGatewayPaginationConfiguration, + GetClientCertificatesCommandInput, + GetClientCertificatesCommandOutput +>(APIGatewayClient, GetClientCertificatesCommand, "position", "position", "limit"); diff --git a/clients/client-api-gateway/src/pagination/GetDeploymentsPaginator.ts b/clients/client-api-gateway/src/pagination/GetDeploymentsPaginator.ts index e0d815ae9525..a17282db0178 100644 --- a/clients/client-api-gateway/src/pagination/GetDeploymentsPaginator.ts +++ b/clients/client-api-gateway/src/pagination/GetDeploymentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { APIGatewayClient } from "../APIGatewayClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetDeploymentsCommand"; import { APIGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: APIGatewayClient, - input: GetDeploymentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetDeploymentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetDeployments( +export const paginateGetDeployments: ( config: APIGatewayPaginationConfiguration, input: GetDeploymentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.position - let token: typeof input.position | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetDeploymentsCommandOutput; - while (hasNext) { - input.position = token; - input["limit"] = config.pageSize; - if (config.client instanceof APIGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected APIGateway | APIGatewayClient"); - } - yield page; - const prevToken = token; - token = page.position; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + APIGatewayPaginationConfiguration, + GetDeploymentsCommandInput, + GetDeploymentsCommandOutput +>(APIGatewayClient, GetDeploymentsCommand, "position", "position", "limit"); diff --git a/clients/client-api-gateway/src/pagination/GetDomainNamesPaginator.ts b/clients/client-api-gateway/src/pagination/GetDomainNamesPaginator.ts index ec79648bd57e..fd187dd9bcb1 100644 --- a/clients/client-api-gateway/src/pagination/GetDomainNamesPaginator.ts +++ b/clients/client-api-gateway/src/pagination/GetDomainNamesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { APIGatewayClient } from "../APIGatewayClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetDomainNamesCommand"; import { APIGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: APIGatewayClient, - input: GetDomainNamesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetDomainNamesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetDomainNames( +export const paginateGetDomainNames: ( config: APIGatewayPaginationConfiguration, input: GetDomainNamesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.position - let token: typeof input.position | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetDomainNamesCommandOutput; - while (hasNext) { - input.position = token; - input["limit"] = config.pageSize; - if (config.client instanceof APIGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected APIGateway | APIGatewayClient"); - } - yield page; - const prevToken = token; - token = page.position; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + APIGatewayPaginationConfiguration, + GetDomainNamesCommandInput, + GetDomainNamesCommandOutput +>(APIGatewayClient, GetDomainNamesCommand, "position", "position", "limit"); diff --git a/clients/client-api-gateway/src/pagination/GetModelsPaginator.ts b/clients/client-api-gateway/src/pagination/GetModelsPaginator.ts index 657bc0196ce3..f73fa8180eb9 100644 --- a/clients/client-api-gateway/src/pagination/GetModelsPaginator.ts +++ b/clients/client-api-gateway/src/pagination/GetModelsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { APIGatewayClient } from "../APIGatewayClient"; import { GetModelsCommand, GetModelsCommandInput, GetModelsCommandOutput } from "../commands/GetModelsCommand"; import { APIGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: APIGatewayClient, - input: GetModelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetModelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetModels( +export const paginateGetModels: ( config: APIGatewayPaginationConfiguration, input: GetModelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.position - let token: typeof input.position | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetModelsCommandOutput; - while (hasNext) { - input.position = token; - input["limit"] = config.pageSize; - if (config.client instanceof APIGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected APIGateway | APIGatewayClient"); - } - yield page; - const prevToken = token; - token = page.position; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + APIGatewayPaginationConfiguration, + GetModelsCommandInput, + GetModelsCommandOutput +>(APIGatewayClient, GetModelsCommand, "position", "position", "limit"); diff --git a/clients/client-api-gateway/src/pagination/GetResourcesPaginator.ts b/clients/client-api-gateway/src/pagination/GetResourcesPaginator.ts index 684c3dff3354..4b9358d082a0 100644 --- a/clients/client-api-gateway/src/pagination/GetResourcesPaginator.ts +++ b/clients/client-api-gateway/src/pagination/GetResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { APIGatewayClient } from "../APIGatewayClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetResourcesCommand"; import { APIGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: APIGatewayClient, - input: GetResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetResources( +export const paginateGetResources: ( config: APIGatewayPaginationConfiguration, input: GetResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.position - let token: typeof input.position | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetResourcesCommandOutput; - while (hasNext) { - input.position = token; - input["limit"] = config.pageSize; - if (config.client instanceof APIGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected APIGateway | APIGatewayClient"); - } - yield page; - const prevToken = token; - token = page.position; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + APIGatewayPaginationConfiguration, + GetResourcesCommandInput, + GetResourcesCommandOutput +>(APIGatewayClient, GetResourcesCommand, "position", "position", "limit"); diff --git a/clients/client-api-gateway/src/pagination/GetRestApisPaginator.ts b/clients/client-api-gateway/src/pagination/GetRestApisPaginator.ts index f62b4ef35017..5369ba51803d 100644 --- a/clients/client-api-gateway/src/pagination/GetRestApisPaginator.ts +++ b/clients/client-api-gateway/src/pagination/GetRestApisPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { APIGatewayClient } from "../APIGatewayClient"; import { GetRestApisCommand, GetRestApisCommandInput, GetRestApisCommandOutput } from "../commands/GetRestApisCommand"; import { APIGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: APIGatewayClient, - input: GetRestApisCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetRestApisCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetRestApis( +export const paginateGetRestApis: ( config: APIGatewayPaginationConfiguration, input: GetRestApisCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.position - let token: typeof input.position | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetRestApisCommandOutput; - while (hasNext) { - input.position = token; - input["limit"] = config.pageSize; - if (config.client instanceof APIGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected APIGateway | APIGatewayClient"); - } - yield page; - const prevToken = token; - token = page.position; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + APIGatewayPaginationConfiguration, + GetRestApisCommandInput, + GetRestApisCommandOutput +>(APIGatewayClient, GetRestApisCommand, "position", "position", "limit"); diff --git a/clients/client-api-gateway/src/pagination/GetUsagePaginator.ts b/clients/client-api-gateway/src/pagination/GetUsagePaginator.ts index 529432f77227..782eff2417e5 100644 --- a/clients/client-api-gateway/src/pagination/GetUsagePaginator.ts +++ b/clients/client-api-gateway/src/pagination/GetUsagePaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { APIGatewayClient } from "../APIGatewayClient"; import { GetUsageCommand, GetUsageCommandInput, GetUsageCommandOutput } from "../commands/GetUsageCommand"; import { APIGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: APIGatewayClient, - input: GetUsageCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetUsageCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetUsage( +export const paginateGetUsage: ( config: APIGatewayPaginationConfiguration, input: GetUsageCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.position - let token: typeof input.position | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetUsageCommandOutput; - while (hasNext) { - input.position = token; - input["limit"] = config.pageSize; - if (config.client instanceof APIGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected APIGateway | APIGatewayClient"); - } - yield page; - const prevToken = token; - token = page.position; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + APIGatewayPaginationConfiguration, + GetUsageCommandInput, + GetUsageCommandOutput +>(APIGatewayClient, GetUsageCommand, "position", "position", "limit"); diff --git a/clients/client-api-gateway/src/pagination/GetUsagePlanKeysPaginator.ts b/clients/client-api-gateway/src/pagination/GetUsagePlanKeysPaginator.ts index e8fd2da4fd92..28b88d321863 100644 --- a/clients/client-api-gateway/src/pagination/GetUsagePlanKeysPaginator.ts +++ b/clients/client-api-gateway/src/pagination/GetUsagePlanKeysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { APIGatewayClient } from "../APIGatewayClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetUsagePlanKeysCommand"; import { APIGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: APIGatewayClient, - input: GetUsagePlanKeysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetUsagePlanKeysCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetUsagePlanKeys( +export const paginateGetUsagePlanKeys: ( config: APIGatewayPaginationConfiguration, input: GetUsagePlanKeysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.position - let token: typeof input.position | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetUsagePlanKeysCommandOutput; - while (hasNext) { - input.position = token; - input["limit"] = config.pageSize; - if (config.client instanceof APIGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected APIGateway | APIGatewayClient"); - } - yield page; - const prevToken = token; - token = page.position; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + APIGatewayPaginationConfiguration, + GetUsagePlanKeysCommandInput, + GetUsagePlanKeysCommandOutput +>(APIGatewayClient, GetUsagePlanKeysCommand, "position", "position", "limit"); diff --git a/clients/client-api-gateway/src/pagination/GetUsagePlansPaginator.ts b/clients/client-api-gateway/src/pagination/GetUsagePlansPaginator.ts index c593bd44691f..7e6487752e75 100644 --- a/clients/client-api-gateway/src/pagination/GetUsagePlansPaginator.ts +++ b/clients/client-api-gateway/src/pagination/GetUsagePlansPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { APIGatewayClient } from "../APIGatewayClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetUsagePlansCommand"; import { APIGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: APIGatewayClient, - input: GetUsagePlansCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetUsagePlansCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetUsagePlans( +export const paginateGetUsagePlans: ( config: APIGatewayPaginationConfiguration, input: GetUsagePlansCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.position - let token: typeof input.position | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetUsagePlansCommandOutput; - while (hasNext) { - input.position = token; - input["limit"] = config.pageSize; - if (config.client instanceof APIGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected APIGateway | APIGatewayClient"); - } - yield page; - const prevToken = token; - token = page.position; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + APIGatewayPaginationConfiguration, + GetUsagePlansCommandInput, + GetUsagePlansCommandOutput +>(APIGatewayClient, GetUsagePlansCommand, "position", "position", "limit"); diff --git a/clients/client-api-gateway/src/pagination/GetVpcLinksPaginator.ts b/clients/client-api-gateway/src/pagination/GetVpcLinksPaginator.ts index 04801119214a..8afbad9f5843 100644 --- a/clients/client-api-gateway/src/pagination/GetVpcLinksPaginator.ts +++ b/clients/client-api-gateway/src/pagination/GetVpcLinksPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { APIGatewayClient } from "../APIGatewayClient"; import { GetVpcLinksCommand, GetVpcLinksCommandInput, GetVpcLinksCommandOutput } from "../commands/GetVpcLinksCommand"; import { APIGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: APIGatewayClient, - input: GetVpcLinksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetVpcLinksCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetVpcLinks( +export const paginateGetVpcLinks: ( config: APIGatewayPaginationConfiguration, input: GetVpcLinksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.position - let token: typeof input.position | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetVpcLinksCommandOutput; - while (hasNext) { - input.position = token; - input["limit"] = config.pageSize; - if (config.client instanceof APIGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected APIGateway | APIGatewayClient"); - } - yield page; - const prevToken = token; - token = page.position; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + APIGatewayPaginationConfiguration, + GetVpcLinksCommandInput, + GetVpcLinksCommandOutput +>(APIGatewayClient, GetVpcLinksCommand, "position", "position", "limit"); diff --git a/clients/client-app-mesh/src/pagination/ListGatewayRoutesPaginator.ts b/clients/client-app-mesh/src/pagination/ListGatewayRoutesPaginator.ts index 0befe173494a..78469af2db47 100644 --- a/clients/client-app-mesh/src/pagination/ListGatewayRoutesPaginator.ts +++ b/clients/client-app-mesh/src/pagination/ListGatewayRoutesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppMeshClient } from "../AppMeshClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListGatewayRoutesCommand"; import { AppMeshPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppMeshClient, - input: ListGatewayRoutesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGatewayRoutesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGatewayRoutes( +export const paginateListGatewayRoutes: ( config: AppMeshPaginationConfiguration, input: ListGatewayRoutesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGatewayRoutesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof AppMeshClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppMesh | AppMeshClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppMeshPaginationConfiguration, + ListGatewayRoutesCommandInput, + ListGatewayRoutesCommandOutput +>(AppMeshClient, ListGatewayRoutesCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-app-mesh/src/pagination/ListMeshesPaginator.ts b/clients/client-app-mesh/src/pagination/ListMeshesPaginator.ts index 123edb2801d1..88c9f7bcc2d1 100644 --- a/clients/client-app-mesh/src/pagination/ListMeshesPaginator.ts +++ b/clients/client-app-mesh/src/pagination/ListMeshesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppMeshClient } from "../AppMeshClient"; import { ListMeshesCommand, ListMeshesCommandInput, ListMeshesCommandOutput } from "../commands/ListMeshesCommand"; import { AppMeshPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppMeshClient, - input: ListMeshesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMeshesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMeshes( +export const paginateListMeshes: ( config: AppMeshPaginationConfiguration, input: ListMeshesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMeshesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof AppMeshClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppMesh | AppMeshClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppMeshPaginationConfiguration, + ListMeshesCommandInput, + ListMeshesCommandOutput +>(AppMeshClient, ListMeshesCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-app-mesh/src/pagination/ListRoutesPaginator.ts b/clients/client-app-mesh/src/pagination/ListRoutesPaginator.ts index da469b47a4aa..52527c82011c 100644 --- a/clients/client-app-mesh/src/pagination/ListRoutesPaginator.ts +++ b/clients/client-app-mesh/src/pagination/ListRoutesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppMeshClient } from "../AppMeshClient"; import { ListRoutesCommand, ListRoutesCommandInput, ListRoutesCommandOutput } from "../commands/ListRoutesCommand"; import { AppMeshPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppMeshClient, - input: ListRoutesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRoutesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRoutes( +export const paginateListRoutes: ( config: AppMeshPaginationConfiguration, input: ListRoutesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRoutesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof AppMeshClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppMesh | AppMeshClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppMeshPaginationConfiguration, + ListRoutesCommandInput, + ListRoutesCommandOutput +>(AppMeshClient, ListRoutesCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-app-mesh/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-app-mesh/src/pagination/ListTagsForResourcePaginator.ts index 36ac1807c178..4add8560a00c 100644 --- a/clients/client-app-mesh/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-app-mesh/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppMeshClient } from "../AppMeshClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListTagsForResourceCommand"; import { AppMeshPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppMeshClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: AppMeshPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof AppMeshClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppMesh | AppMeshClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppMeshPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(AppMeshClient, ListTagsForResourceCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-app-mesh/src/pagination/ListVirtualGatewaysPaginator.ts b/clients/client-app-mesh/src/pagination/ListVirtualGatewaysPaginator.ts index 93d21d4a0e50..e71ecd1bb9ee 100644 --- a/clients/client-app-mesh/src/pagination/ListVirtualGatewaysPaginator.ts +++ b/clients/client-app-mesh/src/pagination/ListVirtualGatewaysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppMeshClient } from "../AppMeshClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListVirtualGatewaysCommand"; import { AppMeshPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppMeshClient, - input: ListVirtualGatewaysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVirtualGatewaysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVirtualGateways( +export const paginateListVirtualGateways: ( config: AppMeshPaginationConfiguration, input: ListVirtualGatewaysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVirtualGatewaysCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof AppMeshClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppMesh | AppMeshClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppMeshPaginationConfiguration, + ListVirtualGatewaysCommandInput, + ListVirtualGatewaysCommandOutput +>(AppMeshClient, ListVirtualGatewaysCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-app-mesh/src/pagination/ListVirtualNodesPaginator.ts b/clients/client-app-mesh/src/pagination/ListVirtualNodesPaginator.ts index 90b8fbe3f4c7..65dbbac6537b 100644 --- a/clients/client-app-mesh/src/pagination/ListVirtualNodesPaginator.ts +++ b/clients/client-app-mesh/src/pagination/ListVirtualNodesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppMeshClient } from "../AppMeshClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListVirtualNodesCommand"; import { AppMeshPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppMeshClient, - input: ListVirtualNodesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVirtualNodesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVirtualNodes( +export const paginateListVirtualNodes: ( config: AppMeshPaginationConfiguration, input: ListVirtualNodesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVirtualNodesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof AppMeshClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppMesh | AppMeshClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppMeshPaginationConfiguration, + ListVirtualNodesCommandInput, + ListVirtualNodesCommandOutput +>(AppMeshClient, ListVirtualNodesCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-app-mesh/src/pagination/ListVirtualRoutersPaginator.ts b/clients/client-app-mesh/src/pagination/ListVirtualRoutersPaginator.ts index ccc1427c2f89..60050f48d4b9 100644 --- a/clients/client-app-mesh/src/pagination/ListVirtualRoutersPaginator.ts +++ b/clients/client-app-mesh/src/pagination/ListVirtualRoutersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppMeshClient } from "../AppMeshClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListVirtualRoutersCommand"; import { AppMeshPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppMeshClient, - input: ListVirtualRoutersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVirtualRoutersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVirtualRouters( +export const paginateListVirtualRouters: ( config: AppMeshPaginationConfiguration, input: ListVirtualRoutersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVirtualRoutersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof AppMeshClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppMesh | AppMeshClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppMeshPaginationConfiguration, + ListVirtualRoutersCommandInput, + ListVirtualRoutersCommandOutput +>(AppMeshClient, ListVirtualRoutersCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-app-mesh/src/pagination/ListVirtualServicesPaginator.ts b/clients/client-app-mesh/src/pagination/ListVirtualServicesPaginator.ts index 80e13fa5f901..84869abea15f 100644 --- a/clients/client-app-mesh/src/pagination/ListVirtualServicesPaginator.ts +++ b/clients/client-app-mesh/src/pagination/ListVirtualServicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppMeshClient } from "../AppMeshClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListVirtualServicesCommand"; import { AppMeshPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppMeshClient, - input: ListVirtualServicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVirtualServicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVirtualServices( +export const paginateListVirtualServices: ( config: AppMeshPaginationConfiguration, input: ListVirtualServicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVirtualServicesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof AppMeshClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppMesh | AppMeshClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppMeshPaginationConfiguration, + ListVirtualServicesCommandInput, + ListVirtualServicesCommandOutput +>(AppMeshClient, ListVirtualServicesCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-appconfig/src/pagination/ListApplicationsPaginator.ts b/clients/client-appconfig/src/pagination/ListApplicationsPaginator.ts index e68e7e60ac57..fe679b93dc7d 100644 --- a/clients/client-appconfig/src/pagination/ListApplicationsPaginator.ts +++ b/clients/client-appconfig/src/pagination/ListApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppConfigClient } from "../AppConfigClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListApplicationsCommand"; import { AppConfigPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppConfigClient, - input: ListApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplications( +export const paginateListApplications: ( config: AppConfigPaginationConfiguration, input: ListApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppConfigClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppConfig | AppConfigClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppConfigPaginationConfiguration, + ListApplicationsCommandInput, + ListApplicationsCommandOutput +>(AppConfigClient, ListApplicationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appconfig/src/pagination/ListConfigurationProfilesPaginator.ts b/clients/client-appconfig/src/pagination/ListConfigurationProfilesPaginator.ts index cfb1f6d2d0ba..a9cc50c59fdb 100644 --- a/clients/client-appconfig/src/pagination/ListConfigurationProfilesPaginator.ts +++ b/clients/client-appconfig/src/pagination/ListConfigurationProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppConfigClient } from "../AppConfigClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListConfigurationProfilesCommand"; import { AppConfigPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppConfigClient, - input: ListConfigurationProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConfigurationProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConfigurationProfiles( +export const paginateListConfigurationProfiles: ( config: AppConfigPaginationConfiguration, input: ListConfigurationProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConfigurationProfilesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppConfigClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppConfig | AppConfigClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppConfigPaginationConfiguration, + ListConfigurationProfilesCommandInput, + ListConfigurationProfilesCommandOutput +>(AppConfigClient, ListConfigurationProfilesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appconfig/src/pagination/ListDeploymentStrategiesPaginator.ts b/clients/client-appconfig/src/pagination/ListDeploymentStrategiesPaginator.ts index 82596a3ce538..7eddc62c2558 100644 --- a/clients/client-appconfig/src/pagination/ListDeploymentStrategiesPaginator.ts +++ b/clients/client-appconfig/src/pagination/ListDeploymentStrategiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppConfigClient } from "../AppConfigClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListDeploymentStrategiesCommand"; import { AppConfigPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppConfigClient, - input: ListDeploymentStrategiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeploymentStrategiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeploymentStrategies( +export const paginateListDeploymentStrategies: ( config: AppConfigPaginationConfiguration, input: ListDeploymentStrategiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeploymentStrategiesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppConfigClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppConfig | AppConfigClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppConfigPaginationConfiguration, + ListDeploymentStrategiesCommandInput, + ListDeploymentStrategiesCommandOutput +>(AppConfigClient, ListDeploymentStrategiesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appconfig/src/pagination/ListDeploymentsPaginator.ts b/clients/client-appconfig/src/pagination/ListDeploymentsPaginator.ts index 9088d79f6a77..33c8dba5dd32 100644 --- a/clients/client-appconfig/src/pagination/ListDeploymentsPaginator.ts +++ b/clients/client-appconfig/src/pagination/ListDeploymentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppConfigClient } from "../AppConfigClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListDeploymentsCommand"; import { AppConfigPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppConfigClient, - input: ListDeploymentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeploymentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeployments( +export const paginateListDeployments: ( config: AppConfigPaginationConfiguration, input: ListDeploymentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeploymentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppConfigClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppConfig | AppConfigClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppConfigPaginationConfiguration, + ListDeploymentsCommandInput, + ListDeploymentsCommandOutput +>(AppConfigClient, ListDeploymentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appconfig/src/pagination/ListEnvironmentsPaginator.ts b/clients/client-appconfig/src/pagination/ListEnvironmentsPaginator.ts index 5ecd21ff05ac..a20717449b11 100644 --- a/clients/client-appconfig/src/pagination/ListEnvironmentsPaginator.ts +++ b/clients/client-appconfig/src/pagination/ListEnvironmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppConfigClient } from "../AppConfigClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListEnvironmentsCommand"; import { AppConfigPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppConfigClient, - input: ListEnvironmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironments( +export const paginateListEnvironments: ( config: AppConfigPaginationConfiguration, input: ListEnvironmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppConfigClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppConfig | AppConfigClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppConfigPaginationConfiguration, + ListEnvironmentsCommandInput, + ListEnvironmentsCommandOutput +>(AppConfigClient, ListEnvironmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appconfig/src/pagination/ListExtensionAssociationsPaginator.ts b/clients/client-appconfig/src/pagination/ListExtensionAssociationsPaginator.ts index 1643ea7d5052..d863d0a32ec7 100644 --- a/clients/client-appconfig/src/pagination/ListExtensionAssociationsPaginator.ts +++ b/clients/client-appconfig/src/pagination/ListExtensionAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppConfigClient } from "../AppConfigClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListExtensionAssociationsCommand"; import { AppConfigPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppConfigClient, - input: ListExtensionAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExtensionAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExtensionAssociations( +export const paginateListExtensionAssociations: ( config: AppConfigPaginationConfiguration, input: ListExtensionAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExtensionAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppConfigClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppConfig | AppConfigClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppConfigPaginationConfiguration, + ListExtensionAssociationsCommandInput, + ListExtensionAssociationsCommandOutput +>(AppConfigClient, ListExtensionAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appconfig/src/pagination/ListExtensionsPaginator.ts b/clients/client-appconfig/src/pagination/ListExtensionsPaginator.ts index 946cafb56e4c..6aaa303ddd56 100644 --- a/clients/client-appconfig/src/pagination/ListExtensionsPaginator.ts +++ b/clients/client-appconfig/src/pagination/ListExtensionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppConfigClient } from "../AppConfigClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListExtensionsCommand"; import { AppConfigPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppConfigClient, - input: ListExtensionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExtensionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExtensions( +export const paginateListExtensions: ( config: AppConfigPaginationConfiguration, input: ListExtensionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExtensionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppConfigClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppConfig | AppConfigClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppConfigPaginationConfiguration, + ListExtensionsCommandInput, + ListExtensionsCommandOutput +>(AppConfigClient, ListExtensionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appconfig/src/pagination/ListHostedConfigurationVersionsPaginator.ts b/clients/client-appconfig/src/pagination/ListHostedConfigurationVersionsPaginator.ts index e194e3adee97..863873cd18dc 100644 --- a/clients/client-appconfig/src/pagination/ListHostedConfigurationVersionsPaginator.ts +++ b/clients/client-appconfig/src/pagination/ListHostedConfigurationVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppConfigClient } from "../AppConfigClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListHostedConfigurationVersionsCommand"; import { AppConfigPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppConfigClient, - input: ListHostedConfigurationVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHostedConfigurationVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHostedConfigurationVersions( +export const paginateListHostedConfigurationVersions: ( config: AppConfigPaginationConfiguration, input: ListHostedConfigurationVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHostedConfigurationVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppConfigClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppConfig | AppConfigClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppConfigPaginationConfiguration, + ListHostedConfigurationVersionsCommandInput, + ListHostedConfigurationVersionsCommandOutput +>(AppConfigClient, ListHostedConfigurationVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appfabric/src/pagination/ListAppAuthorizationsPaginator.ts b/clients/client-appfabric/src/pagination/ListAppAuthorizationsPaginator.ts index fda4450630e8..063b39db7b67 100644 --- a/clients/client-appfabric/src/pagination/ListAppAuthorizationsPaginator.ts +++ b/clients/client-appfabric/src/pagination/ListAppAuthorizationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppFabricClient } from "../AppFabricClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAppAuthorizationsCommand"; import { AppFabricPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppFabricClient, - input: ListAppAuthorizationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppAuthorizationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppAuthorizations( +export const paginateListAppAuthorizations: ( config: AppFabricPaginationConfiguration, input: ListAppAuthorizationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppAuthorizationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AppFabricClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppFabric | AppFabricClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppFabricPaginationConfiguration, + ListAppAuthorizationsCommandInput, + ListAppAuthorizationsCommandOutput +>(AppFabricClient, ListAppAuthorizationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-appfabric/src/pagination/ListAppBundlesPaginator.ts b/clients/client-appfabric/src/pagination/ListAppBundlesPaginator.ts index f105da43c082..60815670a30a 100644 --- a/clients/client-appfabric/src/pagination/ListAppBundlesPaginator.ts +++ b/clients/client-appfabric/src/pagination/ListAppBundlesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppFabricClient } from "../AppFabricClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAppBundlesCommand"; import { AppFabricPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppFabricClient, - input: ListAppBundlesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppBundlesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppBundles( +export const paginateListAppBundles: ( config: AppFabricPaginationConfiguration, input: ListAppBundlesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppBundlesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AppFabricClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppFabric | AppFabricClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppFabricPaginationConfiguration, + ListAppBundlesCommandInput, + ListAppBundlesCommandOutput +>(AppFabricClient, ListAppBundlesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-appfabric/src/pagination/ListIngestionDestinationsPaginator.ts b/clients/client-appfabric/src/pagination/ListIngestionDestinationsPaginator.ts index 211ca77629d5..1366d0dea19e 100644 --- a/clients/client-appfabric/src/pagination/ListIngestionDestinationsPaginator.ts +++ b/clients/client-appfabric/src/pagination/ListIngestionDestinationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppFabricClient } from "../AppFabricClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListIngestionDestinationsCommand"; import { AppFabricPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppFabricClient, - input: ListIngestionDestinationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIngestionDestinationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIngestionDestinations( +export const paginateListIngestionDestinations: ( config: AppFabricPaginationConfiguration, input: ListIngestionDestinationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIngestionDestinationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AppFabricClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppFabric | AppFabricClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppFabricPaginationConfiguration, + ListIngestionDestinationsCommandInput, + ListIngestionDestinationsCommandOutput +>(AppFabricClient, ListIngestionDestinationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-appfabric/src/pagination/ListIngestionsPaginator.ts b/clients/client-appfabric/src/pagination/ListIngestionsPaginator.ts index ef166246e1ec..99050d48a9ff 100644 --- a/clients/client-appfabric/src/pagination/ListIngestionsPaginator.ts +++ b/clients/client-appfabric/src/pagination/ListIngestionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppFabricClient } from "../AppFabricClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListIngestionsCommand"; import { AppFabricPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppFabricClient, - input: ListIngestionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIngestionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIngestions( +export const paginateListIngestions: ( config: AppFabricPaginationConfiguration, input: ListIngestionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIngestionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AppFabricClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppFabric | AppFabricClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppFabricPaginationConfiguration, + ListIngestionsCommandInput, + ListIngestionsCommandOutput +>(AppFabricClient, ListIngestionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-appflow/src/pagination/DescribeConnectorProfilesPaginator.ts b/clients/client-appflow/src/pagination/DescribeConnectorProfilesPaginator.ts index 50f7d682c8f1..73f39564800a 100644 --- a/clients/client-appflow/src/pagination/DescribeConnectorProfilesPaginator.ts +++ b/clients/client-appflow/src/pagination/DescribeConnectorProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppflowClient } from "../AppflowClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeConnectorProfilesCommand"; import { AppflowPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppflowClient, - input: DescribeConnectorProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeConnectorProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeConnectorProfiles( +export const paginateDescribeConnectorProfiles: ( config: AppflowPaginationConfiguration, input: DescribeConnectorProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeConnectorProfilesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AppflowClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Appflow | AppflowClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppflowPaginationConfiguration, + DescribeConnectorProfilesCommandInput, + DescribeConnectorProfilesCommandOutput +>(AppflowClient, DescribeConnectorProfilesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-appflow/src/pagination/DescribeConnectorsPaginator.ts b/clients/client-appflow/src/pagination/DescribeConnectorsPaginator.ts index 9dd4599ea61e..cb00b6616a87 100644 --- a/clients/client-appflow/src/pagination/DescribeConnectorsPaginator.ts +++ b/clients/client-appflow/src/pagination/DescribeConnectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppflowClient } from "../AppflowClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeConnectorsCommand"; import { AppflowPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppflowClient, - input: DescribeConnectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeConnectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeConnectors( +export const paginateDescribeConnectors: ( config: AppflowPaginationConfiguration, input: DescribeConnectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeConnectorsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AppflowClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Appflow | AppflowClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppflowPaginationConfiguration, + DescribeConnectorsCommandInput, + DescribeConnectorsCommandOutput +>(AppflowClient, DescribeConnectorsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-appflow/src/pagination/DescribeFlowExecutionRecordsPaginator.ts b/clients/client-appflow/src/pagination/DescribeFlowExecutionRecordsPaginator.ts index 6a80686863b2..55d733c318d4 100644 --- a/clients/client-appflow/src/pagination/DescribeFlowExecutionRecordsPaginator.ts +++ b/clients/client-appflow/src/pagination/DescribeFlowExecutionRecordsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppflowClient } from "../AppflowClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeFlowExecutionRecordsCommand"; import { AppflowPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppflowClient, - input: DescribeFlowExecutionRecordsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFlowExecutionRecordsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFlowExecutionRecords( +export const paginateDescribeFlowExecutionRecords: ( config: AppflowPaginationConfiguration, input: DescribeFlowExecutionRecordsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFlowExecutionRecordsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AppflowClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Appflow | AppflowClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppflowPaginationConfiguration, + DescribeFlowExecutionRecordsCommandInput, + DescribeFlowExecutionRecordsCommandOutput +>(AppflowClient, DescribeFlowExecutionRecordsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-appflow/src/pagination/ListConnectorsPaginator.ts b/clients/client-appflow/src/pagination/ListConnectorsPaginator.ts index 0175009e526d..89289f99c874 100644 --- a/clients/client-appflow/src/pagination/ListConnectorsPaginator.ts +++ b/clients/client-appflow/src/pagination/ListConnectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppflowClient } from "../AppflowClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListConnectorsCommand"; import { AppflowPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppflowClient, - input: ListConnectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConnectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConnectors( +export const paginateListConnectors: ( config: AppflowPaginationConfiguration, input: ListConnectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConnectorsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AppflowClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Appflow | AppflowClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppflowPaginationConfiguration, + ListConnectorsCommandInput, + ListConnectorsCommandOutput +>(AppflowClient, ListConnectorsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-appflow/src/pagination/ListFlowsPaginator.ts b/clients/client-appflow/src/pagination/ListFlowsPaginator.ts index 6a26735b6af1..2d5dd0ae1cda 100644 --- a/clients/client-appflow/src/pagination/ListFlowsPaginator.ts +++ b/clients/client-appflow/src/pagination/ListFlowsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppflowClient } from "../AppflowClient"; import { ListFlowsCommand, ListFlowsCommandInput, ListFlowsCommandOutput } from "../commands/ListFlowsCommand"; import { AppflowPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppflowClient, - input: ListFlowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFlowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFlows( +export const paginateListFlows: ( config: AppflowPaginationConfiguration, input: ListFlowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFlowsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AppflowClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Appflow | AppflowClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppflowPaginationConfiguration, + ListFlowsCommandInput, + ListFlowsCommandOutput +>(AppflowClient, ListFlowsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-appintegrations/src/pagination/ListApplicationsPaginator.ts b/clients/client-appintegrations/src/pagination/ListApplicationsPaginator.ts index 2da623c8537f..1ad79b3cbc61 100644 --- a/clients/client-appintegrations/src/pagination/ListApplicationsPaginator.ts +++ b/clients/client-appintegrations/src/pagination/ListApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppIntegrationsClient } from "../AppIntegrationsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListApplicationsCommand"; import { AppIntegrationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppIntegrationsClient, - input: ListApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplications( +export const paginateListApplications: ( config: AppIntegrationsPaginationConfiguration, input: ListApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppIntegrationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppIntegrations | AppIntegrationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppIntegrationsPaginationConfiguration, + ListApplicationsCommandInput, + ListApplicationsCommandOutput +>(AppIntegrationsClient, ListApplicationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appintegrations/src/pagination/ListDataIntegrationAssociationsPaginator.ts b/clients/client-appintegrations/src/pagination/ListDataIntegrationAssociationsPaginator.ts index de136b423c8b..8995cf916d95 100644 --- a/clients/client-appintegrations/src/pagination/ListDataIntegrationAssociationsPaginator.ts +++ b/clients/client-appintegrations/src/pagination/ListDataIntegrationAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppIntegrationsClient } from "../AppIntegrationsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListDataIntegrationAssociationsCommand"; import { AppIntegrationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppIntegrationsClient, - input: ListDataIntegrationAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataIntegrationAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataIntegrationAssociations( +export const paginateListDataIntegrationAssociations: ( config: AppIntegrationsPaginationConfiguration, input: ListDataIntegrationAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataIntegrationAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppIntegrationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppIntegrations | AppIntegrationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppIntegrationsPaginationConfiguration, + ListDataIntegrationAssociationsCommandInput, + ListDataIntegrationAssociationsCommandOutput +>(AppIntegrationsClient, ListDataIntegrationAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appintegrations/src/pagination/ListDataIntegrationsPaginator.ts b/clients/client-appintegrations/src/pagination/ListDataIntegrationsPaginator.ts index 4d962d9112ae..4a1416d42c79 100644 --- a/clients/client-appintegrations/src/pagination/ListDataIntegrationsPaginator.ts +++ b/clients/client-appintegrations/src/pagination/ListDataIntegrationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppIntegrationsClient } from "../AppIntegrationsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListDataIntegrationsCommand"; import { AppIntegrationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppIntegrationsClient, - input: ListDataIntegrationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataIntegrationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataIntegrations( +export const paginateListDataIntegrations: ( config: AppIntegrationsPaginationConfiguration, input: ListDataIntegrationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataIntegrationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppIntegrationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppIntegrations | AppIntegrationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppIntegrationsPaginationConfiguration, + ListDataIntegrationsCommandInput, + ListDataIntegrationsCommandOutput +>(AppIntegrationsClient, ListDataIntegrationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appintegrations/src/pagination/ListEventIntegrationAssociationsPaginator.ts b/clients/client-appintegrations/src/pagination/ListEventIntegrationAssociationsPaginator.ts index 15008e7b1855..5b39c5b63066 100644 --- a/clients/client-appintegrations/src/pagination/ListEventIntegrationAssociationsPaginator.ts +++ b/clients/client-appintegrations/src/pagination/ListEventIntegrationAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppIntegrationsClient } from "../AppIntegrationsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListEventIntegrationAssociationsCommand"; import { AppIntegrationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppIntegrationsClient, - input: ListEventIntegrationAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEventIntegrationAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEventIntegrationAssociations( +export const paginateListEventIntegrationAssociations: ( config: AppIntegrationsPaginationConfiguration, input: ListEventIntegrationAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEventIntegrationAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppIntegrationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppIntegrations | AppIntegrationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppIntegrationsPaginationConfiguration, + ListEventIntegrationAssociationsCommandInput, + ListEventIntegrationAssociationsCommandOutput +>(AppIntegrationsClient, ListEventIntegrationAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appintegrations/src/pagination/ListEventIntegrationsPaginator.ts b/clients/client-appintegrations/src/pagination/ListEventIntegrationsPaginator.ts index 74c9be38b321..3600c02d3324 100644 --- a/clients/client-appintegrations/src/pagination/ListEventIntegrationsPaginator.ts +++ b/clients/client-appintegrations/src/pagination/ListEventIntegrationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppIntegrationsClient } from "../AppIntegrationsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListEventIntegrationsCommand"; import { AppIntegrationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppIntegrationsClient, - input: ListEventIntegrationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEventIntegrationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEventIntegrations( +export const paginateListEventIntegrations: ( config: AppIntegrationsPaginationConfiguration, input: ListEventIntegrationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEventIntegrationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppIntegrationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppIntegrations | AppIntegrationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppIntegrationsPaginationConfiguration, + ListEventIntegrationsCommandInput, + ListEventIntegrationsCommandOutput +>(AppIntegrationsClient, ListEventIntegrationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-application-auto-scaling/package.json b/clients/client-application-auto-scaling/package.json index 8494c62e90a3..e678ca64d757 100644 --- a/clients/client-application-auto-scaling/package.json +++ b/clients/client-application-auto-scaling/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-application-auto-scaling/src/pagination/DescribeScalableTargetsPaginator.ts b/clients/client-application-auto-scaling/src/pagination/DescribeScalableTargetsPaginator.ts index a495a2b0f7fe..cc52a323fe7a 100644 --- a/clients/client-application-auto-scaling/src/pagination/DescribeScalableTargetsPaginator.ts +++ b/clients/client-application-auto-scaling/src/pagination/DescribeScalableTargetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationAutoScalingClient } from "../ApplicationAutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeScalableTargetsCommand"; import { ApplicationAutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationAutoScalingClient, - input: DescribeScalableTargetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeScalableTargetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeScalableTargets( +export const paginateDescribeScalableTargets: ( config: ApplicationAutoScalingPaginationConfiguration, input: DescribeScalableTargetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeScalableTargetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ApplicationAutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationAutoScaling | ApplicationAutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationAutoScalingPaginationConfiguration, + DescribeScalableTargetsCommandInput, + DescribeScalableTargetsCommandOutput +>(ApplicationAutoScalingClient, DescribeScalableTargetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-application-auto-scaling/src/pagination/DescribeScalingActivitiesPaginator.ts b/clients/client-application-auto-scaling/src/pagination/DescribeScalingActivitiesPaginator.ts index c8089a28e238..41732b800224 100644 --- a/clients/client-application-auto-scaling/src/pagination/DescribeScalingActivitiesPaginator.ts +++ b/clients/client-application-auto-scaling/src/pagination/DescribeScalingActivitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationAutoScalingClient } from "../ApplicationAutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeScalingActivitiesCommand"; import { ApplicationAutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationAutoScalingClient, - input: DescribeScalingActivitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeScalingActivitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeScalingActivities( +export const paginateDescribeScalingActivities: ( config: ApplicationAutoScalingPaginationConfiguration, input: DescribeScalingActivitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeScalingActivitiesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ApplicationAutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationAutoScaling | ApplicationAutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationAutoScalingPaginationConfiguration, + DescribeScalingActivitiesCommandInput, + DescribeScalingActivitiesCommandOutput +>(ApplicationAutoScalingClient, DescribeScalingActivitiesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-application-auto-scaling/src/pagination/DescribeScalingPoliciesPaginator.ts b/clients/client-application-auto-scaling/src/pagination/DescribeScalingPoliciesPaginator.ts index 2e0972cff032..426c1e7f97f2 100644 --- a/clients/client-application-auto-scaling/src/pagination/DescribeScalingPoliciesPaginator.ts +++ b/clients/client-application-auto-scaling/src/pagination/DescribeScalingPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationAutoScalingClient } from "../ApplicationAutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeScalingPoliciesCommand"; import { ApplicationAutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationAutoScalingClient, - input: DescribeScalingPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeScalingPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeScalingPolicies( +export const paginateDescribeScalingPolicies: ( config: ApplicationAutoScalingPaginationConfiguration, input: DescribeScalingPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeScalingPoliciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ApplicationAutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationAutoScaling | ApplicationAutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationAutoScalingPaginationConfiguration, + DescribeScalingPoliciesCommandInput, + DescribeScalingPoliciesCommandOutput +>(ApplicationAutoScalingClient, DescribeScalingPoliciesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-application-auto-scaling/src/pagination/DescribeScheduledActionsPaginator.ts b/clients/client-application-auto-scaling/src/pagination/DescribeScheduledActionsPaginator.ts index e3ea59bc56a5..60db64b1081a 100644 --- a/clients/client-application-auto-scaling/src/pagination/DescribeScheduledActionsPaginator.ts +++ b/clients/client-application-auto-scaling/src/pagination/DescribeScheduledActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationAutoScalingClient } from "../ApplicationAutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeScheduledActionsCommand"; import { ApplicationAutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationAutoScalingClient, - input: DescribeScheduledActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeScheduledActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeScheduledActions( +export const paginateDescribeScheduledActions: ( config: ApplicationAutoScalingPaginationConfiguration, input: DescribeScheduledActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeScheduledActionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ApplicationAutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationAutoScaling | ApplicationAutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationAutoScalingPaginationConfiguration, + DescribeScheduledActionsCommandInput, + DescribeScheduledActionsCommandOutput +>(ApplicationAutoScalingClient, DescribeScheduledActionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-application-discovery-service/package.json b/clients/client-application-discovery-service/package.json index e10c0618bea9..b3a87d5b7e48 100644 --- a/clients/client-application-discovery-service/package.json +++ b/clients/client-application-discovery-service/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-application-discovery-service/src/pagination/DescribeAgentsPaginator.ts b/clients/client-application-discovery-service/src/pagination/DescribeAgentsPaginator.ts index 509a8110dde1..8d155dad9a1e 100644 --- a/clients/client-application-discovery-service/src/pagination/DescribeAgentsPaginator.ts +++ b/clients/client-application-discovery-service/src/pagination/DescribeAgentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationDiscoveryServiceClient } from "../ApplicationDiscoveryServiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeAgentsCommand"; import { ApplicationDiscoveryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationDiscoveryServiceClient, - input: DescribeAgentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAgentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAgents( +export const paginateDescribeAgents: ( config: ApplicationDiscoveryServicePaginationConfiguration, input: DescribeAgentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAgentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ApplicationDiscoveryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationDiscoveryService | ApplicationDiscoveryServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationDiscoveryServicePaginationConfiguration, + DescribeAgentsCommandInput, + DescribeAgentsCommandOutput +>(ApplicationDiscoveryServiceClient, DescribeAgentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-application-discovery-service/src/pagination/DescribeContinuousExportsPaginator.ts b/clients/client-application-discovery-service/src/pagination/DescribeContinuousExportsPaginator.ts index 8bc74796d26e..af4c6d6b3792 100644 --- a/clients/client-application-discovery-service/src/pagination/DescribeContinuousExportsPaginator.ts +++ b/clients/client-application-discovery-service/src/pagination/DescribeContinuousExportsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationDiscoveryServiceClient } from "../ApplicationDiscoveryServiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeContinuousExportsCommand"; import { ApplicationDiscoveryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationDiscoveryServiceClient, - input: DescribeContinuousExportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeContinuousExportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeContinuousExports( +export const paginateDescribeContinuousExports: ( config: ApplicationDiscoveryServicePaginationConfiguration, input: DescribeContinuousExportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeContinuousExportsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ApplicationDiscoveryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationDiscoveryService | ApplicationDiscoveryServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationDiscoveryServicePaginationConfiguration, + DescribeContinuousExportsCommandInput, + DescribeContinuousExportsCommandOutput +>(ApplicationDiscoveryServiceClient, DescribeContinuousExportsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-application-discovery-service/src/pagination/DescribeExportConfigurationsPaginator.ts b/clients/client-application-discovery-service/src/pagination/DescribeExportConfigurationsPaginator.ts index 30d787766cf4..a5400c1ed2d8 100644 --- a/clients/client-application-discovery-service/src/pagination/DescribeExportConfigurationsPaginator.ts +++ b/clients/client-application-discovery-service/src/pagination/DescribeExportConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationDiscoveryServiceClient } from "../ApplicationDiscoveryServiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeExportConfigurationsCommand"; import { ApplicationDiscoveryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationDiscoveryServiceClient, - input: DescribeExportConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeExportConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeExportConfigurations( +export const paginateDescribeExportConfigurations: ( config: ApplicationDiscoveryServicePaginationConfiguration, input: DescribeExportConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeExportConfigurationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ApplicationDiscoveryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationDiscoveryService | ApplicationDiscoveryServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationDiscoveryServicePaginationConfiguration, + DescribeExportConfigurationsCommandInput, + DescribeExportConfigurationsCommandOutput +>(ApplicationDiscoveryServiceClient, DescribeExportConfigurationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-application-discovery-service/src/pagination/DescribeExportTasksPaginator.ts b/clients/client-application-discovery-service/src/pagination/DescribeExportTasksPaginator.ts index 6123a65b2c4f..f51d13d5cf78 100644 --- a/clients/client-application-discovery-service/src/pagination/DescribeExportTasksPaginator.ts +++ b/clients/client-application-discovery-service/src/pagination/DescribeExportTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationDiscoveryServiceClient } from "../ApplicationDiscoveryServiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeExportTasksCommand"; import { ApplicationDiscoveryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationDiscoveryServiceClient, - input: DescribeExportTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeExportTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeExportTasks( +export const paginateDescribeExportTasks: ( config: ApplicationDiscoveryServicePaginationConfiguration, input: DescribeExportTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeExportTasksCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ApplicationDiscoveryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationDiscoveryService | ApplicationDiscoveryServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationDiscoveryServicePaginationConfiguration, + DescribeExportTasksCommandInput, + DescribeExportTasksCommandOutput +>(ApplicationDiscoveryServiceClient, DescribeExportTasksCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-application-discovery-service/src/pagination/DescribeImportTasksPaginator.ts b/clients/client-application-discovery-service/src/pagination/DescribeImportTasksPaginator.ts index 52218efc254a..ac0c8eb58186 100644 --- a/clients/client-application-discovery-service/src/pagination/DescribeImportTasksPaginator.ts +++ b/clients/client-application-discovery-service/src/pagination/DescribeImportTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationDiscoveryServiceClient } from "../ApplicationDiscoveryServiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeImportTasksCommand"; import { ApplicationDiscoveryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationDiscoveryServiceClient, - input: DescribeImportTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeImportTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeImportTasks( +export const paginateDescribeImportTasks: ( config: ApplicationDiscoveryServicePaginationConfiguration, input: DescribeImportTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeImportTasksCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ApplicationDiscoveryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationDiscoveryService | ApplicationDiscoveryServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationDiscoveryServicePaginationConfiguration, + DescribeImportTasksCommandInput, + DescribeImportTasksCommandOutput +>(ApplicationDiscoveryServiceClient, DescribeImportTasksCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-application-discovery-service/src/pagination/DescribeTagsPaginator.ts b/clients/client-application-discovery-service/src/pagination/DescribeTagsPaginator.ts index a72e50207611..731c26f71013 100644 --- a/clients/client-application-discovery-service/src/pagination/DescribeTagsPaginator.ts +++ b/clients/client-application-discovery-service/src/pagination/DescribeTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationDiscoveryServiceClient } from "../ApplicationDiscoveryServiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeTagsCommand"; import { ApplicationDiscoveryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationDiscoveryServiceClient, - input: DescribeTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTags( +export const paginateDescribeTags: ( config: ApplicationDiscoveryServicePaginationConfiguration, input: DescribeTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTagsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ApplicationDiscoveryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationDiscoveryService | ApplicationDiscoveryServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationDiscoveryServicePaginationConfiguration, + DescribeTagsCommandInput, + DescribeTagsCommandOutput +>(ApplicationDiscoveryServiceClient, DescribeTagsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-application-discovery-service/src/pagination/ListConfigurationsPaginator.ts b/clients/client-application-discovery-service/src/pagination/ListConfigurationsPaginator.ts index 7e858f688dcd..d45d69961f66 100644 --- a/clients/client-application-discovery-service/src/pagination/ListConfigurationsPaginator.ts +++ b/clients/client-application-discovery-service/src/pagination/ListConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationDiscoveryServiceClient } from "../ApplicationDiscoveryServiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListConfigurationsCommand"; import { ApplicationDiscoveryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationDiscoveryServiceClient, - input: ListConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConfigurations( +export const paginateListConfigurations: ( config: ApplicationDiscoveryServicePaginationConfiguration, input: ListConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConfigurationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ApplicationDiscoveryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationDiscoveryService | ApplicationDiscoveryServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationDiscoveryServicePaginationConfiguration, + ListConfigurationsCommandInput, + ListConfigurationsCommandOutput +>(ApplicationDiscoveryServiceClient, ListConfigurationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-application-insights/package.json b/clients/client-application-insights/package.json index 876a3aa0e802..ce9d53f6f607 100644 --- a/clients/client-application-insights/package.json +++ b/clients/client-application-insights/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-application-insights/src/pagination/ListApplicationsPaginator.ts b/clients/client-application-insights/src/pagination/ListApplicationsPaginator.ts index cbc1f0a5a7bc..bcb5a9257026 100644 --- a/clients/client-application-insights/src/pagination/ListApplicationsPaginator.ts +++ b/clients/client-application-insights/src/pagination/ListApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationInsightsClient } from "../ApplicationInsightsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListApplicationsCommand"; import { ApplicationInsightsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationInsightsClient, - input: ListApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplications( +export const paginateListApplications: ( config: ApplicationInsightsPaginationConfiguration, input: ListApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ApplicationInsightsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationInsights | ApplicationInsightsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationInsightsPaginationConfiguration, + ListApplicationsCommandInput, + ListApplicationsCommandOutput +>(ApplicationInsightsClient, ListApplicationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-application-insights/src/pagination/ListComponentsPaginator.ts b/clients/client-application-insights/src/pagination/ListComponentsPaginator.ts index 8a3ef58683ad..867ca2c55e1d 100644 --- a/clients/client-application-insights/src/pagination/ListComponentsPaginator.ts +++ b/clients/client-application-insights/src/pagination/ListComponentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationInsightsClient } from "../ApplicationInsightsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListComponentsCommand"; import { ApplicationInsightsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationInsightsClient, - input: ListComponentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComponentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComponents( +export const paginateListComponents: ( config: ApplicationInsightsPaginationConfiguration, input: ListComponentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComponentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ApplicationInsightsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationInsights | ApplicationInsightsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationInsightsPaginationConfiguration, + ListComponentsCommandInput, + ListComponentsCommandOutput +>(ApplicationInsightsClient, ListComponentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-application-insights/src/pagination/ListConfigurationHistoryPaginator.ts b/clients/client-application-insights/src/pagination/ListConfigurationHistoryPaginator.ts index f866a1c77874..0fb0b621dc17 100644 --- a/clients/client-application-insights/src/pagination/ListConfigurationHistoryPaginator.ts +++ b/clients/client-application-insights/src/pagination/ListConfigurationHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationInsightsClient } from "../ApplicationInsightsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListConfigurationHistoryCommand"; import { ApplicationInsightsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationInsightsClient, - input: ListConfigurationHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConfigurationHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConfigurationHistory( +export const paginateListConfigurationHistory: ( config: ApplicationInsightsPaginationConfiguration, input: ListConfigurationHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConfigurationHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ApplicationInsightsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationInsights | ApplicationInsightsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationInsightsPaginationConfiguration, + ListConfigurationHistoryCommandInput, + ListConfigurationHistoryCommandOutput +>(ApplicationInsightsClient, ListConfigurationHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-application-insights/src/pagination/ListLogPatternSetsPaginator.ts b/clients/client-application-insights/src/pagination/ListLogPatternSetsPaginator.ts index 0d14a6f5b304..acbe4b37ddb5 100644 --- a/clients/client-application-insights/src/pagination/ListLogPatternSetsPaginator.ts +++ b/clients/client-application-insights/src/pagination/ListLogPatternSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationInsightsClient } from "../ApplicationInsightsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListLogPatternSetsCommand"; import { ApplicationInsightsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationInsightsClient, - input: ListLogPatternSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLogPatternSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLogPatternSets( +export const paginateListLogPatternSets: ( config: ApplicationInsightsPaginationConfiguration, input: ListLogPatternSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLogPatternSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ApplicationInsightsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationInsights | ApplicationInsightsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationInsightsPaginationConfiguration, + ListLogPatternSetsCommandInput, + ListLogPatternSetsCommandOutput +>(ApplicationInsightsClient, ListLogPatternSetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-application-insights/src/pagination/ListLogPatternsPaginator.ts b/clients/client-application-insights/src/pagination/ListLogPatternsPaginator.ts index 29064934cd0d..c8b27efc6d81 100644 --- a/clients/client-application-insights/src/pagination/ListLogPatternsPaginator.ts +++ b/clients/client-application-insights/src/pagination/ListLogPatternsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationInsightsClient } from "../ApplicationInsightsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListLogPatternsCommand"; import { ApplicationInsightsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationInsightsClient, - input: ListLogPatternsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLogPatternsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLogPatterns( +export const paginateListLogPatterns: ( config: ApplicationInsightsPaginationConfiguration, input: ListLogPatternsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLogPatternsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ApplicationInsightsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationInsights | ApplicationInsightsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationInsightsPaginationConfiguration, + ListLogPatternsCommandInput, + ListLogPatternsCommandOutput +>(ApplicationInsightsClient, ListLogPatternsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-application-insights/src/pagination/ListProblemsPaginator.ts b/clients/client-application-insights/src/pagination/ListProblemsPaginator.ts index 579feaaffdee..4f4e18d43f61 100644 --- a/clients/client-application-insights/src/pagination/ListProblemsPaginator.ts +++ b/clients/client-application-insights/src/pagination/ListProblemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationInsightsClient } from "../ApplicationInsightsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListProblemsCommand"; import { ApplicationInsightsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationInsightsClient, - input: ListProblemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProblemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProblems( +export const paginateListProblems: ( config: ApplicationInsightsPaginationConfiguration, input: ListProblemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProblemsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ApplicationInsightsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationInsights | ApplicationInsightsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationInsightsPaginationConfiguration, + ListProblemsCommandInput, + ListProblemsCommandOutput +>(ApplicationInsightsClient, ListProblemsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-application-insights/src/pagination/ListWorkloadsPaginator.ts b/clients/client-application-insights/src/pagination/ListWorkloadsPaginator.ts index 33e91ad3682b..225ffb395277 100644 --- a/clients/client-application-insights/src/pagination/ListWorkloadsPaginator.ts +++ b/clients/client-application-insights/src/pagination/ListWorkloadsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationInsightsClient } from "../ApplicationInsightsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListWorkloadsCommand"; import { ApplicationInsightsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationInsightsClient, - input: ListWorkloadsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkloadsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkloads( +export const paginateListWorkloads: ( config: ApplicationInsightsPaginationConfiguration, input: ListWorkloadsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkloadsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ApplicationInsightsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationInsights | ApplicationInsightsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationInsightsPaginationConfiguration, + ListWorkloadsCommandInput, + ListWorkloadsCommandOutput +>(ApplicationInsightsClient, ListWorkloadsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-applicationcostprofiler/src/pagination/ListReportDefinitionsPaginator.ts b/clients/client-applicationcostprofiler/src/pagination/ListReportDefinitionsPaginator.ts index 819345e2636f..e82f344fc965 100644 --- a/clients/client-applicationcostprofiler/src/pagination/ListReportDefinitionsPaginator.ts +++ b/clients/client-applicationcostprofiler/src/pagination/ListReportDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ApplicationCostProfilerClient } from "../ApplicationCostProfilerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListReportDefinitionsCommand"; import { ApplicationCostProfilerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ApplicationCostProfilerClient, - input: ListReportDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReportDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReportDefinitions( +export const paginateListReportDefinitions: ( config: ApplicationCostProfilerPaginationConfiguration, input: ListReportDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReportDefinitionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ApplicationCostProfilerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ApplicationCostProfiler | ApplicationCostProfilerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ApplicationCostProfilerPaginationConfiguration, + ListReportDefinitionsCommandInput, + ListReportDefinitionsCommandOutput +>(ApplicationCostProfilerClient, ListReportDefinitionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-apprunner/package.json b/clients/client-apprunner/package.json index 2300cd4329b2..48f02b3b925c 100644 --- a/clients/client-apprunner/package.json +++ b/clients/client-apprunner/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-apprunner/src/pagination/DescribeCustomDomainsPaginator.ts b/clients/client-apprunner/src/pagination/DescribeCustomDomainsPaginator.ts index 4f0d0d242d3d..b59231e09232 100644 --- a/clients/client-apprunner/src/pagination/DescribeCustomDomainsPaginator.ts +++ b/clients/client-apprunner/src/pagination/DescribeCustomDomainsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppRunnerClient } from "../AppRunnerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeCustomDomainsCommand"; import { AppRunnerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppRunnerClient, - input: DescribeCustomDomainsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCustomDomainsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCustomDomains( +export const paginateDescribeCustomDomains: ( config: AppRunnerPaginationConfiguration, input: DescribeCustomDomainsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCustomDomainsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppRunnerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppRunner | AppRunnerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppRunnerPaginationConfiguration, + DescribeCustomDomainsCommandInput, + DescribeCustomDomainsCommandOutput +>(AppRunnerClient, DescribeCustomDomainsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-apprunner/src/pagination/ListAutoScalingConfigurationsPaginator.ts b/clients/client-apprunner/src/pagination/ListAutoScalingConfigurationsPaginator.ts index ab2bdb7e6023..b96932dc2e71 100644 --- a/clients/client-apprunner/src/pagination/ListAutoScalingConfigurationsPaginator.ts +++ b/clients/client-apprunner/src/pagination/ListAutoScalingConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppRunnerClient } from "../AppRunnerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAutoScalingConfigurationsCommand"; import { AppRunnerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppRunnerClient, - input: ListAutoScalingConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAutoScalingConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAutoScalingConfigurations( +export const paginateListAutoScalingConfigurations: ( config: AppRunnerPaginationConfiguration, input: ListAutoScalingConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAutoScalingConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppRunnerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppRunner | AppRunnerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppRunnerPaginationConfiguration, + ListAutoScalingConfigurationsCommandInput, + ListAutoScalingConfigurationsCommandOutput +>(AppRunnerClient, ListAutoScalingConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-apprunner/src/pagination/ListConnectionsPaginator.ts b/clients/client-apprunner/src/pagination/ListConnectionsPaginator.ts index 17680f120175..3832214f7fba 100644 --- a/clients/client-apprunner/src/pagination/ListConnectionsPaginator.ts +++ b/clients/client-apprunner/src/pagination/ListConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppRunnerClient } from "../AppRunnerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListConnectionsCommand"; import { AppRunnerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppRunnerClient, - input: ListConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConnections( +export const paginateListConnections: ( config: AppRunnerPaginationConfiguration, input: ListConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppRunnerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppRunner | AppRunnerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppRunnerPaginationConfiguration, + ListConnectionsCommandInput, + ListConnectionsCommandOutput +>(AppRunnerClient, ListConnectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-apprunner/src/pagination/ListObservabilityConfigurationsPaginator.ts b/clients/client-apprunner/src/pagination/ListObservabilityConfigurationsPaginator.ts index 71801326f638..ef2cbe3f17c9 100644 --- a/clients/client-apprunner/src/pagination/ListObservabilityConfigurationsPaginator.ts +++ b/clients/client-apprunner/src/pagination/ListObservabilityConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppRunnerClient } from "../AppRunnerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListObservabilityConfigurationsCommand"; import { AppRunnerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppRunnerClient, - input: ListObservabilityConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListObservabilityConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListObservabilityConfigurations( +export const paginateListObservabilityConfigurations: ( config: AppRunnerPaginationConfiguration, input: ListObservabilityConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListObservabilityConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppRunnerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppRunner | AppRunnerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppRunnerPaginationConfiguration, + ListObservabilityConfigurationsCommandInput, + ListObservabilityConfigurationsCommandOutput +>(AppRunnerClient, ListObservabilityConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-apprunner/src/pagination/ListOperationsPaginator.ts b/clients/client-apprunner/src/pagination/ListOperationsPaginator.ts index 3467f28a691b..02c0511ace57 100644 --- a/clients/client-apprunner/src/pagination/ListOperationsPaginator.ts +++ b/clients/client-apprunner/src/pagination/ListOperationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppRunnerClient } from "../AppRunnerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListOperationsCommand"; import { AppRunnerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppRunnerClient, - input: ListOperationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOperationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOperations( +export const paginateListOperations: ( config: AppRunnerPaginationConfiguration, input: ListOperationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOperationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppRunnerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppRunner | AppRunnerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppRunnerPaginationConfiguration, + ListOperationsCommandInput, + ListOperationsCommandOutput +>(AppRunnerClient, ListOperationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-apprunner/src/pagination/ListServicesForAutoScalingConfigurationPaginator.ts b/clients/client-apprunner/src/pagination/ListServicesForAutoScalingConfigurationPaginator.ts index 096f9f41d05e..49e740fb0112 100644 --- a/clients/client-apprunner/src/pagination/ListServicesForAutoScalingConfigurationPaginator.ts +++ b/clients/client-apprunner/src/pagination/ListServicesForAutoScalingConfigurationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppRunnerClient } from "../AppRunnerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListServicesForAutoScalingConfigurationCommand"; import { AppRunnerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppRunnerClient, - input: ListServicesForAutoScalingConfigurationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServicesForAutoScalingConfigurationCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServicesForAutoScalingConfiguration( +export const paginateListServicesForAutoScalingConfiguration: ( config: AppRunnerPaginationConfiguration, input: ListServicesForAutoScalingConfigurationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServicesForAutoScalingConfigurationCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppRunnerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppRunner | AppRunnerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppRunnerPaginationConfiguration, + ListServicesForAutoScalingConfigurationCommandInput, + ListServicesForAutoScalingConfigurationCommandOutput +>(AppRunnerClient, ListServicesForAutoScalingConfigurationCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-apprunner/src/pagination/ListServicesPaginator.ts b/clients/client-apprunner/src/pagination/ListServicesPaginator.ts index b00c887397dc..a2c7ccc01722 100644 --- a/clients/client-apprunner/src/pagination/ListServicesPaginator.ts +++ b/clients/client-apprunner/src/pagination/ListServicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppRunnerClient } from "../AppRunnerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListServicesCommand"; import { AppRunnerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppRunnerClient, - input: ListServicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServices( +export const paginateListServices: ( config: AppRunnerPaginationConfiguration, input: ListServicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppRunnerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppRunner | AppRunnerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppRunnerPaginationConfiguration, + ListServicesCommandInput, + ListServicesCommandOutput +>(AppRunnerClient, ListServicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-apprunner/src/pagination/ListVpcConnectorsPaginator.ts b/clients/client-apprunner/src/pagination/ListVpcConnectorsPaginator.ts index d226cfbe0dc2..9ac91e7d5b7f 100644 --- a/clients/client-apprunner/src/pagination/ListVpcConnectorsPaginator.ts +++ b/clients/client-apprunner/src/pagination/ListVpcConnectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppRunnerClient } from "../AppRunnerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListVpcConnectorsCommand"; import { AppRunnerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppRunnerClient, - input: ListVpcConnectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVpcConnectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVpcConnectors( +export const paginateListVpcConnectors: ( config: AppRunnerPaginationConfiguration, input: ListVpcConnectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVpcConnectorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppRunnerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppRunner | AppRunnerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppRunnerPaginationConfiguration, + ListVpcConnectorsCommandInput, + ListVpcConnectorsCommandOutput +>(AppRunnerClient, ListVpcConnectorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-apprunner/src/pagination/ListVpcIngressConnectionsPaginator.ts b/clients/client-apprunner/src/pagination/ListVpcIngressConnectionsPaginator.ts index 206e5eeed7b8..fbbe3f3bc078 100644 --- a/clients/client-apprunner/src/pagination/ListVpcIngressConnectionsPaginator.ts +++ b/clients/client-apprunner/src/pagination/ListVpcIngressConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppRunnerClient } from "../AppRunnerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListVpcIngressConnectionsCommand"; import { AppRunnerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppRunnerClient, - input: ListVpcIngressConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVpcIngressConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVpcIngressConnections( +export const paginateListVpcIngressConnections: ( config: AppRunnerPaginationConfiguration, input: ListVpcIngressConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVpcIngressConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppRunnerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppRunner | AppRunnerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppRunnerPaginationConfiguration, + ListVpcIngressConnectionsCommandInput, + ListVpcIngressConnectionsCommandOutput +>(AppRunnerClient, ListVpcIngressConnectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appstream/package.json b/clients/client-appstream/package.json index e5c307c0d905..6982a6dcf3c9 100644 --- a/clients/client-appstream/package.json +++ b/clients/client-appstream/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-appstream/src/pagination/DescribeAppBlockBuilderAppBlockAssociationsPaginator.ts b/clients/client-appstream/src/pagination/DescribeAppBlockBuilderAppBlockAssociationsPaginator.ts index 325b929430f1..eab7f55ff46b 100644 --- a/clients/client-appstream/src/pagination/DescribeAppBlockBuilderAppBlockAssociationsPaginator.ts +++ b/clients/client-appstream/src/pagination/DescribeAppBlockBuilderAppBlockAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppStreamClient } from "../AppStreamClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeAppBlockBuilderAppBlockAssociationsCommand"; import { AppStreamPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppStreamClient, - input: DescribeAppBlockBuilderAppBlockAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAppBlockBuilderAppBlockAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAppBlockBuilderAppBlockAssociations( +export const paginateDescribeAppBlockBuilderAppBlockAssociations: ( config: AppStreamPaginationConfiguration, input: DescribeAppBlockBuilderAppBlockAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAppBlockBuilderAppBlockAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppStreamClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppStream | AppStreamClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppStreamPaginationConfiguration, + DescribeAppBlockBuilderAppBlockAssociationsCommandInput, + DescribeAppBlockBuilderAppBlockAssociationsCommandOutput +>(AppStreamClient, DescribeAppBlockBuilderAppBlockAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appstream/src/pagination/DescribeAppBlockBuildersPaginator.ts b/clients/client-appstream/src/pagination/DescribeAppBlockBuildersPaginator.ts index 4a2efcf641eb..dc5d98d8c633 100644 --- a/clients/client-appstream/src/pagination/DescribeAppBlockBuildersPaginator.ts +++ b/clients/client-appstream/src/pagination/DescribeAppBlockBuildersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppStreamClient } from "../AppStreamClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeAppBlockBuildersCommand"; import { AppStreamPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppStreamClient, - input: DescribeAppBlockBuildersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAppBlockBuildersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAppBlockBuilders( +export const paginateDescribeAppBlockBuilders: ( config: AppStreamPaginationConfiguration, input: DescribeAppBlockBuildersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAppBlockBuildersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppStreamClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppStream | AppStreamClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppStreamPaginationConfiguration, + DescribeAppBlockBuildersCommandInput, + DescribeAppBlockBuildersCommandOutput +>(AppStreamClient, DescribeAppBlockBuildersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appstream/src/pagination/DescribeImagePermissionsPaginator.ts b/clients/client-appstream/src/pagination/DescribeImagePermissionsPaginator.ts index 583a25b41f88..cf2b6c8efb98 100644 --- a/clients/client-appstream/src/pagination/DescribeImagePermissionsPaginator.ts +++ b/clients/client-appstream/src/pagination/DescribeImagePermissionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppStreamClient } from "../AppStreamClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeImagePermissionsCommand"; import { AppStreamPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppStreamClient, - input: DescribeImagePermissionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeImagePermissionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeImagePermissions( +export const paginateDescribeImagePermissions: ( config: AppStreamPaginationConfiguration, input: DescribeImagePermissionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeImagePermissionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppStreamClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppStream | AppStreamClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppStreamPaginationConfiguration, + DescribeImagePermissionsCommandInput, + DescribeImagePermissionsCommandOutput +>(AppStreamClient, DescribeImagePermissionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-appstream/src/pagination/DescribeImagesPaginator.ts b/clients/client-appstream/src/pagination/DescribeImagesPaginator.ts index 3186cbdc3eb2..7f48e786361a 100644 --- a/clients/client-appstream/src/pagination/DescribeImagesPaginator.ts +++ b/clients/client-appstream/src/pagination/DescribeImagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AppStreamClient } from "../AppStreamClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeImagesCommand"; import { AppStreamPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AppStreamClient, - input: DescribeImagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeImagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeImages( +export const paginateDescribeImages: ( config: AppStreamPaginationConfiguration, input: DescribeImagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeImagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AppStreamClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AppStream | AppStreamClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AppStreamPaginationConfiguration, + DescribeImagesCommandInput, + DescribeImagesCommandOutput +>(AppStreamClient, DescribeImagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-arc-zonal-shift/src/pagination/ListAutoshiftsPaginator.ts b/clients/client-arc-zonal-shift/src/pagination/ListAutoshiftsPaginator.ts index 0fb6699e2831..28a806652aba 100644 --- a/clients/client-arc-zonal-shift/src/pagination/ListAutoshiftsPaginator.ts +++ b/clients/client-arc-zonal-shift/src/pagination/ListAutoshiftsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ARCZonalShiftClient } from "../ARCZonalShiftClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAutoshiftsCommand"; import { ARCZonalShiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ARCZonalShiftClient, - input: ListAutoshiftsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAutoshiftsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAutoshifts( +export const paginateListAutoshifts: ( config: ARCZonalShiftPaginationConfiguration, input: ListAutoshiftsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAutoshiftsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ARCZonalShiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ARCZonalShift | ARCZonalShiftClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ARCZonalShiftPaginationConfiguration, + ListAutoshiftsCommandInput, + ListAutoshiftsCommandOutput +>(ARCZonalShiftClient, ListAutoshiftsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-arc-zonal-shift/src/pagination/ListManagedResourcesPaginator.ts b/clients/client-arc-zonal-shift/src/pagination/ListManagedResourcesPaginator.ts index 5b326b8d04e4..25567f0ddc36 100644 --- a/clients/client-arc-zonal-shift/src/pagination/ListManagedResourcesPaginator.ts +++ b/clients/client-arc-zonal-shift/src/pagination/ListManagedResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ARCZonalShiftClient } from "../ARCZonalShiftClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListManagedResourcesCommand"; import { ARCZonalShiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ARCZonalShiftClient, - input: ListManagedResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListManagedResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListManagedResources( +export const paginateListManagedResources: ( config: ARCZonalShiftPaginationConfiguration, input: ListManagedResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListManagedResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ARCZonalShiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ARCZonalShift | ARCZonalShiftClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ARCZonalShiftPaginationConfiguration, + ListManagedResourcesCommandInput, + ListManagedResourcesCommandOutput +>(ARCZonalShiftClient, ListManagedResourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-arc-zonal-shift/src/pagination/ListZonalShiftsPaginator.ts b/clients/client-arc-zonal-shift/src/pagination/ListZonalShiftsPaginator.ts index d175e2c112a4..c140c886f27e 100644 --- a/clients/client-arc-zonal-shift/src/pagination/ListZonalShiftsPaginator.ts +++ b/clients/client-arc-zonal-shift/src/pagination/ListZonalShiftsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ARCZonalShiftClient } from "../ARCZonalShiftClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListZonalShiftsCommand"; import { ARCZonalShiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ARCZonalShiftClient, - input: ListZonalShiftsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListZonalShiftsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListZonalShifts( +export const paginateListZonalShifts: ( config: ARCZonalShiftPaginationConfiguration, input: ListZonalShiftsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListZonalShiftsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ARCZonalShiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ARCZonalShift | ARCZonalShiftClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ARCZonalShiftPaginationConfiguration, + ListZonalShiftsCommandInput, + ListZonalShiftsCommandOutput +>(ARCZonalShiftClient, ListZonalShiftsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-athena/package.json b/clients/client-athena/package.json index cb6fbec86fbf..8df426b60481 100644 --- a/clients/client-athena/package.json +++ b/clients/client-athena/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-athena/src/pagination/GetQueryResultsPaginator.ts b/clients/client-athena/src/pagination/GetQueryResultsPaginator.ts index 5cc3164a6ca9..ae66ac323bba 100644 --- a/clients/client-athena/src/pagination/GetQueryResultsPaginator.ts +++ b/clients/client-athena/src/pagination/GetQueryResultsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetQueryResultsCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: GetQueryResultsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetQueryResultsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetQueryResults( +export const paginateGetQueryResults: ( config: AthenaPaginationConfiguration, input: GetQueryResultsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetQueryResultsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + GetQueryResultsCommandInput, + GetQueryResultsCommandOutput +>(AthenaClient, GetQueryResultsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-athena/src/pagination/ListApplicationDPUSizesPaginator.ts b/clients/client-athena/src/pagination/ListApplicationDPUSizesPaginator.ts index 7b7dcaa12699..5fcca7b588ba 100644 --- a/clients/client-athena/src/pagination/ListApplicationDPUSizesPaginator.ts +++ b/clients/client-athena/src/pagination/ListApplicationDPUSizesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListApplicationDPUSizesCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: ListApplicationDPUSizesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationDPUSizesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationDPUSizes( +export const paginateListApplicationDPUSizes: ( config: AthenaPaginationConfiguration, input: ListApplicationDPUSizesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationDPUSizesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + ListApplicationDPUSizesCommandInput, + ListApplicationDPUSizesCommandOutput +>(AthenaClient, ListApplicationDPUSizesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-athena/src/pagination/ListCalculationExecutionsPaginator.ts b/clients/client-athena/src/pagination/ListCalculationExecutionsPaginator.ts index 5e5554beac6f..c665ba8a9e1a 100644 --- a/clients/client-athena/src/pagination/ListCalculationExecutionsPaginator.ts +++ b/clients/client-athena/src/pagination/ListCalculationExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCalculationExecutionsCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: ListCalculationExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCalculationExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCalculationExecutions( +export const paginateListCalculationExecutions: ( config: AthenaPaginationConfiguration, input: ListCalculationExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCalculationExecutionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + ListCalculationExecutionsCommandInput, + ListCalculationExecutionsCommandOutput +>(AthenaClient, ListCalculationExecutionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-athena/src/pagination/ListCapacityReservationsPaginator.ts b/clients/client-athena/src/pagination/ListCapacityReservationsPaginator.ts index e4d1b3c35fec..5dc942a896f5 100644 --- a/clients/client-athena/src/pagination/ListCapacityReservationsPaginator.ts +++ b/clients/client-athena/src/pagination/ListCapacityReservationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCapacityReservationsCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: ListCapacityReservationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCapacityReservationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCapacityReservations( +export const paginateListCapacityReservations: ( config: AthenaPaginationConfiguration, input: ListCapacityReservationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCapacityReservationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + ListCapacityReservationsCommandInput, + ListCapacityReservationsCommandOutput +>(AthenaClient, ListCapacityReservationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-athena/src/pagination/ListDataCatalogsPaginator.ts b/clients/client-athena/src/pagination/ListDataCatalogsPaginator.ts index 9dc10636c839..40f4efdf4c01 100644 --- a/clients/client-athena/src/pagination/ListDataCatalogsPaginator.ts +++ b/clients/client-athena/src/pagination/ListDataCatalogsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListDataCatalogsCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: ListDataCatalogsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataCatalogsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataCatalogs( +export const paginateListDataCatalogs: ( config: AthenaPaginationConfiguration, input: ListDataCatalogsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataCatalogsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + ListDataCatalogsCommandInput, + ListDataCatalogsCommandOutput +>(AthenaClient, ListDataCatalogsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-athena/src/pagination/ListDatabasesPaginator.ts b/clients/client-athena/src/pagination/ListDatabasesPaginator.ts index 5317359b0723..4d973c912697 100644 --- a/clients/client-athena/src/pagination/ListDatabasesPaginator.ts +++ b/clients/client-athena/src/pagination/ListDatabasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListDatabasesCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: ListDatabasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatabasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatabases( +export const paginateListDatabases: ( config: AthenaPaginationConfiguration, input: ListDatabasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatabasesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + ListDatabasesCommandInput, + ListDatabasesCommandOutput +>(AthenaClient, ListDatabasesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-athena/src/pagination/ListEngineVersionsPaginator.ts b/clients/client-athena/src/pagination/ListEngineVersionsPaginator.ts index e8950d5e029e..7fc4dfb308d8 100644 --- a/clients/client-athena/src/pagination/ListEngineVersionsPaginator.ts +++ b/clients/client-athena/src/pagination/ListEngineVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListEngineVersionsCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: ListEngineVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEngineVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEngineVersions( +export const paginateListEngineVersions: ( config: AthenaPaginationConfiguration, input: ListEngineVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEngineVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + ListEngineVersionsCommandInput, + ListEngineVersionsCommandOutput +>(AthenaClient, ListEngineVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-athena/src/pagination/ListExecutorsPaginator.ts b/clients/client-athena/src/pagination/ListExecutorsPaginator.ts index a57df90ce508..80e7b68147ad 100644 --- a/clients/client-athena/src/pagination/ListExecutorsPaginator.ts +++ b/clients/client-athena/src/pagination/ListExecutorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListExecutorsCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: ListExecutorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExecutorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExecutors( +export const paginateListExecutors: ( config: AthenaPaginationConfiguration, input: ListExecutorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExecutorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + ListExecutorsCommandInput, + ListExecutorsCommandOutput +>(AthenaClient, ListExecutorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-athena/src/pagination/ListNamedQueriesPaginator.ts b/clients/client-athena/src/pagination/ListNamedQueriesPaginator.ts index 9698fb53b5a4..bc93593dec3a 100644 --- a/clients/client-athena/src/pagination/ListNamedQueriesPaginator.ts +++ b/clients/client-athena/src/pagination/ListNamedQueriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListNamedQueriesCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: ListNamedQueriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNamedQueriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNamedQueries( +export const paginateListNamedQueries: ( config: AthenaPaginationConfiguration, input: ListNamedQueriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNamedQueriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + ListNamedQueriesCommandInput, + ListNamedQueriesCommandOutput +>(AthenaClient, ListNamedQueriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-athena/src/pagination/ListPreparedStatementsPaginator.ts b/clients/client-athena/src/pagination/ListPreparedStatementsPaginator.ts index 284a16c79ea0..d5a62c8d20bc 100644 --- a/clients/client-athena/src/pagination/ListPreparedStatementsPaginator.ts +++ b/clients/client-athena/src/pagination/ListPreparedStatementsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPreparedStatementsCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: ListPreparedStatementsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPreparedStatementsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPreparedStatements( +export const paginateListPreparedStatements: ( config: AthenaPaginationConfiguration, input: ListPreparedStatementsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPreparedStatementsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + ListPreparedStatementsCommandInput, + ListPreparedStatementsCommandOutput +>(AthenaClient, ListPreparedStatementsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-athena/src/pagination/ListQueryExecutionsPaginator.ts b/clients/client-athena/src/pagination/ListQueryExecutionsPaginator.ts index 03f6533e9c2d..c452642eab39 100644 --- a/clients/client-athena/src/pagination/ListQueryExecutionsPaginator.ts +++ b/clients/client-athena/src/pagination/ListQueryExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListQueryExecutionsCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: ListQueryExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListQueryExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListQueryExecutions( +export const paginateListQueryExecutions: ( config: AthenaPaginationConfiguration, input: ListQueryExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListQueryExecutionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + ListQueryExecutionsCommandInput, + ListQueryExecutionsCommandOutput +>(AthenaClient, ListQueryExecutionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-athena/src/pagination/ListSessionsPaginator.ts b/clients/client-athena/src/pagination/ListSessionsPaginator.ts index 3fd6eb65d9e5..d4204a29c1e0 100644 --- a/clients/client-athena/src/pagination/ListSessionsPaginator.ts +++ b/clients/client-athena/src/pagination/ListSessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSessionsCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: ListSessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSessions( +export const paginateListSessions: ( config: AthenaPaginationConfiguration, input: ListSessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSessionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + ListSessionsCommandInput, + ListSessionsCommandOutput +>(AthenaClient, ListSessionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-athena/src/pagination/ListTableMetadataPaginator.ts b/clients/client-athena/src/pagination/ListTableMetadataPaginator.ts index 64760fedcfa0..03d1def051c3 100644 --- a/clients/client-athena/src/pagination/ListTableMetadataPaginator.ts +++ b/clients/client-athena/src/pagination/ListTableMetadataPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListTableMetadataCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: ListTableMetadataCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTableMetadataCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTableMetadata( +export const paginateListTableMetadata: ( config: AthenaPaginationConfiguration, input: ListTableMetadataCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTableMetadataCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + ListTableMetadataCommandInput, + ListTableMetadataCommandOutput +>(AthenaClient, ListTableMetadataCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-athena/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-athena/src/pagination/ListTagsForResourcePaginator.ts index 3c03c8b94921..0422535f9da7 100644 --- a/clients/client-athena/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-athena/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListTagsForResourceCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: AthenaPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(AthenaClient, ListTagsForResourceCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-athena/src/pagination/ListWorkGroupsPaginator.ts b/clients/client-athena/src/pagination/ListWorkGroupsPaginator.ts index 1635b4941fc5..f146f90182fe 100644 --- a/clients/client-athena/src/pagination/ListWorkGroupsPaginator.ts +++ b/clients/client-athena/src/pagination/ListWorkGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AthenaClient } from "../AthenaClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListWorkGroupsCommand"; import { AthenaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AthenaClient, - input: ListWorkGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkGroups( +export const paginateListWorkGroups: ( config: AthenaPaginationConfiguration, input: ListWorkGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof AthenaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Athena | AthenaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AthenaPaginationConfiguration, + ListWorkGroupsCommandInput, + ListWorkGroupsCommandOutput +>(AthenaClient, ListWorkGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-auditmanager/src/pagination/GetChangeLogsPaginator.ts b/clients/client-auditmanager/src/pagination/GetChangeLogsPaginator.ts index ac5311483217..2067150e63e0 100644 --- a/clients/client-auditmanager/src/pagination/GetChangeLogsPaginator.ts +++ b/clients/client-auditmanager/src/pagination/GetChangeLogsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetChangeLogsCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: GetChangeLogsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetChangeLogsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetChangeLogs( +export const paginateGetChangeLogs: ( config: AuditManagerPaginationConfiguration, input: GetChangeLogsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetChangeLogsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + GetChangeLogsCommandInput, + GetChangeLogsCommandOutput +>(AuditManagerClient, GetChangeLogsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/GetDelegationsPaginator.ts b/clients/client-auditmanager/src/pagination/GetDelegationsPaginator.ts index 359cf26317be..25fa4959d0ee 100644 --- a/clients/client-auditmanager/src/pagination/GetDelegationsPaginator.ts +++ b/clients/client-auditmanager/src/pagination/GetDelegationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetDelegationsCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: GetDelegationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetDelegationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetDelegations( +export const paginateGetDelegations: ( config: AuditManagerPaginationConfiguration, input: GetDelegationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetDelegationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + GetDelegationsCommandInput, + GetDelegationsCommandOutput +>(AuditManagerClient, GetDelegationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/GetEvidenceByEvidenceFolderPaginator.ts b/clients/client-auditmanager/src/pagination/GetEvidenceByEvidenceFolderPaginator.ts index 3285c36a2a59..8585062dae67 100644 --- a/clients/client-auditmanager/src/pagination/GetEvidenceByEvidenceFolderPaginator.ts +++ b/clients/client-auditmanager/src/pagination/GetEvidenceByEvidenceFolderPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetEvidenceByEvidenceFolderCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: GetEvidenceByEvidenceFolderCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetEvidenceByEvidenceFolderCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetEvidenceByEvidenceFolder( +export const paginateGetEvidenceByEvidenceFolder: ( config: AuditManagerPaginationConfiguration, input: GetEvidenceByEvidenceFolderCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetEvidenceByEvidenceFolderCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + GetEvidenceByEvidenceFolderCommandInput, + GetEvidenceByEvidenceFolderCommandOutput +>(AuditManagerClient, GetEvidenceByEvidenceFolderCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/GetEvidenceFoldersByAssessmentControlPaginator.ts b/clients/client-auditmanager/src/pagination/GetEvidenceFoldersByAssessmentControlPaginator.ts index d6fdbd88797d..d15b1db1b307 100644 --- a/clients/client-auditmanager/src/pagination/GetEvidenceFoldersByAssessmentControlPaginator.ts +++ b/clients/client-auditmanager/src/pagination/GetEvidenceFoldersByAssessmentControlPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetEvidenceFoldersByAssessmentControlCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: GetEvidenceFoldersByAssessmentControlCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetEvidenceFoldersByAssessmentControlCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetEvidenceFoldersByAssessmentControl( +export const paginateGetEvidenceFoldersByAssessmentControl: ( config: AuditManagerPaginationConfiguration, input: GetEvidenceFoldersByAssessmentControlCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetEvidenceFoldersByAssessmentControlCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + GetEvidenceFoldersByAssessmentControlCommandInput, + GetEvidenceFoldersByAssessmentControlCommandOutput +>(AuditManagerClient, GetEvidenceFoldersByAssessmentControlCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/GetEvidenceFoldersByAssessmentPaginator.ts b/clients/client-auditmanager/src/pagination/GetEvidenceFoldersByAssessmentPaginator.ts index d29877fa9968..a85865d2e2d0 100644 --- a/clients/client-auditmanager/src/pagination/GetEvidenceFoldersByAssessmentPaginator.ts +++ b/clients/client-auditmanager/src/pagination/GetEvidenceFoldersByAssessmentPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetEvidenceFoldersByAssessmentCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: GetEvidenceFoldersByAssessmentCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetEvidenceFoldersByAssessmentCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetEvidenceFoldersByAssessment( +export const paginateGetEvidenceFoldersByAssessment: ( config: AuditManagerPaginationConfiguration, input: GetEvidenceFoldersByAssessmentCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetEvidenceFoldersByAssessmentCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + GetEvidenceFoldersByAssessmentCommandInput, + GetEvidenceFoldersByAssessmentCommandOutput +>(AuditManagerClient, GetEvidenceFoldersByAssessmentCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/ListAssessmentControlInsightsByControlDomainPaginator.ts b/clients/client-auditmanager/src/pagination/ListAssessmentControlInsightsByControlDomainPaginator.ts index 9dd6431fb4b0..f5b51af1cb8e 100644 --- a/clients/client-auditmanager/src/pagination/ListAssessmentControlInsightsByControlDomainPaginator.ts +++ b/clients/client-auditmanager/src/pagination/ListAssessmentControlInsightsByControlDomainPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAssessmentControlInsightsByControlDomainCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: ListAssessmentControlInsightsByControlDomainCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssessmentControlInsightsByControlDomainCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssessmentControlInsightsByControlDomain( +export const paginateListAssessmentControlInsightsByControlDomain: ( config: AuditManagerPaginationConfiguration, input: ListAssessmentControlInsightsByControlDomainCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssessmentControlInsightsByControlDomainCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + ListAssessmentControlInsightsByControlDomainCommandInput, + ListAssessmentControlInsightsByControlDomainCommandOutput +>(AuditManagerClient, ListAssessmentControlInsightsByControlDomainCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/ListAssessmentFrameworkShareRequestsPaginator.ts b/clients/client-auditmanager/src/pagination/ListAssessmentFrameworkShareRequestsPaginator.ts index cb6882152669..a0e3e5422bb4 100644 --- a/clients/client-auditmanager/src/pagination/ListAssessmentFrameworkShareRequestsPaginator.ts +++ b/clients/client-auditmanager/src/pagination/ListAssessmentFrameworkShareRequestsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAssessmentFrameworkShareRequestsCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: ListAssessmentFrameworkShareRequestsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssessmentFrameworkShareRequestsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssessmentFrameworkShareRequests( +export const paginateListAssessmentFrameworkShareRequests: ( config: AuditManagerPaginationConfiguration, input: ListAssessmentFrameworkShareRequestsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssessmentFrameworkShareRequestsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + ListAssessmentFrameworkShareRequestsCommandInput, + ListAssessmentFrameworkShareRequestsCommandOutput +>(AuditManagerClient, ListAssessmentFrameworkShareRequestsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/ListAssessmentFrameworksPaginator.ts b/clients/client-auditmanager/src/pagination/ListAssessmentFrameworksPaginator.ts index a1474de8b9a8..19efa8fc62db 100644 --- a/clients/client-auditmanager/src/pagination/ListAssessmentFrameworksPaginator.ts +++ b/clients/client-auditmanager/src/pagination/ListAssessmentFrameworksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAssessmentFrameworksCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: ListAssessmentFrameworksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssessmentFrameworksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssessmentFrameworks( +export const paginateListAssessmentFrameworks: ( config: AuditManagerPaginationConfiguration, input: ListAssessmentFrameworksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssessmentFrameworksCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + ListAssessmentFrameworksCommandInput, + ListAssessmentFrameworksCommandOutput +>(AuditManagerClient, ListAssessmentFrameworksCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/ListAssessmentReportsPaginator.ts b/clients/client-auditmanager/src/pagination/ListAssessmentReportsPaginator.ts index 534fedff0bc3..c1e1b78bab3c 100644 --- a/clients/client-auditmanager/src/pagination/ListAssessmentReportsPaginator.ts +++ b/clients/client-auditmanager/src/pagination/ListAssessmentReportsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAssessmentReportsCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: ListAssessmentReportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssessmentReportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssessmentReports( +export const paginateListAssessmentReports: ( config: AuditManagerPaginationConfiguration, input: ListAssessmentReportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssessmentReportsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + ListAssessmentReportsCommandInput, + ListAssessmentReportsCommandOutput +>(AuditManagerClient, ListAssessmentReportsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/ListAssessmentsPaginator.ts b/clients/client-auditmanager/src/pagination/ListAssessmentsPaginator.ts index bf797f41db88..7e8aedc0edfa 100644 --- a/clients/client-auditmanager/src/pagination/ListAssessmentsPaginator.ts +++ b/clients/client-auditmanager/src/pagination/ListAssessmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAssessmentsCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: ListAssessmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssessmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssessments( +export const paginateListAssessments: ( config: AuditManagerPaginationConfiguration, input: ListAssessmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssessmentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + ListAssessmentsCommandInput, + ListAssessmentsCommandOutput +>(AuditManagerClient, ListAssessmentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/ListControlDomainInsightsByAssessmentPaginator.ts b/clients/client-auditmanager/src/pagination/ListControlDomainInsightsByAssessmentPaginator.ts index d3e5cd0bbddc..4628581568e9 100644 --- a/clients/client-auditmanager/src/pagination/ListControlDomainInsightsByAssessmentPaginator.ts +++ b/clients/client-auditmanager/src/pagination/ListControlDomainInsightsByAssessmentPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListControlDomainInsightsByAssessmentCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: ListControlDomainInsightsByAssessmentCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListControlDomainInsightsByAssessmentCommand(input), ...args); -}; /** * @public */ -export async function* paginateListControlDomainInsightsByAssessment( +export const paginateListControlDomainInsightsByAssessment: ( config: AuditManagerPaginationConfiguration, input: ListControlDomainInsightsByAssessmentCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListControlDomainInsightsByAssessmentCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + ListControlDomainInsightsByAssessmentCommandInput, + ListControlDomainInsightsByAssessmentCommandOutput +>(AuditManagerClient, ListControlDomainInsightsByAssessmentCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/ListControlDomainInsightsPaginator.ts b/clients/client-auditmanager/src/pagination/ListControlDomainInsightsPaginator.ts index c317edd3081a..2455a3c139dd 100644 --- a/clients/client-auditmanager/src/pagination/ListControlDomainInsightsPaginator.ts +++ b/clients/client-auditmanager/src/pagination/ListControlDomainInsightsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListControlDomainInsightsCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: ListControlDomainInsightsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListControlDomainInsightsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListControlDomainInsights( +export const paginateListControlDomainInsights: ( config: AuditManagerPaginationConfiguration, input: ListControlDomainInsightsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListControlDomainInsightsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + ListControlDomainInsightsCommandInput, + ListControlDomainInsightsCommandOutput +>(AuditManagerClient, ListControlDomainInsightsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/ListControlInsightsByControlDomainPaginator.ts b/clients/client-auditmanager/src/pagination/ListControlInsightsByControlDomainPaginator.ts index d6e91f7da6e1..c5b3d3129bf1 100644 --- a/clients/client-auditmanager/src/pagination/ListControlInsightsByControlDomainPaginator.ts +++ b/clients/client-auditmanager/src/pagination/ListControlInsightsByControlDomainPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListControlInsightsByControlDomainCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: ListControlInsightsByControlDomainCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListControlInsightsByControlDomainCommand(input), ...args); -}; /** * @public */ -export async function* paginateListControlInsightsByControlDomain( +export const paginateListControlInsightsByControlDomain: ( config: AuditManagerPaginationConfiguration, input: ListControlInsightsByControlDomainCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListControlInsightsByControlDomainCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + ListControlInsightsByControlDomainCommandInput, + ListControlInsightsByControlDomainCommandOutput +>(AuditManagerClient, ListControlInsightsByControlDomainCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/ListControlsPaginator.ts b/clients/client-auditmanager/src/pagination/ListControlsPaginator.ts index d0f41060cf4e..3922158906c6 100644 --- a/clients/client-auditmanager/src/pagination/ListControlsPaginator.ts +++ b/clients/client-auditmanager/src/pagination/ListControlsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListControlsCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: ListControlsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListControlsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListControls( +export const paginateListControls: ( config: AuditManagerPaginationConfiguration, input: ListControlsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListControlsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + ListControlsCommandInput, + ListControlsCommandOutput +>(AuditManagerClient, ListControlsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/ListKeywordsForDataSourcePaginator.ts b/clients/client-auditmanager/src/pagination/ListKeywordsForDataSourcePaginator.ts index 808fd975221f..a9d5334b843b 100644 --- a/clients/client-auditmanager/src/pagination/ListKeywordsForDataSourcePaginator.ts +++ b/clients/client-auditmanager/src/pagination/ListKeywordsForDataSourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListKeywordsForDataSourceCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: ListKeywordsForDataSourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKeywordsForDataSourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKeywordsForDataSource( +export const paginateListKeywordsForDataSource: ( config: AuditManagerPaginationConfiguration, input: ListKeywordsForDataSourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKeywordsForDataSourceCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + ListKeywordsForDataSourceCommandInput, + ListKeywordsForDataSourceCommandOutput +>(AuditManagerClient, ListKeywordsForDataSourceCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auditmanager/src/pagination/ListNotificationsPaginator.ts b/clients/client-auditmanager/src/pagination/ListNotificationsPaginator.ts index 87473d06de6c..6854ad467df8 100644 --- a/clients/client-auditmanager/src/pagination/ListNotificationsPaginator.ts +++ b/clients/client-auditmanager/src/pagination/ListNotificationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AuditManagerClient } from "../AuditManagerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListNotificationsCommand"; import { AuditManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AuditManagerClient, - input: ListNotificationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNotificationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNotifications( +export const paginateListNotifications: ( config: AuditManagerPaginationConfiguration, input: ListNotificationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNotificationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof AuditManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AuditManager | AuditManagerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AuditManagerPaginationConfiguration, + ListNotificationsCommandInput, + ListNotificationsCommandOutput +>(AuditManagerClient, ListNotificationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-auto-scaling/package.json b/clients/client-auto-scaling/package.json index c45f1448bfc9..a156acedc741 100644 --- a/clients/client-auto-scaling/package.json +++ b/clients/client-auto-scaling/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-auto-scaling/src/pagination/DescribeAutoScalingGroupsPaginator.ts b/clients/client-auto-scaling/src/pagination/DescribeAutoScalingGroupsPaginator.ts index f7c5f446ec1a..81d818950b42 100644 --- a/clients/client-auto-scaling/src/pagination/DescribeAutoScalingGroupsPaginator.ts +++ b/clients/client-auto-scaling/src/pagination/DescribeAutoScalingGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AutoScalingClient } from "../AutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeAutoScalingGroupsCommand"; import { AutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AutoScalingClient, - input: DescribeAutoScalingGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAutoScalingGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAutoScalingGroups( +export const paginateDescribeAutoScalingGroups: ( config: AutoScalingPaginationConfiguration, input: DescribeAutoScalingGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAutoScalingGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof AutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AutoScaling | AutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AutoScalingPaginationConfiguration, + DescribeAutoScalingGroupsCommandInput, + DescribeAutoScalingGroupsCommandOutput +>(AutoScalingClient, DescribeAutoScalingGroupsCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-auto-scaling/src/pagination/DescribeAutoScalingInstancesPaginator.ts b/clients/client-auto-scaling/src/pagination/DescribeAutoScalingInstancesPaginator.ts index ec524b45a00b..da6f0722041f 100644 --- a/clients/client-auto-scaling/src/pagination/DescribeAutoScalingInstancesPaginator.ts +++ b/clients/client-auto-scaling/src/pagination/DescribeAutoScalingInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AutoScalingClient } from "../AutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeAutoScalingInstancesCommand"; import { AutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AutoScalingClient, - input: DescribeAutoScalingInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAutoScalingInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAutoScalingInstances( +export const paginateDescribeAutoScalingInstances: ( config: AutoScalingPaginationConfiguration, input: DescribeAutoScalingInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAutoScalingInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof AutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AutoScaling | AutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AutoScalingPaginationConfiguration, + DescribeAutoScalingInstancesCommandInput, + DescribeAutoScalingInstancesCommandOutput +>(AutoScalingClient, DescribeAutoScalingInstancesCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-auto-scaling/src/pagination/DescribeInstanceRefreshesPaginator.ts b/clients/client-auto-scaling/src/pagination/DescribeInstanceRefreshesPaginator.ts index d465c206eeb8..a1c1bfd8a2ba 100644 --- a/clients/client-auto-scaling/src/pagination/DescribeInstanceRefreshesPaginator.ts +++ b/clients/client-auto-scaling/src/pagination/DescribeInstanceRefreshesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AutoScalingClient } from "../AutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeInstanceRefreshesCommand"; import { AutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AutoScalingClient, - input: DescribeInstanceRefreshesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstanceRefreshesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstanceRefreshes( +export const paginateDescribeInstanceRefreshes: ( config: AutoScalingPaginationConfiguration, input: DescribeInstanceRefreshesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstanceRefreshesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof AutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AutoScaling | AutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AutoScalingPaginationConfiguration, + DescribeInstanceRefreshesCommandInput, + DescribeInstanceRefreshesCommandOutput +>(AutoScalingClient, DescribeInstanceRefreshesCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-auto-scaling/src/pagination/DescribeLaunchConfigurationsPaginator.ts b/clients/client-auto-scaling/src/pagination/DescribeLaunchConfigurationsPaginator.ts index ce0f9f4604c6..25f89b8cb6d7 100644 --- a/clients/client-auto-scaling/src/pagination/DescribeLaunchConfigurationsPaginator.ts +++ b/clients/client-auto-scaling/src/pagination/DescribeLaunchConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AutoScalingClient } from "../AutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeLaunchConfigurationsCommand"; import { AutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AutoScalingClient, - input: DescribeLaunchConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLaunchConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLaunchConfigurations( +export const paginateDescribeLaunchConfigurations: ( config: AutoScalingPaginationConfiguration, input: DescribeLaunchConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLaunchConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof AutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AutoScaling | AutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AutoScalingPaginationConfiguration, + DescribeLaunchConfigurationsCommandInput, + DescribeLaunchConfigurationsCommandOutput +>(AutoScalingClient, DescribeLaunchConfigurationsCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-auto-scaling/src/pagination/DescribeLoadBalancerTargetGroupsPaginator.ts b/clients/client-auto-scaling/src/pagination/DescribeLoadBalancerTargetGroupsPaginator.ts index 06f55ded42a1..3358467a31f9 100644 --- a/clients/client-auto-scaling/src/pagination/DescribeLoadBalancerTargetGroupsPaginator.ts +++ b/clients/client-auto-scaling/src/pagination/DescribeLoadBalancerTargetGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AutoScalingClient } from "../AutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeLoadBalancerTargetGroupsCommand"; import { AutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AutoScalingClient, - input: DescribeLoadBalancerTargetGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLoadBalancerTargetGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLoadBalancerTargetGroups( +export const paginateDescribeLoadBalancerTargetGroups: ( config: AutoScalingPaginationConfiguration, input: DescribeLoadBalancerTargetGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLoadBalancerTargetGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof AutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AutoScaling | AutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AutoScalingPaginationConfiguration, + DescribeLoadBalancerTargetGroupsCommandInput, + DescribeLoadBalancerTargetGroupsCommandOutput +>(AutoScalingClient, DescribeLoadBalancerTargetGroupsCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-auto-scaling/src/pagination/DescribeLoadBalancersPaginator.ts b/clients/client-auto-scaling/src/pagination/DescribeLoadBalancersPaginator.ts index 0c06d5fa9a15..8e0b5e19a8bd 100644 --- a/clients/client-auto-scaling/src/pagination/DescribeLoadBalancersPaginator.ts +++ b/clients/client-auto-scaling/src/pagination/DescribeLoadBalancersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AutoScalingClient } from "../AutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeLoadBalancersCommand"; import { AutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AutoScalingClient, - input: DescribeLoadBalancersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLoadBalancersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLoadBalancers( +export const paginateDescribeLoadBalancers: ( config: AutoScalingPaginationConfiguration, input: DescribeLoadBalancersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLoadBalancersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof AutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AutoScaling | AutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AutoScalingPaginationConfiguration, + DescribeLoadBalancersCommandInput, + DescribeLoadBalancersCommandOutput +>(AutoScalingClient, DescribeLoadBalancersCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-auto-scaling/src/pagination/DescribeNotificationConfigurationsPaginator.ts b/clients/client-auto-scaling/src/pagination/DescribeNotificationConfigurationsPaginator.ts index c8d7d2b552bd..3db3e7b857e5 100644 --- a/clients/client-auto-scaling/src/pagination/DescribeNotificationConfigurationsPaginator.ts +++ b/clients/client-auto-scaling/src/pagination/DescribeNotificationConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AutoScalingClient } from "../AutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeNotificationConfigurationsCommand"; import { AutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AutoScalingClient, - input: DescribeNotificationConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeNotificationConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeNotificationConfigurations( +export const paginateDescribeNotificationConfigurations: ( config: AutoScalingPaginationConfiguration, input: DescribeNotificationConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeNotificationConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof AutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AutoScaling | AutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AutoScalingPaginationConfiguration, + DescribeNotificationConfigurationsCommandInput, + DescribeNotificationConfigurationsCommandOutput +>(AutoScalingClient, DescribeNotificationConfigurationsCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-auto-scaling/src/pagination/DescribePoliciesPaginator.ts b/clients/client-auto-scaling/src/pagination/DescribePoliciesPaginator.ts index 68ba0b1e10b9..ee13478731f1 100644 --- a/clients/client-auto-scaling/src/pagination/DescribePoliciesPaginator.ts +++ b/clients/client-auto-scaling/src/pagination/DescribePoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AutoScalingClient } from "../AutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribePoliciesCommand"; import { AutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AutoScalingClient, - input: DescribePoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePolicies( +export const paginateDescribePolicies: ( config: AutoScalingPaginationConfiguration, input: DescribePoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePoliciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof AutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AutoScaling | AutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AutoScalingPaginationConfiguration, + DescribePoliciesCommandInput, + DescribePoliciesCommandOutput +>(AutoScalingClient, DescribePoliciesCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-auto-scaling/src/pagination/DescribeScalingActivitiesPaginator.ts b/clients/client-auto-scaling/src/pagination/DescribeScalingActivitiesPaginator.ts index 440ef9824160..4c7411a21ea9 100644 --- a/clients/client-auto-scaling/src/pagination/DescribeScalingActivitiesPaginator.ts +++ b/clients/client-auto-scaling/src/pagination/DescribeScalingActivitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AutoScalingClient } from "../AutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeScalingActivitiesCommand"; import { AutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AutoScalingClient, - input: DescribeScalingActivitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeScalingActivitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeScalingActivities( +export const paginateDescribeScalingActivities: ( config: AutoScalingPaginationConfiguration, input: DescribeScalingActivitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeScalingActivitiesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof AutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AutoScaling | AutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AutoScalingPaginationConfiguration, + DescribeScalingActivitiesCommandInput, + DescribeScalingActivitiesCommandOutput +>(AutoScalingClient, DescribeScalingActivitiesCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-auto-scaling/src/pagination/DescribeScheduledActionsPaginator.ts b/clients/client-auto-scaling/src/pagination/DescribeScheduledActionsPaginator.ts index 57b8e8b90b02..6bfb7574110f 100644 --- a/clients/client-auto-scaling/src/pagination/DescribeScheduledActionsPaginator.ts +++ b/clients/client-auto-scaling/src/pagination/DescribeScheduledActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AutoScalingClient } from "../AutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeScheduledActionsCommand"; import { AutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AutoScalingClient, - input: DescribeScheduledActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeScheduledActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeScheduledActions( +export const paginateDescribeScheduledActions: ( config: AutoScalingPaginationConfiguration, input: DescribeScheduledActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeScheduledActionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof AutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AutoScaling | AutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AutoScalingPaginationConfiguration, + DescribeScheduledActionsCommandInput, + DescribeScheduledActionsCommandOutput +>(AutoScalingClient, DescribeScheduledActionsCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-auto-scaling/src/pagination/DescribeTagsPaginator.ts b/clients/client-auto-scaling/src/pagination/DescribeTagsPaginator.ts index 4d3e3d13e902..cf2f613b30c1 100644 --- a/clients/client-auto-scaling/src/pagination/DescribeTagsPaginator.ts +++ b/clients/client-auto-scaling/src/pagination/DescribeTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AutoScalingClient } from "../AutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeTagsCommand"; import { AutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AutoScalingClient, - input: DescribeTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTags( +export const paginateDescribeTags: ( config: AutoScalingPaginationConfiguration, input: DescribeTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTagsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof AutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AutoScaling | AutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AutoScalingPaginationConfiguration, + DescribeTagsCommandInput, + DescribeTagsCommandOutput +>(AutoScalingClient, DescribeTagsCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-auto-scaling/src/pagination/DescribeTrafficSourcesPaginator.ts b/clients/client-auto-scaling/src/pagination/DescribeTrafficSourcesPaginator.ts index 3e848a207a03..d0615ddbb6e6 100644 --- a/clients/client-auto-scaling/src/pagination/DescribeTrafficSourcesPaginator.ts +++ b/clients/client-auto-scaling/src/pagination/DescribeTrafficSourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AutoScalingClient } from "../AutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeTrafficSourcesCommand"; import { AutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AutoScalingClient, - input: DescribeTrafficSourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTrafficSourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTrafficSources( +export const paginateDescribeTrafficSources: ( config: AutoScalingPaginationConfiguration, input: DescribeTrafficSourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTrafficSourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof AutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AutoScaling | AutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AutoScalingPaginationConfiguration, + DescribeTrafficSourcesCommandInput, + DescribeTrafficSourcesCommandOutput +>(AutoScalingClient, DescribeTrafficSourcesCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-auto-scaling/src/pagination/DescribeWarmPoolPaginator.ts b/clients/client-auto-scaling/src/pagination/DescribeWarmPoolPaginator.ts index 1d575fdcb4b9..9e22e1b96241 100644 --- a/clients/client-auto-scaling/src/pagination/DescribeWarmPoolPaginator.ts +++ b/clients/client-auto-scaling/src/pagination/DescribeWarmPoolPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { AutoScalingClient } from "../AutoScalingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeWarmPoolCommand"; import { AutoScalingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: AutoScalingClient, - input: DescribeWarmPoolCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeWarmPoolCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeWarmPool( +export const paginateDescribeWarmPool: ( config: AutoScalingPaginationConfiguration, input: DescribeWarmPoolCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeWarmPoolCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof AutoScalingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected AutoScaling | AutoScalingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + AutoScalingPaginationConfiguration, + DescribeWarmPoolCommandInput, + DescribeWarmPoolCommandOutput +>(AutoScalingClient, DescribeWarmPoolCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-b2bi/package.json b/clients/client-b2bi/package.json index 0f9876c6cc6d..3d908c664f73 100644 --- a/clients/client-b2bi/package.json +++ b/clients/client-b2bi/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-b2bi/src/pagination/ListCapabilitiesPaginator.ts b/clients/client-b2bi/src/pagination/ListCapabilitiesPaginator.ts index 0e3e6a028b11..1fa1189a8881 100644 --- a/clients/client-b2bi/src/pagination/ListCapabilitiesPaginator.ts +++ b/clients/client-b2bi/src/pagination/ListCapabilitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { B2biClient } from "../B2biClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCapabilitiesCommand"; import { B2biPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: B2biClient, - input: ListCapabilitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCapabilitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCapabilities( +export const paginateListCapabilities: ( config: B2biPaginationConfiguration, input: ListCapabilitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCapabilitiesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof B2biClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected B2bi | B2biClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + B2biPaginationConfiguration, + ListCapabilitiesCommandInput, + ListCapabilitiesCommandOutput +>(B2biClient, ListCapabilitiesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-b2bi/src/pagination/ListPartnershipsPaginator.ts b/clients/client-b2bi/src/pagination/ListPartnershipsPaginator.ts index 206115bcdb67..d96d3088fa8a 100644 --- a/clients/client-b2bi/src/pagination/ListPartnershipsPaginator.ts +++ b/clients/client-b2bi/src/pagination/ListPartnershipsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { B2biClient } from "../B2biClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPartnershipsCommand"; import { B2biPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: B2biClient, - input: ListPartnershipsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPartnershipsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPartnerships( +export const paginateListPartnerships: ( config: B2biPaginationConfiguration, input: ListPartnershipsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPartnershipsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof B2biClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected B2bi | B2biClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + B2biPaginationConfiguration, + ListPartnershipsCommandInput, + ListPartnershipsCommandOutput +>(B2biClient, ListPartnershipsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-b2bi/src/pagination/ListProfilesPaginator.ts b/clients/client-b2bi/src/pagination/ListProfilesPaginator.ts index 8f92552c63a1..54fa48311f1b 100644 --- a/clients/client-b2bi/src/pagination/ListProfilesPaginator.ts +++ b/clients/client-b2bi/src/pagination/ListProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { B2biClient } from "../B2biClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListProfilesCommand"; import { B2biPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: B2biClient, - input: ListProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProfiles( +export const paginateListProfiles: ( config: B2biPaginationConfiguration, input: ListProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProfilesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof B2biClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected B2bi | B2biClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + B2biPaginationConfiguration, + ListProfilesCommandInput, + ListProfilesCommandOutput +>(B2biClient, ListProfilesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-b2bi/src/pagination/ListTransformersPaginator.ts b/clients/client-b2bi/src/pagination/ListTransformersPaginator.ts index 76c9334704b0..b7655a80111f 100644 --- a/clients/client-b2bi/src/pagination/ListTransformersPaginator.ts +++ b/clients/client-b2bi/src/pagination/ListTransformersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { B2biClient } from "../B2biClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListTransformersCommand"; import { B2biPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: B2biClient, - input: ListTransformersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTransformersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTransformers( +export const paginateListTransformers: ( config: B2biPaginationConfiguration, input: ListTransformersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTransformersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof B2biClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected B2bi | B2biClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + B2biPaginationConfiguration, + ListTransformersCommandInput, + ListTransformersCommandOutput +>(B2biClient, ListTransformersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-backup-gateway/package.json b/clients/client-backup-gateway/package.json index 43955b779605..c45877a15913 100644 --- a/clients/client-backup-gateway/package.json +++ b/clients/client-backup-gateway/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-backup-gateway/src/pagination/ListGatewaysPaginator.ts b/clients/client-backup-gateway/src/pagination/ListGatewaysPaginator.ts index a5d34b5040d8..e8ff291c9fff 100644 --- a/clients/client-backup-gateway/src/pagination/ListGatewaysPaginator.ts +++ b/clients/client-backup-gateway/src/pagination/ListGatewaysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupGatewayClient } from "../BackupGatewayClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListGatewaysCommand"; import { BackupGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupGatewayClient, - input: ListGatewaysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGatewaysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGateways( +export const paginateListGateways: ( config: BackupGatewayPaginationConfiguration, input: ListGatewaysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGatewaysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BackupGateway | BackupGatewayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupGatewayPaginationConfiguration, + ListGatewaysCommandInput, + ListGatewaysCommandOutput +>(BackupGatewayClient, ListGatewaysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup-gateway/src/pagination/ListHypervisorsPaginator.ts b/clients/client-backup-gateway/src/pagination/ListHypervisorsPaginator.ts index 7805bce05f02..25822f80242f 100644 --- a/clients/client-backup-gateway/src/pagination/ListHypervisorsPaginator.ts +++ b/clients/client-backup-gateway/src/pagination/ListHypervisorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupGatewayClient } from "../BackupGatewayClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListHypervisorsCommand"; import { BackupGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupGatewayClient, - input: ListHypervisorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHypervisorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHypervisors( +export const paginateListHypervisors: ( config: BackupGatewayPaginationConfiguration, input: ListHypervisorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHypervisorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BackupGateway | BackupGatewayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupGatewayPaginationConfiguration, + ListHypervisorsCommandInput, + ListHypervisorsCommandOutput +>(BackupGatewayClient, ListHypervisorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup-gateway/src/pagination/ListVirtualMachinesPaginator.ts b/clients/client-backup-gateway/src/pagination/ListVirtualMachinesPaginator.ts index 69d6c1046832..7967c7774c97 100644 --- a/clients/client-backup-gateway/src/pagination/ListVirtualMachinesPaginator.ts +++ b/clients/client-backup-gateway/src/pagination/ListVirtualMachinesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupGatewayClient } from "../BackupGatewayClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListVirtualMachinesCommand"; import { BackupGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupGatewayClient, - input: ListVirtualMachinesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVirtualMachinesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVirtualMachines( +export const paginateListVirtualMachines: ( config: BackupGatewayPaginationConfiguration, input: ListVirtualMachinesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVirtualMachinesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BackupGateway | BackupGatewayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupGatewayPaginationConfiguration, + ListVirtualMachinesCommandInput, + ListVirtualMachinesCommandOutput +>(BackupGatewayClient, ListVirtualMachinesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListBackupJobSummariesPaginator.ts b/clients/client-backup/src/pagination/ListBackupJobSummariesPaginator.ts index 35b9d6daac12..0ed99dbe197e 100644 --- a/clients/client-backup/src/pagination/ListBackupJobSummariesPaginator.ts +++ b/clients/client-backup/src/pagination/ListBackupJobSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListBackupJobSummariesCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListBackupJobSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBackupJobSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBackupJobSummaries( +export const paginateListBackupJobSummaries: ( config: BackupPaginationConfiguration, input: ListBackupJobSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBackupJobSummariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListBackupJobSummariesCommandInput, + ListBackupJobSummariesCommandOutput +>(BackupClient, ListBackupJobSummariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListBackupJobsPaginator.ts b/clients/client-backup/src/pagination/ListBackupJobsPaginator.ts index 8a55026ec56f..c75dc4825e41 100644 --- a/clients/client-backup/src/pagination/ListBackupJobsPaginator.ts +++ b/clients/client-backup/src/pagination/ListBackupJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListBackupJobsCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListBackupJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBackupJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBackupJobs( +export const paginateListBackupJobs: ( config: BackupPaginationConfiguration, input: ListBackupJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBackupJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListBackupJobsCommandInput, + ListBackupJobsCommandOutput +>(BackupClient, ListBackupJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListBackupPlanTemplatesPaginator.ts b/clients/client-backup/src/pagination/ListBackupPlanTemplatesPaginator.ts index fed3626b6633..f38194ce5684 100644 --- a/clients/client-backup/src/pagination/ListBackupPlanTemplatesPaginator.ts +++ b/clients/client-backup/src/pagination/ListBackupPlanTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListBackupPlanTemplatesCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListBackupPlanTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBackupPlanTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBackupPlanTemplates( +export const paginateListBackupPlanTemplates: ( config: BackupPaginationConfiguration, input: ListBackupPlanTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBackupPlanTemplatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListBackupPlanTemplatesCommandInput, + ListBackupPlanTemplatesCommandOutput +>(BackupClient, ListBackupPlanTemplatesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListBackupPlanVersionsPaginator.ts b/clients/client-backup/src/pagination/ListBackupPlanVersionsPaginator.ts index 1e1377cc085b..05166bdd14d9 100644 --- a/clients/client-backup/src/pagination/ListBackupPlanVersionsPaginator.ts +++ b/clients/client-backup/src/pagination/ListBackupPlanVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListBackupPlanVersionsCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListBackupPlanVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBackupPlanVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBackupPlanVersions( +export const paginateListBackupPlanVersions: ( config: BackupPaginationConfiguration, input: ListBackupPlanVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBackupPlanVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListBackupPlanVersionsCommandInput, + ListBackupPlanVersionsCommandOutput +>(BackupClient, ListBackupPlanVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListBackupPlansPaginator.ts b/clients/client-backup/src/pagination/ListBackupPlansPaginator.ts index 9d3ab0f2cf05..b2fac13fe362 100644 --- a/clients/client-backup/src/pagination/ListBackupPlansPaginator.ts +++ b/clients/client-backup/src/pagination/ListBackupPlansPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListBackupPlansCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListBackupPlansCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBackupPlansCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBackupPlans( +export const paginateListBackupPlans: ( config: BackupPaginationConfiguration, input: ListBackupPlansCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBackupPlansCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListBackupPlansCommandInput, + ListBackupPlansCommandOutput +>(BackupClient, ListBackupPlansCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListBackupSelectionsPaginator.ts b/clients/client-backup/src/pagination/ListBackupSelectionsPaginator.ts index f9cd6c9bfe74..6b903717fe41 100644 --- a/clients/client-backup/src/pagination/ListBackupSelectionsPaginator.ts +++ b/clients/client-backup/src/pagination/ListBackupSelectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListBackupSelectionsCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListBackupSelectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBackupSelectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBackupSelections( +export const paginateListBackupSelections: ( config: BackupPaginationConfiguration, input: ListBackupSelectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBackupSelectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListBackupSelectionsCommandInput, + ListBackupSelectionsCommandOutput +>(BackupClient, ListBackupSelectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListBackupVaultsPaginator.ts b/clients/client-backup/src/pagination/ListBackupVaultsPaginator.ts index 55096e6f60ef..a1c1e1bdf1ee 100644 --- a/clients/client-backup/src/pagination/ListBackupVaultsPaginator.ts +++ b/clients/client-backup/src/pagination/ListBackupVaultsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListBackupVaultsCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListBackupVaultsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBackupVaultsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBackupVaults( +export const paginateListBackupVaults: ( config: BackupPaginationConfiguration, input: ListBackupVaultsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBackupVaultsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListBackupVaultsCommandInput, + ListBackupVaultsCommandOutput +>(BackupClient, ListBackupVaultsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListCopyJobSummariesPaginator.ts b/clients/client-backup/src/pagination/ListCopyJobSummariesPaginator.ts index 176b67fc9512..7892c0e59fa8 100644 --- a/clients/client-backup/src/pagination/ListCopyJobSummariesPaginator.ts +++ b/clients/client-backup/src/pagination/ListCopyJobSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCopyJobSummariesCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListCopyJobSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCopyJobSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCopyJobSummaries( +export const paginateListCopyJobSummaries: ( config: BackupPaginationConfiguration, input: ListCopyJobSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCopyJobSummariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListCopyJobSummariesCommandInput, + ListCopyJobSummariesCommandOutput +>(BackupClient, ListCopyJobSummariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListCopyJobsPaginator.ts b/clients/client-backup/src/pagination/ListCopyJobsPaginator.ts index 76897802b7ea..ad20a85a48ba 100644 --- a/clients/client-backup/src/pagination/ListCopyJobsPaginator.ts +++ b/clients/client-backup/src/pagination/ListCopyJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCopyJobsCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListCopyJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCopyJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCopyJobs( +export const paginateListCopyJobs: ( config: BackupPaginationConfiguration, input: ListCopyJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCopyJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListCopyJobsCommandInput, + ListCopyJobsCommandOutput +>(BackupClient, ListCopyJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListFrameworksPaginator.ts b/clients/client-backup/src/pagination/ListFrameworksPaginator.ts index 2456148cc4d5..ee3c6b99dc71 100644 --- a/clients/client-backup/src/pagination/ListFrameworksPaginator.ts +++ b/clients/client-backup/src/pagination/ListFrameworksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListFrameworksCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListFrameworksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFrameworksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFrameworks( +export const paginateListFrameworks: ( config: BackupPaginationConfiguration, input: ListFrameworksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFrameworksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListFrameworksCommandInput, + ListFrameworksCommandOutput +>(BackupClient, ListFrameworksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListLegalHoldsPaginator.ts b/clients/client-backup/src/pagination/ListLegalHoldsPaginator.ts index 193a4c0facfa..072c41804b5c 100644 --- a/clients/client-backup/src/pagination/ListLegalHoldsPaginator.ts +++ b/clients/client-backup/src/pagination/ListLegalHoldsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListLegalHoldsCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListLegalHoldsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLegalHoldsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLegalHolds( +export const paginateListLegalHolds: ( config: BackupPaginationConfiguration, input: ListLegalHoldsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLegalHoldsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListLegalHoldsCommandInput, + ListLegalHoldsCommandOutput +>(BackupClient, ListLegalHoldsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListProtectedResourcesByBackupVaultPaginator.ts b/clients/client-backup/src/pagination/ListProtectedResourcesByBackupVaultPaginator.ts index fc00685e1e08..083adad5f52a 100644 --- a/clients/client-backup/src/pagination/ListProtectedResourcesByBackupVaultPaginator.ts +++ b/clients/client-backup/src/pagination/ListProtectedResourcesByBackupVaultPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListProtectedResourcesByBackupVaultCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListProtectedResourcesByBackupVaultCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProtectedResourcesByBackupVaultCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProtectedResourcesByBackupVault( +export const paginateListProtectedResourcesByBackupVault: ( config: BackupPaginationConfiguration, input: ListProtectedResourcesByBackupVaultCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProtectedResourcesByBackupVaultCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListProtectedResourcesByBackupVaultCommandInput, + ListProtectedResourcesByBackupVaultCommandOutput +>(BackupClient, ListProtectedResourcesByBackupVaultCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListProtectedResourcesPaginator.ts b/clients/client-backup/src/pagination/ListProtectedResourcesPaginator.ts index 2a106cadbadc..c83e9003bf29 100644 --- a/clients/client-backup/src/pagination/ListProtectedResourcesPaginator.ts +++ b/clients/client-backup/src/pagination/ListProtectedResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListProtectedResourcesCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListProtectedResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProtectedResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProtectedResources( +export const paginateListProtectedResources: ( config: BackupPaginationConfiguration, input: ListProtectedResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProtectedResourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListProtectedResourcesCommandInput, + ListProtectedResourcesCommandOutput +>(BackupClient, ListProtectedResourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListRecoveryPointsByBackupVaultPaginator.ts b/clients/client-backup/src/pagination/ListRecoveryPointsByBackupVaultPaginator.ts index e6c0320d2d01..e260e3d6763f 100644 --- a/clients/client-backup/src/pagination/ListRecoveryPointsByBackupVaultPaginator.ts +++ b/clients/client-backup/src/pagination/ListRecoveryPointsByBackupVaultPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRecoveryPointsByBackupVaultCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListRecoveryPointsByBackupVaultCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecoveryPointsByBackupVaultCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecoveryPointsByBackupVault( +export const paginateListRecoveryPointsByBackupVault: ( config: BackupPaginationConfiguration, input: ListRecoveryPointsByBackupVaultCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecoveryPointsByBackupVaultCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListRecoveryPointsByBackupVaultCommandInput, + ListRecoveryPointsByBackupVaultCommandOutput +>(BackupClient, ListRecoveryPointsByBackupVaultCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListRecoveryPointsByLegalHoldPaginator.ts b/clients/client-backup/src/pagination/ListRecoveryPointsByLegalHoldPaginator.ts index 6fc5c6ea3b45..7988a2c03ea5 100644 --- a/clients/client-backup/src/pagination/ListRecoveryPointsByLegalHoldPaginator.ts +++ b/clients/client-backup/src/pagination/ListRecoveryPointsByLegalHoldPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRecoveryPointsByLegalHoldCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListRecoveryPointsByLegalHoldCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecoveryPointsByLegalHoldCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecoveryPointsByLegalHold( +export const paginateListRecoveryPointsByLegalHold: ( config: BackupPaginationConfiguration, input: ListRecoveryPointsByLegalHoldCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecoveryPointsByLegalHoldCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListRecoveryPointsByLegalHoldCommandInput, + ListRecoveryPointsByLegalHoldCommandOutput +>(BackupClient, ListRecoveryPointsByLegalHoldCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListRecoveryPointsByResourcePaginator.ts b/clients/client-backup/src/pagination/ListRecoveryPointsByResourcePaginator.ts index a256fb0d5c4f..1bb7b0e0aa30 100644 --- a/clients/client-backup/src/pagination/ListRecoveryPointsByResourcePaginator.ts +++ b/clients/client-backup/src/pagination/ListRecoveryPointsByResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRecoveryPointsByResourceCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListRecoveryPointsByResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecoveryPointsByResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecoveryPointsByResource( +export const paginateListRecoveryPointsByResource: ( config: BackupPaginationConfiguration, input: ListRecoveryPointsByResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecoveryPointsByResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListRecoveryPointsByResourceCommandInput, + ListRecoveryPointsByResourceCommandOutput +>(BackupClient, ListRecoveryPointsByResourceCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListReportJobsPaginator.ts b/clients/client-backup/src/pagination/ListReportJobsPaginator.ts index 62d166eaa86a..f745a4687bb8 100644 --- a/clients/client-backup/src/pagination/ListReportJobsPaginator.ts +++ b/clients/client-backup/src/pagination/ListReportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListReportJobsCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListReportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReportJobs( +export const paginateListReportJobs: ( config: BackupPaginationConfiguration, input: ListReportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReportJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListReportJobsCommandInput, + ListReportJobsCommandOutput +>(BackupClient, ListReportJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListReportPlansPaginator.ts b/clients/client-backup/src/pagination/ListReportPlansPaginator.ts index 2130b8bcb5d0..2e71a2da9a8f 100644 --- a/clients/client-backup/src/pagination/ListReportPlansPaginator.ts +++ b/clients/client-backup/src/pagination/ListReportPlansPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListReportPlansCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListReportPlansCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReportPlansCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReportPlans( +export const paginateListReportPlans: ( config: BackupPaginationConfiguration, input: ListReportPlansCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReportPlansCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListReportPlansCommandInput, + ListReportPlansCommandOutput +>(BackupClient, ListReportPlansCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListRestoreJobSummariesPaginator.ts b/clients/client-backup/src/pagination/ListRestoreJobSummariesPaginator.ts index fabbc57106b6..8d66c459560e 100644 --- a/clients/client-backup/src/pagination/ListRestoreJobSummariesPaginator.ts +++ b/clients/client-backup/src/pagination/ListRestoreJobSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRestoreJobSummariesCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListRestoreJobSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRestoreJobSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRestoreJobSummaries( +export const paginateListRestoreJobSummaries: ( config: BackupPaginationConfiguration, input: ListRestoreJobSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRestoreJobSummariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListRestoreJobSummariesCommandInput, + ListRestoreJobSummariesCommandOutput +>(BackupClient, ListRestoreJobSummariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListRestoreJobsByProtectedResourcePaginator.ts b/clients/client-backup/src/pagination/ListRestoreJobsByProtectedResourcePaginator.ts index 607acd722f92..788295bab1b0 100644 --- a/clients/client-backup/src/pagination/ListRestoreJobsByProtectedResourcePaginator.ts +++ b/clients/client-backup/src/pagination/ListRestoreJobsByProtectedResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRestoreJobsByProtectedResourceCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListRestoreJobsByProtectedResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRestoreJobsByProtectedResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRestoreJobsByProtectedResource( +export const paginateListRestoreJobsByProtectedResource: ( config: BackupPaginationConfiguration, input: ListRestoreJobsByProtectedResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRestoreJobsByProtectedResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListRestoreJobsByProtectedResourceCommandInput, + ListRestoreJobsByProtectedResourceCommandOutput +>(BackupClient, ListRestoreJobsByProtectedResourceCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListRestoreJobsPaginator.ts b/clients/client-backup/src/pagination/ListRestoreJobsPaginator.ts index 1136c887ee9c..6c0288977628 100644 --- a/clients/client-backup/src/pagination/ListRestoreJobsPaginator.ts +++ b/clients/client-backup/src/pagination/ListRestoreJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRestoreJobsCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListRestoreJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRestoreJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRestoreJobs( +export const paginateListRestoreJobs: ( config: BackupPaginationConfiguration, input: ListRestoreJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRestoreJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListRestoreJobsCommandInput, + ListRestoreJobsCommandOutput +>(BackupClient, ListRestoreJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListRestoreTestingPlansPaginator.ts b/clients/client-backup/src/pagination/ListRestoreTestingPlansPaginator.ts index c4827eb0a066..07c6b1eb2c9b 100644 --- a/clients/client-backup/src/pagination/ListRestoreTestingPlansPaginator.ts +++ b/clients/client-backup/src/pagination/ListRestoreTestingPlansPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRestoreTestingPlansCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListRestoreTestingPlansCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRestoreTestingPlansCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRestoreTestingPlans( +export const paginateListRestoreTestingPlans: ( config: BackupPaginationConfiguration, input: ListRestoreTestingPlansCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRestoreTestingPlansCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListRestoreTestingPlansCommandInput, + ListRestoreTestingPlansCommandOutput +>(BackupClient, ListRestoreTestingPlansCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListRestoreTestingSelectionsPaginator.ts b/clients/client-backup/src/pagination/ListRestoreTestingSelectionsPaginator.ts index b3c7d945ccaa..8269abff01a1 100644 --- a/clients/client-backup/src/pagination/ListRestoreTestingSelectionsPaginator.ts +++ b/clients/client-backup/src/pagination/ListRestoreTestingSelectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRestoreTestingSelectionsCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListRestoreTestingSelectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRestoreTestingSelectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRestoreTestingSelections( +export const paginateListRestoreTestingSelections: ( config: BackupPaginationConfiguration, input: ListRestoreTestingSelectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRestoreTestingSelectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListRestoreTestingSelectionsCommandInput, + ListRestoreTestingSelectionsCommandOutput +>(BackupClient, ListRestoreTestingSelectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backup/src/pagination/ListTagsPaginator.ts b/clients/client-backup/src/pagination/ListTagsPaginator.ts index 477230dda257..693f0a074f18 100644 --- a/clients/client-backup/src/pagination/ListTagsPaginator.ts +++ b/clients/client-backup/src/pagination/ListTagsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupClient } from "../BackupClient"; import { ListTagsCommand, ListTagsCommandInput, ListTagsCommandOutput } from "../commands/ListTagsCommand"; import { BackupPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupClient, - input: ListTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTags( +export const paginateListTags: ( config: BackupPaginationConfiguration, input: ListTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Backup | BackupClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupPaginationConfiguration, + ListTagsCommandInput, + ListTagsCommandOutput +>(BackupClient, ListTagsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backupstorage/src/pagination/ListChunksPaginator.ts b/clients/client-backupstorage/src/pagination/ListChunksPaginator.ts index bb1c8e9e68c4..81375f02833c 100644 --- a/clients/client-backupstorage/src/pagination/ListChunksPaginator.ts +++ b/clients/client-backupstorage/src/pagination/ListChunksPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupStorageClient } from "../BackupStorageClient"; import { ListChunksCommand, ListChunksCommandInput, ListChunksCommandOutput } from "../commands/ListChunksCommand"; import { BackupStoragePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupStorageClient, - input: ListChunksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChunksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChunks( +export const paginateListChunks: ( config: BackupStoragePaginationConfiguration, input: ListChunksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChunksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupStorageClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BackupStorage | BackupStorageClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupStoragePaginationConfiguration, + ListChunksCommandInput, + ListChunksCommandOutput +>(BackupStorageClient, ListChunksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-backupstorage/src/pagination/ListObjectsPaginator.ts b/clients/client-backupstorage/src/pagination/ListObjectsPaginator.ts index e666e23e6513..16f18624c760 100644 --- a/clients/client-backupstorage/src/pagination/ListObjectsPaginator.ts +++ b/clients/client-backupstorage/src/pagination/ListObjectsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BackupStorageClient } from "../BackupStorageClient"; import { ListObjectsCommand, ListObjectsCommandInput, ListObjectsCommandOutput } from "../commands/ListObjectsCommand"; import { BackupStoragePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BackupStorageClient, - input: ListObjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListObjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListObjects( +export const paginateListObjects: ( config: BackupStoragePaginationConfiguration, input: ListObjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListObjectsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BackupStorageClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BackupStorage | BackupStorageClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BackupStoragePaginationConfiguration, + ListObjectsCommandInput, + ListObjectsCommandOutput +>(BackupStorageClient, ListObjectsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-batch/src/pagination/DescribeComputeEnvironmentsPaginator.ts b/clients/client-batch/src/pagination/DescribeComputeEnvironmentsPaginator.ts index c90ea2ac7da7..7e990ed24387 100644 --- a/clients/client-batch/src/pagination/DescribeComputeEnvironmentsPaginator.ts +++ b/clients/client-batch/src/pagination/DescribeComputeEnvironmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BatchClient } from "../BatchClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeComputeEnvironmentsCommand"; import { BatchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BatchClient, - input: DescribeComputeEnvironmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeComputeEnvironmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeComputeEnvironments( +export const paginateDescribeComputeEnvironments: ( config: BatchPaginationConfiguration, input: DescribeComputeEnvironmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeComputeEnvironmentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BatchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Batch | BatchClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BatchPaginationConfiguration, + DescribeComputeEnvironmentsCommandInput, + DescribeComputeEnvironmentsCommandOutput +>(BatchClient, DescribeComputeEnvironmentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-batch/src/pagination/DescribeJobDefinitionsPaginator.ts b/clients/client-batch/src/pagination/DescribeJobDefinitionsPaginator.ts index b75254d99d37..7c65a8178d88 100644 --- a/clients/client-batch/src/pagination/DescribeJobDefinitionsPaginator.ts +++ b/clients/client-batch/src/pagination/DescribeJobDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BatchClient } from "../BatchClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeJobDefinitionsCommand"; import { BatchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BatchClient, - input: DescribeJobDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeJobDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeJobDefinitions( +export const paginateDescribeJobDefinitions: ( config: BatchPaginationConfiguration, input: DescribeJobDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeJobDefinitionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BatchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Batch | BatchClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BatchPaginationConfiguration, + DescribeJobDefinitionsCommandInput, + DescribeJobDefinitionsCommandOutput +>(BatchClient, DescribeJobDefinitionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-batch/src/pagination/DescribeJobQueuesPaginator.ts b/clients/client-batch/src/pagination/DescribeJobQueuesPaginator.ts index 23a1c641914d..c74915826624 100644 --- a/clients/client-batch/src/pagination/DescribeJobQueuesPaginator.ts +++ b/clients/client-batch/src/pagination/DescribeJobQueuesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BatchClient } from "../BatchClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeJobQueuesCommand"; import { BatchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BatchClient, - input: DescribeJobQueuesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeJobQueuesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeJobQueues( +export const paginateDescribeJobQueues: ( config: BatchPaginationConfiguration, input: DescribeJobQueuesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeJobQueuesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BatchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Batch | BatchClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BatchPaginationConfiguration, + DescribeJobQueuesCommandInput, + DescribeJobQueuesCommandOutput +>(BatchClient, DescribeJobQueuesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-batch/src/pagination/ListJobsPaginator.ts b/clients/client-batch/src/pagination/ListJobsPaginator.ts index e1e5dec3ed7c..ed134d0111f2 100644 --- a/clients/client-batch/src/pagination/ListJobsPaginator.ts +++ b/clients/client-batch/src/pagination/ListJobsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BatchClient } from "../BatchClient"; import { ListJobsCommand, ListJobsCommandInput, ListJobsCommandOutput } from "../commands/ListJobsCommand"; import { BatchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BatchClient, - input: ListJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobs( +export const paginateListJobs: ( config: BatchPaginationConfiguration, input: ListJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BatchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Batch | BatchClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BatchPaginationConfiguration, + ListJobsCommandInput, + ListJobsCommandOutput +>(BatchClient, ListJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-batch/src/pagination/ListSchedulingPoliciesPaginator.ts b/clients/client-batch/src/pagination/ListSchedulingPoliciesPaginator.ts index bac5af913d56..aef2831ab376 100644 --- a/clients/client-batch/src/pagination/ListSchedulingPoliciesPaginator.ts +++ b/clients/client-batch/src/pagination/ListSchedulingPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BatchClient } from "../BatchClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSchedulingPoliciesCommand"; import { BatchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BatchClient, - input: ListSchedulingPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSchedulingPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSchedulingPolicies( +export const paginateListSchedulingPolicies: ( config: BatchPaginationConfiguration, input: ListSchedulingPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSchedulingPoliciesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BatchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Batch | BatchClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BatchPaginationConfiguration, + ListSchedulingPoliciesCommandInput, + ListSchedulingPoliciesCommandOutput +>(BatchClient, ListSchedulingPoliciesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-bcm-data-exports/package.json b/clients/client-bcm-data-exports/package.json index 099378fbd286..882508defafa 100644 --- a/clients/client-bcm-data-exports/package.json +++ b/clients/client-bcm-data-exports/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-bcm-data-exports/src/pagination/ListExecutionsPaginator.ts b/clients/client-bcm-data-exports/src/pagination/ListExecutionsPaginator.ts index 7ee1fd71b974..c2c676a6ae13 100644 --- a/clients/client-bcm-data-exports/src/pagination/ListExecutionsPaginator.ts +++ b/clients/client-bcm-data-exports/src/pagination/ListExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BCMDataExportsClient } from "../BCMDataExportsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListExecutionsCommand"; import { BCMDataExportsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BCMDataExportsClient, - input: ListExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExecutions( +export const paginateListExecutions: ( config: BCMDataExportsPaginationConfiguration, input: ListExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExecutionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BCMDataExportsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BCMDataExports | BCMDataExportsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BCMDataExportsPaginationConfiguration, + ListExecutionsCommandInput, + ListExecutionsCommandOutput +>(BCMDataExportsClient, ListExecutionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-bcm-data-exports/src/pagination/ListExportsPaginator.ts b/clients/client-bcm-data-exports/src/pagination/ListExportsPaginator.ts index 7de87afc12d3..6cdedff7c556 100644 --- a/clients/client-bcm-data-exports/src/pagination/ListExportsPaginator.ts +++ b/clients/client-bcm-data-exports/src/pagination/ListExportsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BCMDataExportsClient } from "../BCMDataExportsClient"; import { ListExportsCommand, ListExportsCommandInput, ListExportsCommandOutput } from "../commands/ListExportsCommand"; import { BCMDataExportsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BCMDataExportsClient, - input: ListExportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExports( +export const paginateListExports: ( config: BCMDataExportsPaginationConfiguration, input: ListExportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExportsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BCMDataExportsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BCMDataExports | BCMDataExportsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BCMDataExportsPaginationConfiguration, + ListExportsCommandInput, + ListExportsCommandOutput +>(BCMDataExportsClient, ListExportsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-bcm-data-exports/src/pagination/ListTablesPaginator.ts b/clients/client-bcm-data-exports/src/pagination/ListTablesPaginator.ts index 1d024efded95..fbcf74acd352 100644 --- a/clients/client-bcm-data-exports/src/pagination/ListTablesPaginator.ts +++ b/clients/client-bcm-data-exports/src/pagination/ListTablesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BCMDataExportsClient } from "../BCMDataExportsClient"; import { ListTablesCommand, ListTablesCommandInput, ListTablesCommandOutput } from "../commands/ListTablesCommand"; import { BCMDataExportsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BCMDataExportsClient, - input: ListTablesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTablesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTables( +export const paginateListTables: ( config: BCMDataExportsPaginationConfiguration, input: ListTablesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTablesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BCMDataExportsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BCMDataExports | BCMDataExportsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BCMDataExportsPaginationConfiguration, + ListTablesCommandInput, + ListTablesCommandOutput +>(BCMDataExportsClient, ListTablesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-bedrock-agent-runtime/src/pagination/RetrievePaginator.ts b/clients/client-bedrock-agent-runtime/src/pagination/RetrievePaginator.ts index a79865b40100..0afa896a2753 100644 --- a/clients/client-bedrock-agent-runtime/src/pagination/RetrievePaginator.ts +++ b/clients/client-bedrock-agent-runtime/src/pagination/RetrievePaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BedrockAgentRuntimeClient } from "../BedrockAgentRuntimeClient"; import { RetrieveCommand, RetrieveCommandInput, RetrieveCommandOutput } from "../commands/RetrieveCommand"; import { BedrockAgentRuntimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BedrockAgentRuntimeClient, - input: RetrieveCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new RetrieveCommand(input), ...args); -}; /** * @public */ -export async function* paginateRetrieve( +export const paginateRetrieve: ( config: BedrockAgentRuntimePaginationConfiguration, input: RetrieveCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: RetrieveCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof BedrockAgentRuntimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BedrockAgentRuntime | BedrockAgentRuntimeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BedrockAgentRuntimePaginationConfiguration, + RetrieveCommandInput, + RetrieveCommandOutput +>(BedrockAgentRuntimeClient, RetrieveCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-bedrock-agent/src/pagination/ListAgentActionGroupsPaginator.ts b/clients/client-bedrock-agent/src/pagination/ListAgentActionGroupsPaginator.ts index 56f9c6afee61..2bf00037b59f 100644 --- a/clients/client-bedrock-agent/src/pagination/ListAgentActionGroupsPaginator.ts +++ b/clients/client-bedrock-agent/src/pagination/ListAgentActionGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BedrockAgentClient } from "../BedrockAgentClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAgentActionGroupsCommand"; import { BedrockAgentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BedrockAgentClient, - input: ListAgentActionGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAgentActionGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAgentActionGroups( +export const paginateListAgentActionGroups: ( config: BedrockAgentPaginationConfiguration, input: ListAgentActionGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAgentActionGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BedrockAgentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BedrockAgent | BedrockAgentClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BedrockAgentPaginationConfiguration, + ListAgentActionGroupsCommandInput, + ListAgentActionGroupsCommandOutput +>(BedrockAgentClient, ListAgentActionGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-bedrock-agent/src/pagination/ListAgentAliasesPaginator.ts b/clients/client-bedrock-agent/src/pagination/ListAgentAliasesPaginator.ts index 9b6093caf33d..6bee8d9259d5 100644 --- a/clients/client-bedrock-agent/src/pagination/ListAgentAliasesPaginator.ts +++ b/clients/client-bedrock-agent/src/pagination/ListAgentAliasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BedrockAgentClient } from "../BedrockAgentClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAgentAliasesCommand"; import { BedrockAgentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BedrockAgentClient, - input: ListAgentAliasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAgentAliasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAgentAliases( +export const paginateListAgentAliases: ( config: BedrockAgentPaginationConfiguration, input: ListAgentAliasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAgentAliasesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BedrockAgentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BedrockAgent | BedrockAgentClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BedrockAgentPaginationConfiguration, + ListAgentAliasesCommandInput, + ListAgentAliasesCommandOutput +>(BedrockAgentClient, ListAgentAliasesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-bedrock-agent/src/pagination/ListAgentKnowledgeBasesPaginator.ts b/clients/client-bedrock-agent/src/pagination/ListAgentKnowledgeBasesPaginator.ts index cda5c35d8337..64fa1aae330f 100644 --- a/clients/client-bedrock-agent/src/pagination/ListAgentKnowledgeBasesPaginator.ts +++ b/clients/client-bedrock-agent/src/pagination/ListAgentKnowledgeBasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BedrockAgentClient } from "../BedrockAgentClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAgentKnowledgeBasesCommand"; import { BedrockAgentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BedrockAgentClient, - input: ListAgentKnowledgeBasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAgentKnowledgeBasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAgentKnowledgeBases( +export const paginateListAgentKnowledgeBases: ( config: BedrockAgentPaginationConfiguration, input: ListAgentKnowledgeBasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAgentKnowledgeBasesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BedrockAgentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BedrockAgent | BedrockAgentClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BedrockAgentPaginationConfiguration, + ListAgentKnowledgeBasesCommandInput, + ListAgentKnowledgeBasesCommandOutput +>(BedrockAgentClient, ListAgentKnowledgeBasesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-bedrock-agent/src/pagination/ListAgentVersionsPaginator.ts b/clients/client-bedrock-agent/src/pagination/ListAgentVersionsPaginator.ts index fe13112b91a2..560077f96b8e 100644 --- a/clients/client-bedrock-agent/src/pagination/ListAgentVersionsPaginator.ts +++ b/clients/client-bedrock-agent/src/pagination/ListAgentVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BedrockAgentClient } from "../BedrockAgentClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAgentVersionsCommand"; import { BedrockAgentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BedrockAgentClient, - input: ListAgentVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAgentVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAgentVersions( +export const paginateListAgentVersions: ( config: BedrockAgentPaginationConfiguration, input: ListAgentVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAgentVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BedrockAgentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BedrockAgent | BedrockAgentClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BedrockAgentPaginationConfiguration, + ListAgentVersionsCommandInput, + ListAgentVersionsCommandOutput +>(BedrockAgentClient, ListAgentVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-bedrock-agent/src/pagination/ListAgentsPaginator.ts b/clients/client-bedrock-agent/src/pagination/ListAgentsPaginator.ts index f08a2e07f698..390952c691d0 100644 --- a/clients/client-bedrock-agent/src/pagination/ListAgentsPaginator.ts +++ b/clients/client-bedrock-agent/src/pagination/ListAgentsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BedrockAgentClient } from "../BedrockAgentClient"; import { ListAgentsCommand, ListAgentsCommandInput, ListAgentsCommandOutput } from "../commands/ListAgentsCommand"; import { BedrockAgentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BedrockAgentClient, - input: ListAgentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAgentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAgents( +export const paginateListAgents: ( config: BedrockAgentPaginationConfiguration, input: ListAgentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAgentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BedrockAgentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BedrockAgent | BedrockAgentClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BedrockAgentPaginationConfiguration, + ListAgentsCommandInput, + ListAgentsCommandOutput +>(BedrockAgentClient, ListAgentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-bedrock-agent/src/pagination/ListDataSourcesPaginator.ts b/clients/client-bedrock-agent/src/pagination/ListDataSourcesPaginator.ts index 28b121a5554f..5f3d7fdec9c4 100644 --- a/clients/client-bedrock-agent/src/pagination/ListDataSourcesPaginator.ts +++ b/clients/client-bedrock-agent/src/pagination/ListDataSourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BedrockAgentClient } from "../BedrockAgentClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListDataSourcesCommand"; import { BedrockAgentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BedrockAgentClient, - input: ListDataSourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataSourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataSources( +export const paginateListDataSources: ( config: BedrockAgentPaginationConfiguration, input: ListDataSourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataSourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BedrockAgentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BedrockAgent | BedrockAgentClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BedrockAgentPaginationConfiguration, + ListDataSourcesCommandInput, + ListDataSourcesCommandOutput +>(BedrockAgentClient, ListDataSourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-bedrock-agent/src/pagination/ListIngestionJobsPaginator.ts b/clients/client-bedrock-agent/src/pagination/ListIngestionJobsPaginator.ts index 72ed06d64b60..d5a4eb568968 100644 --- a/clients/client-bedrock-agent/src/pagination/ListIngestionJobsPaginator.ts +++ b/clients/client-bedrock-agent/src/pagination/ListIngestionJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BedrockAgentClient } from "../BedrockAgentClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListIngestionJobsCommand"; import { BedrockAgentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BedrockAgentClient, - input: ListIngestionJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIngestionJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIngestionJobs( +export const paginateListIngestionJobs: ( config: BedrockAgentPaginationConfiguration, input: ListIngestionJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIngestionJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BedrockAgentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BedrockAgent | BedrockAgentClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BedrockAgentPaginationConfiguration, + ListIngestionJobsCommandInput, + ListIngestionJobsCommandOutput +>(BedrockAgentClient, ListIngestionJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-bedrock-agent/src/pagination/ListKnowledgeBasesPaginator.ts b/clients/client-bedrock-agent/src/pagination/ListKnowledgeBasesPaginator.ts index 6a4900cab037..97b13f408878 100644 --- a/clients/client-bedrock-agent/src/pagination/ListKnowledgeBasesPaginator.ts +++ b/clients/client-bedrock-agent/src/pagination/ListKnowledgeBasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BedrockAgentClient } from "../BedrockAgentClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListKnowledgeBasesCommand"; import { BedrockAgentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BedrockAgentClient, - input: ListKnowledgeBasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKnowledgeBasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKnowledgeBases( +export const paginateListKnowledgeBases: ( config: BedrockAgentPaginationConfiguration, input: ListKnowledgeBasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKnowledgeBasesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BedrockAgentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected BedrockAgent | BedrockAgentClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BedrockAgentPaginationConfiguration, + ListKnowledgeBasesCommandInput, + ListKnowledgeBasesCommandOutput +>(BedrockAgentClient, ListKnowledgeBasesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-bedrock/src/pagination/ListCustomModelsPaginator.ts b/clients/client-bedrock/src/pagination/ListCustomModelsPaginator.ts index 012945120e6b..987c2a8e857c 100644 --- a/clients/client-bedrock/src/pagination/ListCustomModelsPaginator.ts +++ b/clients/client-bedrock/src/pagination/ListCustomModelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BedrockClient } from "../BedrockClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCustomModelsCommand"; import { BedrockPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BedrockClient, - input: ListCustomModelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomModelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomModels( +export const paginateListCustomModels: ( config: BedrockPaginationConfiguration, input: ListCustomModelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomModelsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BedrockClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Bedrock | BedrockClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BedrockPaginationConfiguration, + ListCustomModelsCommandInput, + ListCustomModelsCommandOutput +>(BedrockClient, ListCustomModelsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-bedrock/src/pagination/ListModelCustomizationJobsPaginator.ts b/clients/client-bedrock/src/pagination/ListModelCustomizationJobsPaginator.ts index c8d1594863b0..501d34bd7981 100644 --- a/clients/client-bedrock/src/pagination/ListModelCustomizationJobsPaginator.ts +++ b/clients/client-bedrock/src/pagination/ListModelCustomizationJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BedrockClient } from "../BedrockClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListModelCustomizationJobsCommand"; import { BedrockPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BedrockClient, - input: ListModelCustomizationJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelCustomizationJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModelCustomizationJobs( +export const paginateListModelCustomizationJobs: ( config: BedrockPaginationConfiguration, input: ListModelCustomizationJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelCustomizationJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BedrockClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Bedrock | BedrockClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BedrockPaginationConfiguration, + ListModelCustomizationJobsCommandInput, + ListModelCustomizationJobsCommandOutput +>(BedrockClient, ListModelCustomizationJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-bedrock/src/pagination/ListProvisionedModelThroughputsPaginator.ts b/clients/client-bedrock/src/pagination/ListProvisionedModelThroughputsPaginator.ts index bdfe35df7662..41451da7f6fe 100644 --- a/clients/client-bedrock/src/pagination/ListProvisionedModelThroughputsPaginator.ts +++ b/clients/client-bedrock/src/pagination/ListProvisionedModelThroughputsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BedrockClient } from "../BedrockClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListProvisionedModelThroughputsCommand"; import { BedrockPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BedrockClient, - input: ListProvisionedModelThroughputsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProvisionedModelThroughputsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProvisionedModelThroughputs( +export const paginateListProvisionedModelThroughputs: ( config: BedrockPaginationConfiguration, input: ListProvisionedModelThroughputsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProvisionedModelThroughputsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BedrockClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Bedrock | BedrockClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BedrockPaginationConfiguration, + ListProvisionedModelThroughputsCommandInput, + ListProvisionedModelThroughputsCommandOutput +>(BedrockClient, ListProvisionedModelThroughputsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-billingconductor/src/pagination/GetBillingGroupCostReportPaginator.ts b/clients/client-billingconductor/src/pagination/GetBillingGroupCostReportPaginator.ts index 9da911a7a732..bf3f917852af 100644 --- a/clients/client-billingconductor/src/pagination/GetBillingGroupCostReportPaginator.ts +++ b/clients/client-billingconductor/src/pagination/GetBillingGroupCostReportPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BillingconductorClient } from "../BillingconductorClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetBillingGroupCostReportCommand"; import { BillingconductorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BillingconductorClient, - input: GetBillingGroupCostReportCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetBillingGroupCostReportCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetBillingGroupCostReport( +export const paginateGetBillingGroupCostReport: ( config: BillingconductorPaginationConfiguration, input: GetBillingGroupCostReportCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetBillingGroupCostReportCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BillingconductorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Billingconductor | BillingconductorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BillingconductorPaginationConfiguration, + GetBillingGroupCostReportCommandInput, + GetBillingGroupCostReportCommandOutput +>(BillingconductorClient, GetBillingGroupCostReportCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-billingconductor/src/pagination/ListAccountAssociationsPaginator.ts b/clients/client-billingconductor/src/pagination/ListAccountAssociationsPaginator.ts index e6292ca6d913..bdccc50977b7 100644 --- a/clients/client-billingconductor/src/pagination/ListAccountAssociationsPaginator.ts +++ b/clients/client-billingconductor/src/pagination/ListAccountAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BillingconductorClient } from "../BillingconductorClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListAccountAssociationsCommand"; import { BillingconductorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BillingconductorClient, - input: ListAccountAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccountAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccountAssociations( +export const paginateListAccountAssociations: ( config: BillingconductorPaginationConfiguration, input: ListAccountAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccountAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof BillingconductorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Billingconductor | BillingconductorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BillingconductorPaginationConfiguration, + ListAccountAssociationsCommandInput, + ListAccountAssociationsCommandOutput +>(BillingconductorClient, ListAccountAssociationsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-billingconductor/src/pagination/ListBillingGroupCostReportsPaginator.ts b/clients/client-billingconductor/src/pagination/ListBillingGroupCostReportsPaginator.ts index 4af575a91540..97208ff92820 100644 --- a/clients/client-billingconductor/src/pagination/ListBillingGroupCostReportsPaginator.ts +++ b/clients/client-billingconductor/src/pagination/ListBillingGroupCostReportsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BillingconductorClient } from "../BillingconductorClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListBillingGroupCostReportsCommand"; import { BillingconductorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BillingconductorClient, - input: ListBillingGroupCostReportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBillingGroupCostReportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBillingGroupCostReports( +export const paginateListBillingGroupCostReports: ( config: BillingconductorPaginationConfiguration, input: ListBillingGroupCostReportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBillingGroupCostReportsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BillingconductorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Billingconductor | BillingconductorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BillingconductorPaginationConfiguration, + ListBillingGroupCostReportsCommandInput, + ListBillingGroupCostReportsCommandOutput +>(BillingconductorClient, ListBillingGroupCostReportsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-billingconductor/src/pagination/ListBillingGroupsPaginator.ts b/clients/client-billingconductor/src/pagination/ListBillingGroupsPaginator.ts index 25d485f62cc0..2c1b928654b9 100644 --- a/clients/client-billingconductor/src/pagination/ListBillingGroupsPaginator.ts +++ b/clients/client-billingconductor/src/pagination/ListBillingGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BillingconductorClient } from "../BillingconductorClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListBillingGroupsCommand"; import { BillingconductorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BillingconductorClient, - input: ListBillingGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBillingGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBillingGroups( +export const paginateListBillingGroups: ( config: BillingconductorPaginationConfiguration, input: ListBillingGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBillingGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BillingconductorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Billingconductor | BillingconductorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BillingconductorPaginationConfiguration, + ListBillingGroupsCommandInput, + ListBillingGroupsCommandOutput +>(BillingconductorClient, ListBillingGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-billingconductor/src/pagination/ListCustomLineItemVersionsPaginator.ts b/clients/client-billingconductor/src/pagination/ListCustomLineItemVersionsPaginator.ts index 8f667aaeb190..3ebfaeacf77b 100644 --- a/clients/client-billingconductor/src/pagination/ListCustomLineItemVersionsPaginator.ts +++ b/clients/client-billingconductor/src/pagination/ListCustomLineItemVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BillingconductorClient } from "../BillingconductorClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCustomLineItemVersionsCommand"; import { BillingconductorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BillingconductorClient, - input: ListCustomLineItemVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomLineItemVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomLineItemVersions( +export const paginateListCustomLineItemVersions: ( config: BillingconductorPaginationConfiguration, input: ListCustomLineItemVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomLineItemVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BillingconductorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Billingconductor | BillingconductorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BillingconductorPaginationConfiguration, + ListCustomLineItemVersionsCommandInput, + ListCustomLineItemVersionsCommandOutput +>(BillingconductorClient, ListCustomLineItemVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-billingconductor/src/pagination/ListCustomLineItemsPaginator.ts b/clients/client-billingconductor/src/pagination/ListCustomLineItemsPaginator.ts index ec811271cec4..93b8c79a181b 100644 --- a/clients/client-billingconductor/src/pagination/ListCustomLineItemsPaginator.ts +++ b/clients/client-billingconductor/src/pagination/ListCustomLineItemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BillingconductorClient } from "../BillingconductorClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCustomLineItemsCommand"; import { BillingconductorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BillingconductorClient, - input: ListCustomLineItemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomLineItemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomLineItems( +export const paginateListCustomLineItems: ( config: BillingconductorPaginationConfiguration, input: ListCustomLineItemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomLineItemsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BillingconductorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Billingconductor | BillingconductorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BillingconductorPaginationConfiguration, + ListCustomLineItemsCommandInput, + ListCustomLineItemsCommandOutput +>(BillingconductorClient, ListCustomLineItemsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-billingconductor/src/pagination/ListPricingPlansAssociatedWithPricingRulePaginator.ts b/clients/client-billingconductor/src/pagination/ListPricingPlansAssociatedWithPricingRulePaginator.ts index 29a949160048..5c095603bd50 100644 --- a/clients/client-billingconductor/src/pagination/ListPricingPlansAssociatedWithPricingRulePaginator.ts +++ b/clients/client-billingconductor/src/pagination/ListPricingPlansAssociatedWithPricingRulePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BillingconductorClient } from "../BillingconductorClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPricingPlansAssociatedWithPricingRuleCommand"; import { BillingconductorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BillingconductorClient, - input: ListPricingPlansAssociatedWithPricingRuleCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPricingPlansAssociatedWithPricingRuleCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPricingPlansAssociatedWithPricingRule( +export const paginateListPricingPlansAssociatedWithPricingRule: ( config: BillingconductorPaginationConfiguration, input: ListPricingPlansAssociatedWithPricingRuleCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPricingPlansAssociatedWithPricingRuleCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BillingconductorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Billingconductor | BillingconductorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BillingconductorPaginationConfiguration, + ListPricingPlansAssociatedWithPricingRuleCommandInput, + ListPricingPlansAssociatedWithPricingRuleCommandOutput +>(BillingconductorClient, ListPricingPlansAssociatedWithPricingRuleCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-billingconductor/src/pagination/ListPricingPlansPaginator.ts b/clients/client-billingconductor/src/pagination/ListPricingPlansPaginator.ts index c1698dc140b4..fc65980f25a8 100644 --- a/clients/client-billingconductor/src/pagination/ListPricingPlansPaginator.ts +++ b/clients/client-billingconductor/src/pagination/ListPricingPlansPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BillingconductorClient } from "../BillingconductorClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPricingPlansCommand"; import { BillingconductorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BillingconductorClient, - input: ListPricingPlansCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPricingPlansCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPricingPlans( +export const paginateListPricingPlans: ( config: BillingconductorPaginationConfiguration, input: ListPricingPlansCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPricingPlansCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BillingconductorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Billingconductor | BillingconductorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BillingconductorPaginationConfiguration, + ListPricingPlansCommandInput, + ListPricingPlansCommandOutput +>(BillingconductorClient, ListPricingPlansCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-billingconductor/src/pagination/ListPricingRulesAssociatedToPricingPlanPaginator.ts b/clients/client-billingconductor/src/pagination/ListPricingRulesAssociatedToPricingPlanPaginator.ts index cb363809739f..94efc57bc7c0 100644 --- a/clients/client-billingconductor/src/pagination/ListPricingRulesAssociatedToPricingPlanPaginator.ts +++ b/clients/client-billingconductor/src/pagination/ListPricingRulesAssociatedToPricingPlanPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BillingconductorClient } from "../BillingconductorClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPricingRulesAssociatedToPricingPlanCommand"; import { BillingconductorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BillingconductorClient, - input: ListPricingRulesAssociatedToPricingPlanCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPricingRulesAssociatedToPricingPlanCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPricingRulesAssociatedToPricingPlan( +export const paginateListPricingRulesAssociatedToPricingPlan: ( config: BillingconductorPaginationConfiguration, input: ListPricingRulesAssociatedToPricingPlanCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPricingRulesAssociatedToPricingPlanCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BillingconductorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Billingconductor | BillingconductorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BillingconductorPaginationConfiguration, + ListPricingRulesAssociatedToPricingPlanCommandInput, + ListPricingRulesAssociatedToPricingPlanCommandOutput +>(BillingconductorClient, ListPricingRulesAssociatedToPricingPlanCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-billingconductor/src/pagination/ListPricingRulesPaginator.ts b/clients/client-billingconductor/src/pagination/ListPricingRulesPaginator.ts index e54d806b8963..235ab73384f9 100644 --- a/clients/client-billingconductor/src/pagination/ListPricingRulesPaginator.ts +++ b/clients/client-billingconductor/src/pagination/ListPricingRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BillingconductorClient } from "../BillingconductorClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPricingRulesCommand"; import { BillingconductorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BillingconductorClient, - input: ListPricingRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPricingRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPricingRules( +export const paginateListPricingRules: ( config: BillingconductorPaginationConfiguration, input: ListPricingRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPricingRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BillingconductorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Billingconductor | BillingconductorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BillingconductorPaginationConfiguration, + ListPricingRulesCommandInput, + ListPricingRulesCommandOutput +>(BillingconductorClient, ListPricingRulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-billingconductor/src/pagination/ListResourcesAssociatedToCustomLineItemPaginator.ts b/clients/client-billingconductor/src/pagination/ListResourcesAssociatedToCustomLineItemPaginator.ts index cb61e24e10eb..848c22750244 100644 --- a/clients/client-billingconductor/src/pagination/ListResourcesAssociatedToCustomLineItemPaginator.ts +++ b/clients/client-billingconductor/src/pagination/ListResourcesAssociatedToCustomLineItemPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BillingconductorClient } from "../BillingconductorClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListResourcesAssociatedToCustomLineItemCommand"; import { BillingconductorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BillingconductorClient, - input: ListResourcesAssociatedToCustomLineItemCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourcesAssociatedToCustomLineItemCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourcesAssociatedToCustomLineItem( +export const paginateListResourcesAssociatedToCustomLineItem: ( config: BillingconductorPaginationConfiguration, input: ListResourcesAssociatedToCustomLineItemCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourcesAssociatedToCustomLineItemCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BillingconductorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Billingconductor | BillingconductorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BillingconductorPaginationConfiguration, + ListResourcesAssociatedToCustomLineItemCommandInput, + ListResourcesAssociatedToCustomLineItemCommandOutput +>(BillingconductorClient, ListResourcesAssociatedToCustomLineItemCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-braket/src/pagination/SearchDevicesPaginator.ts b/clients/client-braket/src/pagination/SearchDevicesPaginator.ts index 138695b4564a..611b8fd87820 100644 --- a/clients/client-braket/src/pagination/SearchDevicesPaginator.ts +++ b/clients/client-braket/src/pagination/SearchDevicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BraketClient } from "../BraketClient"; @@ -9,42 +10,15 @@ import { } from "../commands/SearchDevicesCommand"; import { BraketPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BraketClient, - input: SearchDevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchDevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchDevices( +export const paginateSearchDevices: ( config: BraketPaginationConfiguration, input: SearchDevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchDevicesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BraketClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Braket | BraketClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BraketPaginationConfiguration, + SearchDevicesCommandInput, + SearchDevicesCommandOutput +>(BraketClient, SearchDevicesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-braket/src/pagination/SearchJobsPaginator.ts b/clients/client-braket/src/pagination/SearchJobsPaginator.ts index 92d47ce8edfc..854cce3a5a1b 100644 --- a/clients/client-braket/src/pagination/SearchJobsPaginator.ts +++ b/clients/client-braket/src/pagination/SearchJobsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BraketClient } from "../BraketClient"; import { SearchJobsCommand, SearchJobsCommandInput, SearchJobsCommandOutput } from "../commands/SearchJobsCommand"; import { BraketPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BraketClient, - input: SearchJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchJobs( +export const paginateSearchJobs: ( config: BraketPaginationConfiguration, input: SearchJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BraketClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Braket | BraketClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BraketPaginationConfiguration, + SearchJobsCommandInput, + SearchJobsCommandOutput +>(BraketClient, SearchJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-braket/src/pagination/SearchQuantumTasksPaginator.ts b/clients/client-braket/src/pagination/SearchQuantumTasksPaginator.ts index 7ae5e9657fc0..d7617ba3dd9f 100644 --- a/clients/client-braket/src/pagination/SearchQuantumTasksPaginator.ts +++ b/clients/client-braket/src/pagination/SearchQuantumTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BraketClient } from "../BraketClient"; @@ -9,42 +10,15 @@ import { } from "../commands/SearchQuantumTasksCommand"; import { BraketPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BraketClient, - input: SearchQuantumTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchQuantumTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchQuantumTasks( +export const paginateSearchQuantumTasks: ( config: BraketPaginationConfiguration, input: SearchQuantumTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchQuantumTasksCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof BraketClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Braket | BraketClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BraketPaginationConfiguration, + SearchQuantumTasksCommandInput, + SearchQuantumTasksCommandOutput +>(BraketClient, SearchQuantumTasksCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-budgets/package.json b/clients/client-budgets/package.json index de4d482ef9af..4ed9cf7fd953 100644 --- a/clients/client-budgets/package.json +++ b/clients/client-budgets/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-budgets/src/pagination/DescribeBudgetActionHistoriesPaginator.ts b/clients/client-budgets/src/pagination/DescribeBudgetActionHistoriesPaginator.ts index a5cff306ec4c..f0f7752a9d0b 100644 --- a/clients/client-budgets/src/pagination/DescribeBudgetActionHistoriesPaginator.ts +++ b/clients/client-budgets/src/pagination/DescribeBudgetActionHistoriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BudgetsClient } from "../BudgetsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeBudgetActionHistoriesCommand"; import { BudgetsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BudgetsClient, - input: DescribeBudgetActionHistoriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeBudgetActionHistoriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeBudgetActionHistories( +export const paginateDescribeBudgetActionHistories: ( config: BudgetsPaginationConfiguration, input: DescribeBudgetActionHistoriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeBudgetActionHistoriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BudgetsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Budgets | BudgetsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BudgetsPaginationConfiguration, + DescribeBudgetActionHistoriesCommandInput, + DescribeBudgetActionHistoriesCommandOutput +>(BudgetsClient, DescribeBudgetActionHistoriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-budgets/src/pagination/DescribeBudgetActionsForAccountPaginator.ts b/clients/client-budgets/src/pagination/DescribeBudgetActionsForAccountPaginator.ts index e56e47cbd7fc..983971a42059 100644 --- a/clients/client-budgets/src/pagination/DescribeBudgetActionsForAccountPaginator.ts +++ b/clients/client-budgets/src/pagination/DescribeBudgetActionsForAccountPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BudgetsClient } from "../BudgetsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeBudgetActionsForAccountCommand"; import { BudgetsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BudgetsClient, - input: DescribeBudgetActionsForAccountCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeBudgetActionsForAccountCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeBudgetActionsForAccount( +export const paginateDescribeBudgetActionsForAccount: ( config: BudgetsPaginationConfiguration, input: DescribeBudgetActionsForAccountCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeBudgetActionsForAccountCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BudgetsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Budgets | BudgetsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BudgetsPaginationConfiguration, + DescribeBudgetActionsForAccountCommandInput, + DescribeBudgetActionsForAccountCommandOutput +>(BudgetsClient, DescribeBudgetActionsForAccountCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-budgets/src/pagination/DescribeBudgetActionsForBudgetPaginator.ts b/clients/client-budgets/src/pagination/DescribeBudgetActionsForBudgetPaginator.ts index 1c21bb8f9a81..dd51f5ebb0de 100644 --- a/clients/client-budgets/src/pagination/DescribeBudgetActionsForBudgetPaginator.ts +++ b/clients/client-budgets/src/pagination/DescribeBudgetActionsForBudgetPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BudgetsClient } from "../BudgetsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeBudgetActionsForBudgetCommand"; import { BudgetsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BudgetsClient, - input: DescribeBudgetActionsForBudgetCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeBudgetActionsForBudgetCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeBudgetActionsForBudget( +export const paginateDescribeBudgetActionsForBudget: ( config: BudgetsPaginationConfiguration, input: DescribeBudgetActionsForBudgetCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeBudgetActionsForBudgetCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BudgetsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Budgets | BudgetsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BudgetsPaginationConfiguration, + DescribeBudgetActionsForBudgetCommandInput, + DescribeBudgetActionsForBudgetCommandOutput +>(BudgetsClient, DescribeBudgetActionsForBudgetCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-budgets/src/pagination/DescribeBudgetNotificationsForAccountPaginator.ts b/clients/client-budgets/src/pagination/DescribeBudgetNotificationsForAccountPaginator.ts index 77f4f3af5af6..6d8e316c02eb 100644 --- a/clients/client-budgets/src/pagination/DescribeBudgetNotificationsForAccountPaginator.ts +++ b/clients/client-budgets/src/pagination/DescribeBudgetNotificationsForAccountPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BudgetsClient } from "../BudgetsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeBudgetNotificationsForAccountCommand"; import { BudgetsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BudgetsClient, - input: DescribeBudgetNotificationsForAccountCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeBudgetNotificationsForAccountCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeBudgetNotificationsForAccount( +export const paginateDescribeBudgetNotificationsForAccount: ( config: BudgetsPaginationConfiguration, input: DescribeBudgetNotificationsForAccountCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeBudgetNotificationsForAccountCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BudgetsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Budgets | BudgetsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BudgetsPaginationConfiguration, + DescribeBudgetNotificationsForAccountCommandInput, + DescribeBudgetNotificationsForAccountCommandOutput +>(BudgetsClient, DescribeBudgetNotificationsForAccountCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-budgets/src/pagination/DescribeBudgetPerformanceHistoryPaginator.ts b/clients/client-budgets/src/pagination/DescribeBudgetPerformanceHistoryPaginator.ts index f95d6cb69e75..a433d60bc89a 100644 --- a/clients/client-budgets/src/pagination/DescribeBudgetPerformanceHistoryPaginator.ts +++ b/clients/client-budgets/src/pagination/DescribeBudgetPerformanceHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BudgetsClient } from "../BudgetsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeBudgetPerformanceHistoryCommand"; import { BudgetsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BudgetsClient, - input: DescribeBudgetPerformanceHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeBudgetPerformanceHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeBudgetPerformanceHistory( +export const paginateDescribeBudgetPerformanceHistory: ( config: BudgetsPaginationConfiguration, input: DescribeBudgetPerformanceHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeBudgetPerformanceHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BudgetsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Budgets | BudgetsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BudgetsPaginationConfiguration, + DescribeBudgetPerformanceHistoryCommandInput, + DescribeBudgetPerformanceHistoryCommandOutput +>(BudgetsClient, DescribeBudgetPerformanceHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-budgets/src/pagination/DescribeBudgetsPaginator.ts b/clients/client-budgets/src/pagination/DescribeBudgetsPaginator.ts index 931ec1565617..2191c7a3a676 100644 --- a/clients/client-budgets/src/pagination/DescribeBudgetsPaginator.ts +++ b/clients/client-budgets/src/pagination/DescribeBudgetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BudgetsClient } from "../BudgetsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeBudgetsCommand"; import { BudgetsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BudgetsClient, - input: DescribeBudgetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeBudgetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeBudgets( +export const paginateDescribeBudgets: ( config: BudgetsPaginationConfiguration, input: DescribeBudgetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeBudgetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BudgetsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Budgets | BudgetsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BudgetsPaginationConfiguration, + DescribeBudgetsCommandInput, + DescribeBudgetsCommandOutput +>(BudgetsClient, DescribeBudgetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-budgets/src/pagination/DescribeNotificationsForBudgetPaginator.ts b/clients/client-budgets/src/pagination/DescribeNotificationsForBudgetPaginator.ts index 312bf0c7839c..57472b6f5d6e 100644 --- a/clients/client-budgets/src/pagination/DescribeNotificationsForBudgetPaginator.ts +++ b/clients/client-budgets/src/pagination/DescribeNotificationsForBudgetPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BudgetsClient } from "../BudgetsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeNotificationsForBudgetCommand"; import { BudgetsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BudgetsClient, - input: DescribeNotificationsForBudgetCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeNotificationsForBudgetCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeNotificationsForBudget( +export const paginateDescribeNotificationsForBudget: ( config: BudgetsPaginationConfiguration, input: DescribeNotificationsForBudgetCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeNotificationsForBudgetCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BudgetsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Budgets | BudgetsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BudgetsPaginationConfiguration, + DescribeNotificationsForBudgetCommandInput, + DescribeNotificationsForBudgetCommandOutput +>(BudgetsClient, DescribeNotificationsForBudgetCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-budgets/src/pagination/DescribeSubscribersForNotificationPaginator.ts b/clients/client-budgets/src/pagination/DescribeSubscribersForNotificationPaginator.ts index f21726cabfef..596fb47df530 100644 --- a/clients/client-budgets/src/pagination/DescribeSubscribersForNotificationPaginator.ts +++ b/clients/client-budgets/src/pagination/DescribeSubscribersForNotificationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { BudgetsClient } from "../BudgetsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeSubscribersForNotificationCommand"; import { BudgetsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: BudgetsClient, - input: DescribeSubscribersForNotificationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSubscribersForNotificationCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSubscribersForNotification( +export const paginateDescribeSubscribersForNotification: ( config: BudgetsPaginationConfiguration, input: DescribeSubscribersForNotificationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSubscribersForNotificationCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof BudgetsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Budgets | BudgetsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + BudgetsPaginationConfiguration, + DescribeSubscribersForNotificationCommandInput, + DescribeSubscribersForNotificationCommandOutput +>(BudgetsClient, DescribeSubscribersForNotificationCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceAdminsPaginator.ts b/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceAdminsPaginator.ts index dbeb5815f9ba..98267b3ebe22 100644 --- a/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceAdminsPaginator.ts +++ b/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceAdminsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKIdentityClient } from "../ChimeSDKIdentityClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAppInstanceAdminsCommand"; import { ChimeSDKIdentityPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKIdentityClient, - input: ListAppInstanceAdminsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppInstanceAdminsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppInstanceAdmins( +export const paginateListAppInstanceAdmins: ( config: ChimeSDKIdentityPaginationConfiguration, input: ListAppInstanceAdminsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppInstanceAdminsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKIdentityClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKIdentity | ChimeSDKIdentityClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKIdentityPaginationConfiguration, + ListAppInstanceAdminsCommandInput, + ListAppInstanceAdminsCommandOutput +>(ChimeSDKIdentityClient, ListAppInstanceAdminsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceBotsPaginator.ts b/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceBotsPaginator.ts index ecb22f56bc52..5fdc70fa9b6f 100644 --- a/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceBotsPaginator.ts +++ b/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceBotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKIdentityClient } from "../ChimeSDKIdentityClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAppInstanceBotsCommand"; import { ChimeSDKIdentityPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKIdentityClient, - input: ListAppInstanceBotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppInstanceBotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppInstanceBots( +export const paginateListAppInstanceBots: ( config: ChimeSDKIdentityPaginationConfiguration, input: ListAppInstanceBotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppInstanceBotsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKIdentityClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKIdentity | ChimeSDKIdentityClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKIdentityPaginationConfiguration, + ListAppInstanceBotsCommandInput, + ListAppInstanceBotsCommandOutput +>(ChimeSDKIdentityClient, ListAppInstanceBotsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceUserEndpointsPaginator.ts b/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceUserEndpointsPaginator.ts index 019d31521ca7..d60b2820be58 100644 --- a/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceUserEndpointsPaginator.ts +++ b/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceUserEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKIdentityClient } from "../ChimeSDKIdentityClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAppInstanceUserEndpointsCommand"; import { ChimeSDKIdentityPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKIdentityClient, - input: ListAppInstanceUserEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppInstanceUserEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppInstanceUserEndpoints( +export const paginateListAppInstanceUserEndpoints: ( config: ChimeSDKIdentityPaginationConfiguration, input: ListAppInstanceUserEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppInstanceUserEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKIdentityClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKIdentity | ChimeSDKIdentityClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKIdentityPaginationConfiguration, + ListAppInstanceUserEndpointsCommandInput, + ListAppInstanceUserEndpointsCommandOutput +>(ChimeSDKIdentityClient, ListAppInstanceUserEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceUsersPaginator.ts b/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceUsersPaginator.ts index 61b9b1bc3beb..5179171ce5b4 100644 --- a/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceUsersPaginator.ts +++ b/clients/client-chime-sdk-identity/src/pagination/ListAppInstanceUsersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKIdentityClient } from "../ChimeSDKIdentityClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAppInstanceUsersCommand"; import { ChimeSDKIdentityPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKIdentityClient, - input: ListAppInstanceUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppInstanceUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppInstanceUsers( +export const paginateListAppInstanceUsers: ( config: ChimeSDKIdentityPaginationConfiguration, input: ListAppInstanceUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppInstanceUsersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKIdentityClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKIdentity | ChimeSDKIdentityClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKIdentityPaginationConfiguration, + ListAppInstanceUsersCommandInput, + ListAppInstanceUsersCommandOutput +>(ChimeSDKIdentityClient, ListAppInstanceUsersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-identity/src/pagination/ListAppInstancesPaginator.ts b/clients/client-chime-sdk-identity/src/pagination/ListAppInstancesPaginator.ts index 21b7acc607aa..18bce5328b73 100644 --- a/clients/client-chime-sdk-identity/src/pagination/ListAppInstancesPaginator.ts +++ b/clients/client-chime-sdk-identity/src/pagination/ListAppInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKIdentityClient } from "../ChimeSDKIdentityClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAppInstancesCommand"; import { ChimeSDKIdentityPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKIdentityClient, - input: ListAppInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppInstances( +export const paginateListAppInstances: ( config: ChimeSDKIdentityPaginationConfiguration, input: ListAppInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKIdentityClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKIdentity | ChimeSDKIdentityClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKIdentityPaginationConfiguration, + ListAppInstancesCommandInput, + ListAppInstancesCommandOutput +>(ChimeSDKIdentityClient, ListAppInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaCapturePipelinesPaginator.ts b/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaCapturePipelinesPaginator.ts index 30dd7667f71c..5c4f0e75736b 100644 --- a/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaCapturePipelinesPaginator.ts +++ b/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaCapturePipelinesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMediaPipelinesClient } from "../ChimeSDKMediaPipelinesClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListMediaCapturePipelinesCommand"; import { ChimeSDKMediaPipelinesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMediaPipelinesClient, - input: ListMediaCapturePipelinesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMediaCapturePipelinesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMediaCapturePipelines( +export const paginateListMediaCapturePipelines: ( config: ChimeSDKMediaPipelinesPaginationConfiguration, input: ListMediaCapturePipelinesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMediaCapturePipelinesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMediaPipelinesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMediaPipelines | ChimeSDKMediaPipelinesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMediaPipelinesPaginationConfiguration, + ListMediaCapturePipelinesCommandInput, + ListMediaCapturePipelinesCommandOutput +>(ChimeSDKMediaPipelinesClient, ListMediaCapturePipelinesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaInsightsPipelineConfigurationsPaginator.ts b/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaInsightsPipelineConfigurationsPaginator.ts index 9ad9555dec72..72f6a715a79f 100644 --- a/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaInsightsPipelineConfigurationsPaginator.ts +++ b/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaInsightsPipelineConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMediaPipelinesClient } from "../ChimeSDKMediaPipelinesClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListMediaInsightsPipelineConfigurationsCommand"; import { ChimeSDKMediaPipelinesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMediaPipelinesClient, - input: ListMediaInsightsPipelineConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMediaInsightsPipelineConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMediaInsightsPipelineConfigurations( +export const paginateListMediaInsightsPipelineConfigurations: ( config: ChimeSDKMediaPipelinesPaginationConfiguration, input: ListMediaInsightsPipelineConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMediaInsightsPipelineConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMediaPipelinesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMediaPipelines | ChimeSDKMediaPipelinesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMediaPipelinesPaginationConfiguration, + ListMediaInsightsPipelineConfigurationsCommandInput, + ListMediaInsightsPipelineConfigurationsCommandOutput +>(ChimeSDKMediaPipelinesClient, ListMediaInsightsPipelineConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaPipelineKinesisVideoStreamPoolsPaginator.ts b/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaPipelineKinesisVideoStreamPoolsPaginator.ts index 0dd2499d51fe..e644e41a7649 100644 --- a/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaPipelineKinesisVideoStreamPoolsPaginator.ts +++ b/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaPipelineKinesisVideoStreamPoolsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMediaPipelinesClient } from "../ChimeSDKMediaPipelinesClient"; @@ -9,42 +10,21 @@ import { } from "../commands/ListMediaPipelineKinesisVideoStreamPoolsCommand"; import { ChimeSDKMediaPipelinesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMediaPipelinesClient, - input: ListMediaPipelineKinesisVideoStreamPoolsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMediaPipelineKinesisVideoStreamPoolsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMediaPipelineKinesisVideoStreamPools( +export const paginateListMediaPipelineKinesisVideoStreamPools: ( config: ChimeSDKMediaPipelinesPaginationConfiguration, input: ListMediaPipelineKinesisVideoStreamPoolsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMediaPipelineKinesisVideoStreamPoolsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMediaPipelinesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMediaPipelines | ChimeSDKMediaPipelinesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMediaPipelinesPaginationConfiguration, + ListMediaPipelineKinesisVideoStreamPoolsCommandInput, + ListMediaPipelineKinesisVideoStreamPoolsCommandOutput +>( + ChimeSDKMediaPipelinesClient, + ListMediaPipelineKinesisVideoStreamPoolsCommand, + "NextToken", + "NextToken", + "MaxResults" +); diff --git a/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaPipelinesPaginator.ts b/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaPipelinesPaginator.ts index 349fd56c5af6..03ec8228331b 100644 --- a/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaPipelinesPaginator.ts +++ b/clients/client-chime-sdk-media-pipelines/src/pagination/ListMediaPipelinesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMediaPipelinesClient } from "../ChimeSDKMediaPipelinesClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListMediaPipelinesCommand"; import { ChimeSDKMediaPipelinesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMediaPipelinesClient, - input: ListMediaPipelinesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMediaPipelinesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMediaPipelines( +export const paginateListMediaPipelines: ( config: ChimeSDKMediaPipelinesPaginationConfiguration, input: ListMediaPipelinesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMediaPipelinesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMediaPipelinesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMediaPipelines | ChimeSDKMediaPipelinesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMediaPipelinesPaginationConfiguration, + ListMediaPipelinesCommandInput, + ListMediaPipelinesCommandOutput +>(ChimeSDKMediaPipelinesClient, ListMediaPipelinesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-meetings/src/pagination/ListAttendeesPaginator.ts b/clients/client-chime-sdk-meetings/src/pagination/ListAttendeesPaginator.ts index 1a3e36ed0092..c98585380563 100644 --- a/clients/client-chime-sdk-meetings/src/pagination/ListAttendeesPaginator.ts +++ b/clients/client-chime-sdk-meetings/src/pagination/ListAttendeesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMeetingsClient } from "../ChimeSDKMeetingsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAttendeesCommand"; import { ChimeSDKMeetingsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMeetingsClient, - input: ListAttendeesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAttendeesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAttendees( +export const paginateListAttendees: ( config: ChimeSDKMeetingsPaginationConfiguration, input: ListAttendeesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAttendeesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMeetingsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMeetings | ChimeSDKMeetingsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMeetingsPaginationConfiguration, + ListAttendeesCommandInput, + ListAttendeesCommandOutput +>(ChimeSDKMeetingsClient, ListAttendeesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-messaging/src/pagination/ListChannelBansPaginator.ts b/clients/client-chime-sdk-messaging/src/pagination/ListChannelBansPaginator.ts index 2a773de8c50d..9cb259ef5928 100644 --- a/clients/client-chime-sdk-messaging/src/pagination/ListChannelBansPaginator.ts +++ b/clients/client-chime-sdk-messaging/src/pagination/ListChannelBansPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMessagingClient } from "../ChimeSDKMessagingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelBansCommand"; import { ChimeSDKMessagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMessagingClient, - input: ListChannelBansCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelBansCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelBans( +export const paginateListChannelBans: ( config: ChimeSDKMessagingPaginationConfiguration, input: ListChannelBansCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelBansCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMessagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMessagingPaginationConfiguration, + ListChannelBansCommandInput, + ListChannelBansCommandOutput +>(ChimeSDKMessagingClient, ListChannelBansCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-messaging/src/pagination/ListChannelFlowsPaginator.ts b/clients/client-chime-sdk-messaging/src/pagination/ListChannelFlowsPaginator.ts index e5e507e34b58..f58e3b2abfb7 100644 --- a/clients/client-chime-sdk-messaging/src/pagination/ListChannelFlowsPaginator.ts +++ b/clients/client-chime-sdk-messaging/src/pagination/ListChannelFlowsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMessagingClient } from "../ChimeSDKMessagingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelFlowsCommand"; import { ChimeSDKMessagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMessagingClient, - input: ListChannelFlowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelFlowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelFlows( +export const paginateListChannelFlows: ( config: ChimeSDKMessagingPaginationConfiguration, input: ListChannelFlowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelFlowsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMessagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMessagingPaginationConfiguration, + ListChannelFlowsCommandInput, + ListChannelFlowsCommandOutput +>(ChimeSDKMessagingClient, ListChannelFlowsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-messaging/src/pagination/ListChannelMembershipsForAppInstanceUserPaginator.ts b/clients/client-chime-sdk-messaging/src/pagination/ListChannelMembershipsForAppInstanceUserPaginator.ts index d56fa3c36a74..54701ef96316 100644 --- a/clients/client-chime-sdk-messaging/src/pagination/ListChannelMembershipsForAppInstanceUserPaginator.ts +++ b/clients/client-chime-sdk-messaging/src/pagination/ListChannelMembershipsForAppInstanceUserPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMessagingClient } from "../ChimeSDKMessagingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelMembershipsForAppInstanceUserCommand"; import { ChimeSDKMessagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMessagingClient, - input: ListChannelMembershipsForAppInstanceUserCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelMembershipsForAppInstanceUserCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelMembershipsForAppInstanceUser( +export const paginateListChannelMembershipsForAppInstanceUser: ( config: ChimeSDKMessagingPaginationConfiguration, input: ListChannelMembershipsForAppInstanceUserCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelMembershipsForAppInstanceUserCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMessagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMessagingPaginationConfiguration, + ListChannelMembershipsForAppInstanceUserCommandInput, + ListChannelMembershipsForAppInstanceUserCommandOutput +>(ChimeSDKMessagingClient, ListChannelMembershipsForAppInstanceUserCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-messaging/src/pagination/ListChannelMembershipsPaginator.ts b/clients/client-chime-sdk-messaging/src/pagination/ListChannelMembershipsPaginator.ts index b253cf110bb3..f5983765d6dc 100644 --- a/clients/client-chime-sdk-messaging/src/pagination/ListChannelMembershipsPaginator.ts +++ b/clients/client-chime-sdk-messaging/src/pagination/ListChannelMembershipsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMessagingClient } from "../ChimeSDKMessagingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelMembershipsCommand"; import { ChimeSDKMessagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMessagingClient, - input: ListChannelMembershipsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelMembershipsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelMemberships( +export const paginateListChannelMemberships: ( config: ChimeSDKMessagingPaginationConfiguration, input: ListChannelMembershipsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelMembershipsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMessagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMessagingPaginationConfiguration, + ListChannelMembershipsCommandInput, + ListChannelMembershipsCommandOutput +>(ChimeSDKMessagingClient, ListChannelMembershipsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-messaging/src/pagination/ListChannelMessagesPaginator.ts b/clients/client-chime-sdk-messaging/src/pagination/ListChannelMessagesPaginator.ts index abe8f4c234a7..54a4fb521bbe 100644 --- a/clients/client-chime-sdk-messaging/src/pagination/ListChannelMessagesPaginator.ts +++ b/clients/client-chime-sdk-messaging/src/pagination/ListChannelMessagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMessagingClient } from "../ChimeSDKMessagingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelMessagesCommand"; import { ChimeSDKMessagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMessagingClient, - input: ListChannelMessagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelMessagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelMessages( +export const paginateListChannelMessages: ( config: ChimeSDKMessagingPaginationConfiguration, input: ListChannelMessagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelMessagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMessagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMessagingPaginationConfiguration, + ListChannelMessagesCommandInput, + ListChannelMessagesCommandOutput +>(ChimeSDKMessagingClient, ListChannelMessagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-messaging/src/pagination/ListChannelModeratorsPaginator.ts b/clients/client-chime-sdk-messaging/src/pagination/ListChannelModeratorsPaginator.ts index 2c4ffbfce774..68296e96744c 100644 --- a/clients/client-chime-sdk-messaging/src/pagination/ListChannelModeratorsPaginator.ts +++ b/clients/client-chime-sdk-messaging/src/pagination/ListChannelModeratorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMessagingClient } from "../ChimeSDKMessagingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelModeratorsCommand"; import { ChimeSDKMessagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMessagingClient, - input: ListChannelModeratorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelModeratorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelModerators( +export const paginateListChannelModerators: ( config: ChimeSDKMessagingPaginationConfiguration, input: ListChannelModeratorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelModeratorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMessagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMessagingPaginationConfiguration, + ListChannelModeratorsCommandInput, + ListChannelModeratorsCommandOutput +>(ChimeSDKMessagingClient, ListChannelModeratorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-messaging/src/pagination/ListChannelsAssociatedWithChannelFlowPaginator.ts b/clients/client-chime-sdk-messaging/src/pagination/ListChannelsAssociatedWithChannelFlowPaginator.ts index 9fc057f5ce3c..f6af39488e4d 100644 --- a/clients/client-chime-sdk-messaging/src/pagination/ListChannelsAssociatedWithChannelFlowPaginator.ts +++ b/clients/client-chime-sdk-messaging/src/pagination/ListChannelsAssociatedWithChannelFlowPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMessagingClient } from "../ChimeSDKMessagingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelsAssociatedWithChannelFlowCommand"; import { ChimeSDKMessagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMessagingClient, - input: ListChannelsAssociatedWithChannelFlowCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelsAssociatedWithChannelFlowCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelsAssociatedWithChannelFlow( +export const paginateListChannelsAssociatedWithChannelFlow: ( config: ChimeSDKMessagingPaginationConfiguration, input: ListChannelsAssociatedWithChannelFlowCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelsAssociatedWithChannelFlowCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMessagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMessagingPaginationConfiguration, + ListChannelsAssociatedWithChannelFlowCommandInput, + ListChannelsAssociatedWithChannelFlowCommandOutput +>(ChimeSDKMessagingClient, ListChannelsAssociatedWithChannelFlowCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-messaging/src/pagination/ListChannelsModeratedByAppInstanceUserPaginator.ts b/clients/client-chime-sdk-messaging/src/pagination/ListChannelsModeratedByAppInstanceUserPaginator.ts index 664a1367a33b..9d8e0a21ff47 100644 --- a/clients/client-chime-sdk-messaging/src/pagination/ListChannelsModeratedByAppInstanceUserPaginator.ts +++ b/clients/client-chime-sdk-messaging/src/pagination/ListChannelsModeratedByAppInstanceUserPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMessagingClient } from "../ChimeSDKMessagingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelsModeratedByAppInstanceUserCommand"; import { ChimeSDKMessagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMessagingClient, - input: ListChannelsModeratedByAppInstanceUserCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelsModeratedByAppInstanceUserCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelsModeratedByAppInstanceUser( +export const paginateListChannelsModeratedByAppInstanceUser: ( config: ChimeSDKMessagingPaginationConfiguration, input: ListChannelsModeratedByAppInstanceUserCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelsModeratedByAppInstanceUserCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMessagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMessagingPaginationConfiguration, + ListChannelsModeratedByAppInstanceUserCommandInput, + ListChannelsModeratedByAppInstanceUserCommandOutput +>(ChimeSDKMessagingClient, ListChannelsModeratedByAppInstanceUserCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-messaging/src/pagination/ListChannelsPaginator.ts b/clients/client-chime-sdk-messaging/src/pagination/ListChannelsPaginator.ts index 43d723c21cfc..5ef3b30841cc 100644 --- a/clients/client-chime-sdk-messaging/src/pagination/ListChannelsPaginator.ts +++ b/clients/client-chime-sdk-messaging/src/pagination/ListChannelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMessagingClient } from "../ChimeSDKMessagingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelsCommand"; import { ChimeSDKMessagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMessagingClient, - input: ListChannelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannels( +export const paginateListChannels: ( config: ChimeSDKMessagingPaginationConfiguration, input: ListChannelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMessagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMessagingPaginationConfiguration, + ListChannelsCommandInput, + ListChannelsCommandOutput +>(ChimeSDKMessagingClient, ListChannelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-messaging/src/pagination/ListSubChannelsPaginator.ts b/clients/client-chime-sdk-messaging/src/pagination/ListSubChannelsPaginator.ts index 9bd85d8a14d4..02fcc203fb0f 100644 --- a/clients/client-chime-sdk-messaging/src/pagination/ListSubChannelsPaginator.ts +++ b/clients/client-chime-sdk-messaging/src/pagination/ListSubChannelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMessagingClient } from "../ChimeSDKMessagingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSubChannelsCommand"; import { ChimeSDKMessagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMessagingClient, - input: ListSubChannelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSubChannelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSubChannels( +export const paginateListSubChannels: ( config: ChimeSDKMessagingPaginationConfiguration, input: ListSubChannelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSubChannelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMessagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMessagingPaginationConfiguration, + ListSubChannelsCommandInput, + ListSubChannelsCommandOutput +>(ChimeSDKMessagingClient, ListSubChannelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-messaging/src/pagination/SearchChannelsPaginator.ts b/clients/client-chime-sdk-messaging/src/pagination/SearchChannelsPaginator.ts index 6725ad0c4130..5947eae62b9b 100644 --- a/clients/client-chime-sdk-messaging/src/pagination/SearchChannelsPaginator.ts +++ b/clients/client-chime-sdk-messaging/src/pagination/SearchChannelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKMessagingClient } from "../ChimeSDKMessagingClient"; @@ -9,42 +10,15 @@ import { } from "../commands/SearchChannelsCommand"; import { ChimeSDKMessagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKMessagingClient, - input: SearchChannelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchChannelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchChannels( +export const paginateSearchChannels: ( config: ChimeSDKMessagingPaginationConfiguration, input: SearchChannelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchChannelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKMessagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKMessaging | ChimeSDKMessagingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKMessagingPaginationConfiguration, + SearchChannelsCommandInput, + SearchChannelsCommandOutput +>(ChimeSDKMessagingClient, SearchChannelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-voice/src/pagination/ListPhoneNumberOrdersPaginator.ts b/clients/client-chime-sdk-voice/src/pagination/ListPhoneNumberOrdersPaginator.ts index 73423c4bd424..1b05c78c228b 100644 --- a/clients/client-chime-sdk-voice/src/pagination/ListPhoneNumberOrdersPaginator.ts +++ b/clients/client-chime-sdk-voice/src/pagination/ListPhoneNumberOrdersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKVoiceClient } from "../ChimeSDKVoiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPhoneNumberOrdersCommand"; import { ChimeSDKVoicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKVoiceClient, - input: ListPhoneNumberOrdersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPhoneNumberOrdersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPhoneNumberOrders( +export const paginateListPhoneNumberOrders: ( config: ChimeSDKVoicePaginationConfiguration, input: ListPhoneNumberOrdersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPhoneNumberOrdersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKVoiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKVoice | ChimeSDKVoiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKVoicePaginationConfiguration, + ListPhoneNumberOrdersCommandInput, + ListPhoneNumberOrdersCommandOutput +>(ChimeSDKVoiceClient, ListPhoneNumberOrdersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-voice/src/pagination/ListPhoneNumbersPaginator.ts b/clients/client-chime-sdk-voice/src/pagination/ListPhoneNumbersPaginator.ts index 5da1f61f158b..807a5b33814a 100644 --- a/clients/client-chime-sdk-voice/src/pagination/ListPhoneNumbersPaginator.ts +++ b/clients/client-chime-sdk-voice/src/pagination/ListPhoneNumbersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKVoiceClient } from "../ChimeSDKVoiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPhoneNumbersCommand"; import { ChimeSDKVoicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKVoiceClient, - input: ListPhoneNumbersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPhoneNumbersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPhoneNumbers( +export const paginateListPhoneNumbers: ( config: ChimeSDKVoicePaginationConfiguration, input: ListPhoneNumbersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPhoneNumbersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKVoiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKVoice | ChimeSDKVoiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKVoicePaginationConfiguration, + ListPhoneNumbersCommandInput, + ListPhoneNumbersCommandOutput +>(ChimeSDKVoiceClient, ListPhoneNumbersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-voice/src/pagination/ListProxySessionsPaginator.ts b/clients/client-chime-sdk-voice/src/pagination/ListProxySessionsPaginator.ts index 0868fe4e966c..14449249110c 100644 --- a/clients/client-chime-sdk-voice/src/pagination/ListProxySessionsPaginator.ts +++ b/clients/client-chime-sdk-voice/src/pagination/ListProxySessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKVoiceClient } from "../ChimeSDKVoiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListProxySessionsCommand"; import { ChimeSDKVoicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKVoiceClient, - input: ListProxySessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProxySessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProxySessions( +export const paginateListProxySessions: ( config: ChimeSDKVoicePaginationConfiguration, input: ListProxySessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProxySessionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKVoiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKVoice | ChimeSDKVoiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKVoicePaginationConfiguration, + ListProxySessionsCommandInput, + ListProxySessionsCommandOutput +>(ChimeSDKVoiceClient, ListProxySessionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-voice/src/pagination/ListSipMediaApplicationsPaginator.ts b/clients/client-chime-sdk-voice/src/pagination/ListSipMediaApplicationsPaginator.ts index 5f160b2775b1..6f834721db9c 100644 --- a/clients/client-chime-sdk-voice/src/pagination/ListSipMediaApplicationsPaginator.ts +++ b/clients/client-chime-sdk-voice/src/pagination/ListSipMediaApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKVoiceClient } from "../ChimeSDKVoiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSipMediaApplicationsCommand"; import { ChimeSDKVoicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKVoiceClient, - input: ListSipMediaApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSipMediaApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSipMediaApplications( +export const paginateListSipMediaApplications: ( config: ChimeSDKVoicePaginationConfiguration, input: ListSipMediaApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSipMediaApplicationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKVoiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKVoice | ChimeSDKVoiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKVoicePaginationConfiguration, + ListSipMediaApplicationsCommandInput, + ListSipMediaApplicationsCommandOutput +>(ChimeSDKVoiceClient, ListSipMediaApplicationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-voice/src/pagination/ListSipRulesPaginator.ts b/clients/client-chime-sdk-voice/src/pagination/ListSipRulesPaginator.ts index cf353ba9862b..be8a1fd5f323 100644 --- a/clients/client-chime-sdk-voice/src/pagination/ListSipRulesPaginator.ts +++ b/clients/client-chime-sdk-voice/src/pagination/ListSipRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKVoiceClient } from "../ChimeSDKVoiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSipRulesCommand"; import { ChimeSDKVoicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKVoiceClient, - input: ListSipRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSipRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSipRules( +export const paginateListSipRules: ( config: ChimeSDKVoicePaginationConfiguration, input: ListSipRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSipRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKVoiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKVoice | ChimeSDKVoiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKVoicePaginationConfiguration, + ListSipRulesCommandInput, + ListSipRulesCommandOutput +>(ChimeSDKVoiceClient, ListSipRulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-voice/src/pagination/ListVoiceConnectorGroupsPaginator.ts b/clients/client-chime-sdk-voice/src/pagination/ListVoiceConnectorGroupsPaginator.ts index 253d3a49a4d2..df3ded424969 100644 --- a/clients/client-chime-sdk-voice/src/pagination/ListVoiceConnectorGroupsPaginator.ts +++ b/clients/client-chime-sdk-voice/src/pagination/ListVoiceConnectorGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKVoiceClient } from "../ChimeSDKVoiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListVoiceConnectorGroupsCommand"; import { ChimeSDKVoicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKVoiceClient, - input: ListVoiceConnectorGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVoiceConnectorGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVoiceConnectorGroups( +export const paginateListVoiceConnectorGroups: ( config: ChimeSDKVoicePaginationConfiguration, input: ListVoiceConnectorGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVoiceConnectorGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKVoiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKVoice | ChimeSDKVoiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKVoicePaginationConfiguration, + ListVoiceConnectorGroupsCommandInput, + ListVoiceConnectorGroupsCommandOutput +>(ChimeSDKVoiceClient, ListVoiceConnectorGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-voice/src/pagination/ListVoiceConnectorsPaginator.ts b/clients/client-chime-sdk-voice/src/pagination/ListVoiceConnectorsPaginator.ts index 9e3b45932226..ceb34e893e6e 100644 --- a/clients/client-chime-sdk-voice/src/pagination/ListVoiceConnectorsPaginator.ts +++ b/clients/client-chime-sdk-voice/src/pagination/ListVoiceConnectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKVoiceClient } from "../ChimeSDKVoiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListVoiceConnectorsCommand"; import { ChimeSDKVoicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKVoiceClient, - input: ListVoiceConnectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVoiceConnectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVoiceConnectors( +export const paginateListVoiceConnectors: ( config: ChimeSDKVoicePaginationConfiguration, input: ListVoiceConnectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVoiceConnectorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKVoiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKVoice | ChimeSDKVoiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKVoicePaginationConfiguration, + ListVoiceConnectorsCommandInput, + ListVoiceConnectorsCommandOutput +>(ChimeSDKVoiceClient, ListVoiceConnectorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-voice/src/pagination/ListVoiceProfileDomainsPaginator.ts b/clients/client-chime-sdk-voice/src/pagination/ListVoiceProfileDomainsPaginator.ts index a573bdb4d750..c5f67d1173fa 100644 --- a/clients/client-chime-sdk-voice/src/pagination/ListVoiceProfileDomainsPaginator.ts +++ b/clients/client-chime-sdk-voice/src/pagination/ListVoiceProfileDomainsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKVoiceClient } from "../ChimeSDKVoiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListVoiceProfileDomainsCommand"; import { ChimeSDKVoicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKVoiceClient, - input: ListVoiceProfileDomainsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVoiceProfileDomainsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVoiceProfileDomains( +export const paginateListVoiceProfileDomains: ( config: ChimeSDKVoicePaginationConfiguration, input: ListVoiceProfileDomainsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVoiceProfileDomainsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKVoiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKVoice | ChimeSDKVoiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKVoicePaginationConfiguration, + ListVoiceProfileDomainsCommandInput, + ListVoiceProfileDomainsCommandOutput +>(ChimeSDKVoiceClient, ListVoiceProfileDomainsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-voice/src/pagination/ListVoiceProfilesPaginator.ts b/clients/client-chime-sdk-voice/src/pagination/ListVoiceProfilesPaginator.ts index afd3bfafbc44..6c93e8036667 100644 --- a/clients/client-chime-sdk-voice/src/pagination/ListVoiceProfilesPaginator.ts +++ b/clients/client-chime-sdk-voice/src/pagination/ListVoiceProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKVoiceClient } from "../ChimeSDKVoiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListVoiceProfilesCommand"; import { ChimeSDKVoicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKVoiceClient, - input: ListVoiceProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVoiceProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVoiceProfiles( +export const paginateListVoiceProfiles: ( config: ChimeSDKVoicePaginationConfiguration, input: ListVoiceProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVoiceProfilesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKVoiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKVoice | ChimeSDKVoiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKVoicePaginationConfiguration, + ListVoiceProfilesCommandInput, + ListVoiceProfilesCommandOutput +>(ChimeSDKVoiceClient, ListVoiceProfilesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime-sdk-voice/src/pagination/SearchAvailablePhoneNumbersPaginator.ts b/clients/client-chime-sdk-voice/src/pagination/SearchAvailablePhoneNumbersPaginator.ts index 8fad377125d3..94028316a71e 100644 --- a/clients/client-chime-sdk-voice/src/pagination/SearchAvailablePhoneNumbersPaginator.ts +++ b/clients/client-chime-sdk-voice/src/pagination/SearchAvailablePhoneNumbersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeSDKVoiceClient } from "../ChimeSDKVoiceClient"; @@ -9,42 +10,15 @@ import { } from "../commands/SearchAvailablePhoneNumbersCommand"; import { ChimeSDKVoicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeSDKVoiceClient, - input: SearchAvailablePhoneNumbersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchAvailablePhoneNumbersCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchAvailablePhoneNumbers( +export const paginateSearchAvailablePhoneNumbers: ( config: ChimeSDKVoicePaginationConfiguration, input: SearchAvailablePhoneNumbersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchAvailablePhoneNumbersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeSDKVoiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ChimeSDKVoice | ChimeSDKVoiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimeSDKVoicePaginationConfiguration, + SearchAvailablePhoneNumbersCommandInput, + SearchAvailablePhoneNumbersCommandOutput +>(ChimeSDKVoiceClient, SearchAvailablePhoneNumbersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListAccountsPaginator.ts b/clients/client-chime/src/pagination/ListAccountsPaginator.ts index bf9fee7b0363..0436a807c2d4 100644 --- a/clients/client-chime/src/pagination/ListAccountsPaginator.ts +++ b/clients/client-chime/src/pagination/ListAccountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAccountsCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListAccountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccounts( +export const paginateListAccounts: ( config: ChimePaginationConfiguration, input: ListAccountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccountsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListAccountsCommandInput, + ListAccountsCommandOutput +>(ChimeClient, ListAccountsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListAppInstanceAdminsPaginator.ts b/clients/client-chime/src/pagination/ListAppInstanceAdminsPaginator.ts index 813143706536..84cf5fb0fb01 100644 --- a/clients/client-chime/src/pagination/ListAppInstanceAdminsPaginator.ts +++ b/clients/client-chime/src/pagination/ListAppInstanceAdminsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAppInstanceAdminsCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListAppInstanceAdminsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppInstanceAdminsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppInstanceAdmins( +export const paginateListAppInstanceAdmins: ( config: ChimePaginationConfiguration, input: ListAppInstanceAdminsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppInstanceAdminsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListAppInstanceAdminsCommandInput, + ListAppInstanceAdminsCommandOutput +>(ChimeClient, ListAppInstanceAdminsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListAppInstanceUsersPaginator.ts b/clients/client-chime/src/pagination/ListAppInstanceUsersPaginator.ts index cf9b13f7c0b3..7b1f7778498f 100644 --- a/clients/client-chime/src/pagination/ListAppInstanceUsersPaginator.ts +++ b/clients/client-chime/src/pagination/ListAppInstanceUsersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAppInstanceUsersCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListAppInstanceUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppInstanceUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppInstanceUsers( +export const paginateListAppInstanceUsers: ( config: ChimePaginationConfiguration, input: ListAppInstanceUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppInstanceUsersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListAppInstanceUsersCommandInput, + ListAppInstanceUsersCommandOutput +>(ChimeClient, ListAppInstanceUsersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListAppInstancesPaginator.ts b/clients/client-chime/src/pagination/ListAppInstancesPaginator.ts index 993169cb5671..ab30f715cdc4 100644 --- a/clients/client-chime/src/pagination/ListAppInstancesPaginator.ts +++ b/clients/client-chime/src/pagination/ListAppInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAppInstancesCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListAppInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppInstances( +export const paginateListAppInstances: ( config: ChimePaginationConfiguration, input: ListAppInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListAppInstancesCommandInput, + ListAppInstancesCommandOutput +>(ChimeClient, ListAppInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListAttendeesPaginator.ts b/clients/client-chime/src/pagination/ListAttendeesPaginator.ts index f187b9f1bbac..0b40ed2ef806 100644 --- a/clients/client-chime/src/pagination/ListAttendeesPaginator.ts +++ b/clients/client-chime/src/pagination/ListAttendeesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAttendeesCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListAttendeesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAttendeesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAttendees( +export const paginateListAttendees: ( config: ChimePaginationConfiguration, input: ListAttendeesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAttendeesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListAttendeesCommandInput, + ListAttendeesCommandOutput +>(ChimeClient, ListAttendeesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListBotsPaginator.ts b/clients/client-chime/src/pagination/ListBotsPaginator.ts index 3c8c0fc90e89..2d49cab2a7b0 100644 --- a/clients/client-chime/src/pagination/ListBotsPaginator.ts +++ b/clients/client-chime/src/pagination/ListBotsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; import { ListBotsCommand, ListBotsCommandInput, ListBotsCommandOutput } from "../commands/ListBotsCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListBotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBots( +export const paginateListBots: ( config: ChimePaginationConfiguration, input: ListBotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBotsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListBotsCommandInput, + ListBotsCommandOutput +>(ChimeClient, ListBotsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListChannelBansPaginator.ts b/clients/client-chime/src/pagination/ListChannelBansPaginator.ts index d51c5ec59e49..5fe7521343b7 100644 --- a/clients/client-chime/src/pagination/ListChannelBansPaginator.ts +++ b/clients/client-chime/src/pagination/ListChannelBansPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelBansCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListChannelBansCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelBansCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelBans( +export const paginateListChannelBans: ( config: ChimePaginationConfiguration, input: ListChannelBansCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelBansCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListChannelBansCommandInput, + ListChannelBansCommandOutput +>(ChimeClient, ListChannelBansCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListChannelMembershipsForAppInstanceUserPaginator.ts b/clients/client-chime/src/pagination/ListChannelMembershipsForAppInstanceUserPaginator.ts index 46de9974108f..5e00031f4ab9 100644 --- a/clients/client-chime/src/pagination/ListChannelMembershipsForAppInstanceUserPaginator.ts +++ b/clients/client-chime/src/pagination/ListChannelMembershipsForAppInstanceUserPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelMembershipsForAppInstanceUserCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListChannelMembershipsForAppInstanceUserCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelMembershipsForAppInstanceUserCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelMembershipsForAppInstanceUser( +export const paginateListChannelMembershipsForAppInstanceUser: ( config: ChimePaginationConfiguration, input: ListChannelMembershipsForAppInstanceUserCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelMembershipsForAppInstanceUserCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListChannelMembershipsForAppInstanceUserCommandInput, + ListChannelMembershipsForAppInstanceUserCommandOutput +>(ChimeClient, ListChannelMembershipsForAppInstanceUserCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListChannelMembershipsPaginator.ts b/clients/client-chime/src/pagination/ListChannelMembershipsPaginator.ts index 2d7c935fe8b7..44928fd10d9a 100644 --- a/clients/client-chime/src/pagination/ListChannelMembershipsPaginator.ts +++ b/clients/client-chime/src/pagination/ListChannelMembershipsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelMembershipsCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListChannelMembershipsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelMembershipsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelMemberships( +export const paginateListChannelMemberships: ( config: ChimePaginationConfiguration, input: ListChannelMembershipsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelMembershipsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListChannelMembershipsCommandInput, + ListChannelMembershipsCommandOutput +>(ChimeClient, ListChannelMembershipsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListChannelMessagesPaginator.ts b/clients/client-chime/src/pagination/ListChannelMessagesPaginator.ts index f3cc0943d9e8..f675d3025e8f 100644 --- a/clients/client-chime/src/pagination/ListChannelMessagesPaginator.ts +++ b/clients/client-chime/src/pagination/ListChannelMessagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelMessagesCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListChannelMessagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelMessagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelMessages( +export const paginateListChannelMessages: ( config: ChimePaginationConfiguration, input: ListChannelMessagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelMessagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListChannelMessagesCommandInput, + ListChannelMessagesCommandOutput +>(ChimeClient, ListChannelMessagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListChannelModeratorsPaginator.ts b/clients/client-chime/src/pagination/ListChannelModeratorsPaginator.ts index ff5be22a7366..748d2f9605a7 100644 --- a/clients/client-chime/src/pagination/ListChannelModeratorsPaginator.ts +++ b/clients/client-chime/src/pagination/ListChannelModeratorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelModeratorsCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListChannelModeratorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelModeratorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelModerators( +export const paginateListChannelModerators: ( config: ChimePaginationConfiguration, input: ListChannelModeratorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelModeratorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListChannelModeratorsCommandInput, + ListChannelModeratorsCommandOutput +>(ChimeClient, ListChannelModeratorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListChannelsModeratedByAppInstanceUserPaginator.ts b/clients/client-chime/src/pagination/ListChannelsModeratedByAppInstanceUserPaginator.ts index 0ccbb1054b14..faa2f0e80980 100644 --- a/clients/client-chime/src/pagination/ListChannelsModeratedByAppInstanceUserPaginator.ts +++ b/clients/client-chime/src/pagination/ListChannelsModeratedByAppInstanceUserPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelsModeratedByAppInstanceUserCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListChannelsModeratedByAppInstanceUserCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelsModeratedByAppInstanceUserCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelsModeratedByAppInstanceUser( +export const paginateListChannelsModeratedByAppInstanceUser: ( config: ChimePaginationConfiguration, input: ListChannelsModeratedByAppInstanceUserCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelsModeratedByAppInstanceUserCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListChannelsModeratedByAppInstanceUserCommandInput, + ListChannelsModeratedByAppInstanceUserCommandOutput +>(ChimeClient, ListChannelsModeratedByAppInstanceUserCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListChannelsPaginator.ts b/clients/client-chime/src/pagination/ListChannelsPaginator.ts index bbf5ed2bdf89..50d54f071549 100644 --- a/clients/client-chime/src/pagination/ListChannelsPaginator.ts +++ b/clients/client-chime/src/pagination/ListChannelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelsCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListChannelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannels( +export const paginateListChannels: ( config: ChimePaginationConfiguration, input: ListChannelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListChannelsCommandInput, + ListChannelsCommandOutput +>(ChimeClient, ListChannelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListMediaCapturePipelinesPaginator.ts b/clients/client-chime/src/pagination/ListMediaCapturePipelinesPaginator.ts index a677a370a25f..bad727f3ba44 100644 --- a/clients/client-chime/src/pagination/ListMediaCapturePipelinesPaginator.ts +++ b/clients/client-chime/src/pagination/ListMediaCapturePipelinesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListMediaCapturePipelinesCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListMediaCapturePipelinesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMediaCapturePipelinesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMediaCapturePipelines( +export const paginateListMediaCapturePipelines: ( config: ChimePaginationConfiguration, input: ListMediaCapturePipelinesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMediaCapturePipelinesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListMediaCapturePipelinesCommandInput, + ListMediaCapturePipelinesCommandOutput +>(ChimeClient, ListMediaCapturePipelinesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListMeetingsPaginator.ts b/clients/client-chime/src/pagination/ListMeetingsPaginator.ts index d309cb0155ec..465a62c7547a 100644 --- a/clients/client-chime/src/pagination/ListMeetingsPaginator.ts +++ b/clients/client-chime/src/pagination/ListMeetingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListMeetingsCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListMeetingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMeetingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMeetings( +export const paginateListMeetings: ( config: ChimePaginationConfiguration, input: ListMeetingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMeetingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListMeetingsCommandInput, + ListMeetingsCommandOutput +>(ChimeClient, ListMeetingsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListPhoneNumberOrdersPaginator.ts b/clients/client-chime/src/pagination/ListPhoneNumberOrdersPaginator.ts index de4de01b5800..1cfbffd364ea 100644 --- a/clients/client-chime/src/pagination/ListPhoneNumberOrdersPaginator.ts +++ b/clients/client-chime/src/pagination/ListPhoneNumberOrdersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPhoneNumberOrdersCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListPhoneNumberOrdersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPhoneNumberOrdersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPhoneNumberOrders( +export const paginateListPhoneNumberOrders: ( config: ChimePaginationConfiguration, input: ListPhoneNumberOrdersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPhoneNumberOrdersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListPhoneNumberOrdersCommandInput, + ListPhoneNumberOrdersCommandOutput +>(ChimeClient, ListPhoneNumberOrdersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListPhoneNumbersPaginator.ts b/clients/client-chime/src/pagination/ListPhoneNumbersPaginator.ts index 3456b13f46bf..42bf73b5a28c 100644 --- a/clients/client-chime/src/pagination/ListPhoneNumbersPaginator.ts +++ b/clients/client-chime/src/pagination/ListPhoneNumbersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPhoneNumbersCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListPhoneNumbersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPhoneNumbersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPhoneNumbers( +export const paginateListPhoneNumbers: ( config: ChimePaginationConfiguration, input: ListPhoneNumbersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPhoneNumbersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListPhoneNumbersCommandInput, + ListPhoneNumbersCommandOutput +>(ChimeClient, ListPhoneNumbersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListProxySessionsPaginator.ts b/clients/client-chime/src/pagination/ListProxySessionsPaginator.ts index 5ca8d63fc00a..d2bf729ce9f3 100644 --- a/clients/client-chime/src/pagination/ListProxySessionsPaginator.ts +++ b/clients/client-chime/src/pagination/ListProxySessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListProxySessionsCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListProxySessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProxySessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProxySessions( +export const paginateListProxySessions: ( config: ChimePaginationConfiguration, input: ListProxySessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProxySessionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListProxySessionsCommandInput, + ListProxySessionsCommandOutput +>(ChimeClient, ListProxySessionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListRoomMembershipsPaginator.ts b/clients/client-chime/src/pagination/ListRoomMembershipsPaginator.ts index b57ec14635f5..13fc98c860a6 100644 --- a/clients/client-chime/src/pagination/ListRoomMembershipsPaginator.ts +++ b/clients/client-chime/src/pagination/ListRoomMembershipsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRoomMembershipsCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListRoomMembershipsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRoomMembershipsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRoomMemberships( +export const paginateListRoomMemberships: ( config: ChimePaginationConfiguration, input: ListRoomMembershipsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRoomMembershipsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListRoomMembershipsCommandInput, + ListRoomMembershipsCommandOutput +>(ChimeClient, ListRoomMembershipsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListRoomsPaginator.ts b/clients/client-chime/src/pagination/ListRoomsPaginator.ts index 040df49c7710..ee5e5374b29a 100644 --- a/clients/client-chime/src/pagination/ListRoomsPaginator.ts +++ b/clients/client-chime/src/pagination/ListRoomsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; import { ListRoomsCommand, ListRoomsCommandInput, ListRoomsCommandOutput } from "../commands/ListRoomsCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListRoomsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRoomsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRooms( +export const paginateListRooms: ( config: ChimePaginationConfiguration, input: ListRoomsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRoomsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListRoomsCommandInput, + ListRoomsCommandOutput +>(ChimeClient, ListRoomsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListSipMediaApplicationsPaginator.ts b/clients/client-chime/src/pagination/ListSipMediaApplicationsPaginator.ts index 90ae34bb1701..0c1fb36d1450 100644 --- a/clients/client-chime/src/pagination/ListSipMediaApplicationsPaginator.ts +++ b/clients/client-chime/src/pagination/ListSipMediaApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSipMediaApplicationsCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListSipMediaApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSipMediaApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSipMediaApplications( +export const paginateListSipMediaApplications: ( config: ChimePaginationConfiguration, input: ListSipMediaApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSipMediaApplicationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListSipMediaApplicationsCommandInput, + ListSipMediaApplicationsCommandOutput +>(ChimeClient, ListSipMediaApplicationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListSipRulesPaginator.ts b/clients/client-chime/src/pagination/ListSipRulesPaginator.ts index 76fe131e18b1..848b2dc76ba0 100644 --- a/clients/client-chime/src/pagination/ListSipRulesPaginator.ts +++ b/clients/client-chime/src/pagination/ListSipRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSipRulesCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListSipRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSipRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSipRules( +export const paginateListSipRules: ( config: ChimePaginationConfiguration, input: ListSipRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSipRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListSipRulesCommandInput, + ListSipRulesCommandOutput +>(ChimeClient, ListSipRulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListUsersPaginator.ts b/clients/client-chime/src/pagination/ListUsersPaginator.ts index 812af1fbc04d..fb6d6dcf5e7c 100644 --- a/clients/client-chime/src/pagination/ListUsersPaginator.ts +++ b/clients/client-chime/src/pagination/ListUsersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; import { ListUsersCommand, ListUsersCommandInput, ListUsersCommandOutput } from "../commands/ListUsersCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUsers( +export const paginateListUsers: ( config: ChimePaginationConfiguration, input: ListUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUsersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListUsersCommandInput, + ListUsersCommandOutput +>(ChimeClient, ListUsersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListVoiceConnectorGroupsPaginator.ts b/clients/client-chime/src/pagination/ListVoiceConnectorGroupsPaginator.ts index 3753206c46c6..339a38baf3b8 100644 --- a/clients/client-chime/src/pagination/ListVoiceConnectorGroupsPaginator.ts +++ b/clients/client-chime/src/pagination/ListVoiceConnectorGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListVoiceConnectorGroupsCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListVoiceConnectorGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVoiceConnectorGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVoiceConnectorGroups( +export const paginateListVoiceConnectorGroups: ( config: ChimePaginationConfiguration, input: ListVoiceConnectorGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVoiceConnectorGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListVoiceConnectorGroupsCommandInput, + ListVoiceConnectorGroupsCommandOutput +>(ChimeClient, ListVoiceConnectorGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/ListVoiceConnectorsPaginator.ts b/clients/client-chime/src/pagination/ListVoiceConnectorsPaginator.ts index f3a924941a17..baa300933c38 100644 --- a/clients/client-chime/src/pagination/ListVoiceConnectorsPaginator.ts +++ b/clients/client-chime/src/pagination/ListVoiceConnectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListVoiceConnectorsCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: ListVoiceConnectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVoiceConnectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVoiceConnectors( +export const paginateListVoiceConnectors: ( config: ChimePaginationConfiguration, input: ListVoiceConnectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVoiceConnectorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + ListVoiceConnectorsCommandInput, + ListVoiceConnectorsCommandOutput +>(ChimeClient, ListVoiceConnectorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-chime/src/pagination/SearchAvailablePhoneNumbersPaginator.ts b/clients/client-chime/src/pagination/SearchAvailablePhoneNumbersPaginator.ts index 1f6f7a7e58e2..442d3a4072e5 100644 --- a/clients/client-chime/src/pagination/SearchAvailablePhoneNumbersPaginator.ts +++ b/clients/client-chime/src/pagination/SearchAvailablePhoneNumbersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ChimeClient } from "../ChimeClient"; @@ -9,42 +10,15 @@ import { } from "../commands/SearchAvailablePhoneNumbersCommand"; import { ChimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ChimeClient, - input: SearchAvailablePhoneNumbersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchAvailablePhoneNumbersCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchAvailablePhoneNumbers( +export const paginateSearchAvailablePhoneNumbers: ( config: ChimePaginationConfiguration, input: SearchAvailablePhoneNumbersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchAvailablePhoneNumbersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ChimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Chime | ChimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ChimePaginationConfiguration, + SearchAvailablePhoneNumbersCommandInput, + SearchAvailablePhoneNumbersCommandOutput +>(ChimeClient, SearchAvailablePhoneNumbersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cleanrooms/src/pagination/ListAnalysisTemplatesPaginator.ts b/clients/client-cleanrooms/src/pagination/ListAnalysisTemplatesPaginator.ts index c0fe5d8955cc..bb6cdf1cd7ed 100644 --- a/clients/client-cleanrooms/src/pagination/ListAnalysisTemplatesPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListAnalysisTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAnalysisTemplatesCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListAnalysisTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnalysisTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnalysisTemplates( +export const paginateListAnalysisTemplates: ( config: CleanRoomsPaginationConfiguration, input: ListAnalysisTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnalysisTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListAnalysisTemplatesCommandInput, + ListAnalysisTemplatesCommandOutput +>(CleanRoomsClient, ListAnalysisTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanrooms/src/pagination/ListCollaborationAnalysisTemplatesPaginator.ts b/clients/client-cleanrooms/src/pagination/ListCollaborationAnalysisTemplatesPaginator.ts index 13f986c330bf..59a8951b78e2 100644 --- a/clients/client-cleanrooms/src/pagination/ListCollaborationAnalysisTemplatesPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListCollaborationAnalysisTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCollaborationAnalysisTemplatesCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListCollaborationAnalysisTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCollaborationAnalysisTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCollaborationAnalysisTemplates( +export const paginateListCollaborationAnalysisTemplates: ( config: CleanRoomsPaginationConfiguration, input: ListCollaborationAnalysisTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCollaborationAnalysisTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListCollaborationAnalysisTemplatesCommandInput, + ListCollaborationAnalysisTemplatesCommandOutput +>(CleanRoomsClient, ListCollaborationAnalysisTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanrooms/src/pagination/ListCollaborationConfiguredAudienceModelAssociationsPaginator.ts b/clients/client-cleanrooms/src/pagination/ListCollaborationConfiguredAudienceModelAssociationsPaginator.ts index 3e4781b6c452..1057d78c1148 100644 --- a/clients/client-cleanrooms/src/pagination/ListCollaborationConfiguredAudienceModelAssociationsPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListCollaborationConfiguredAudienceModelAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; @@ -9,42 +10,21 @@ import { } from "../commands/ListCollaborationConfiguredAudienceModelAssociationsCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListCollaborationConfiguredAudienceModelAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCollaborationConfiguredAudienceModelAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCollaborationConfiguredAudienceModelAssociations( +export const paginateListCollaborationConfiguredAudienceModelAssociations: ( config: CleanRoomsPaginationConfiguration, input: ListCollaborationConfiguredAudienceModelAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCollaborationConfiguredAudienceModelAssociationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListCollaborationConfiguredAudienceModelAssociationsCommandInput, + ListCollaborationConfiguredAudienceModelAssociationsCommandOutput +>( + CleanRoomsClient, + ListCollaborationConfiguredAudienceModelAssociationsCommand, + "nextToken", + "nextToken", + "maxResults" +); diff --git a/clients/client-cleanrooms/src/pagination/ListCollaborationPrivacyBudgetTemplatesPaginator.ts b/clients/client-cleanrooms/src/pagination/ListCollaborationPrivacyBudgetTemplatesPaginator.ts index 02cb74c1b8ab..88352a5ec231 100644 --- a/clients/client-cleanrooms/src/pagination/ListCollaborationPrivacyBudgetTemplatesPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListCollaborationPrivacyBudgetTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCollaborationPrivacyBudgetTemplatesCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListCollaborationPrivacyBudgetTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCollaborationPrivacyBudgetTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCollaborationPrivacyBudgetTemplates( +export const paginateListCollaborationPrivacyBudgetTemplates: ( config: CleanRoomsPaginationConfiguration, input: ListCollaborationPrivacyBudgetTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCollaborationPrivacyBudgetTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListCollaborationPrivacyBudgetTemplatesCommandInput, + ListCollaborationPrivacyBudgetTemplatesCommandOutput +>(CleanRoomsClient, ListCollaborationPrivacyBudgetTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanrooms/src/pagination/ListCollaborationPrivacyBudgetsPaginator.ts b/clients/client-cleanrooms/src/pagination/ListCollaborationPrivacyBudgetsPaginator.ts index 8d66494702dc..d1d2f8ca306e 100644 --- a/clients/client-cleanrooms/src/pagination/ListCollaborationPrivacyBudgetsPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListCollaborationPrivacyBudgetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCollaborationPrivacyBudgetsCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListCollaborationPrivacyBudgetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCollaborationPrivacyBudgetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCollaborationPrivacyBudgets( +export const paginateListCollaborationPrivacyBudgets: ( config: CleanRoomsPaginationConfiguration, input: ListCollaborationPrivacyBudgetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCollaborationPrivacyBudgetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListCollaborationPrivacyBudgetsCommandInput, + ListCollaborationPrivacyBudgetsCommandOutput +>(CleanRoomsClient, ListCollaborationPrivacyBudgetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanrooms/src/pagination/ListCollaborationsPaginator.ts b/clients/client-cleanrooms/src/pagination/ListCollaborationsPaginator.ts index d4195747adba..5cc935a243c1 100644 --- a/clients/client-cleanrooms/src/pagination/ListCollaborationsPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListCollaborationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCollaborationsCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListCollaborationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCollaborationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCollaborations( +export const paginateListCollaborations: ( config: CleanRoomsPaginationConfiguration, input: ListCollaborationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCollaborationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListCollaborationsCommandInput, + ListCollaborationsCommandOutput +>(CleanRoomsClient, ListCollaborationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanrooms/src/pagination/ListConfiguredAudienceModelAssociationsPaginator.ts b/clients/client-cleanrooms/src/pagination/ListConfiguredAudienceModelAssociationsPaginator.ts index 5f37f1854a2b..80aea30743fd 100644 --- a/clients/client-cleanrooms/src/pagination/ListConfiguredAudienceModelAssociationsPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListConfiguredAudienceModelAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListConfiguredAudienceModelAssociationsCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListConfiguredAudienceModelAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConfiguredAudienceModelAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConfiguredAudienceModelAssociations( +export const paginateListConfiguredAudienceModelAssociations: ( config: CleanRoomsPaginationConfiguration, input: ListConfiguredAudienceModelAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConfiguredAudienceModelAssociationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListConfiguredAudienceModelAssociationsCommandInput, + ListConfiguredAudienceModelAssociationsCommandOutput +>(CleanRoomsClient, ListConfiguredAudienceModelAssociationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanrooms/src/pagination/ListConfiguredTableAssociationsPaginator.ts b/clients/client-cleanrooms/src/pagination/ListConfiguredTableAssociationsPaginator.ts index 8965c7f4ee12..eb0da9f76b8f 100644 --- a/clients/client-cleanrooms/src/pagination/ListConfiguredTableAssociationsPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListConfiguredTableAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListConfiguredTableAssociationsCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListConfiguredTableAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConfiguredTableAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConfiguredTableAssociations( +export const paginateListConfiguredTableAssociations: ( config: CleanRoomsPaginationConfiguration, input: ListConfiguredTableAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConfiguredTableAssociationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListConfiguredTableAssociationsCommandInput, + ListConfiguredTableAssociationsCommandOutput +>(CleanRoomsClient, ListConfiguredTableAssociationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanrooms/src/pagination/ListConfiguredTablesPaginator.ts b/clients/client-cleanrooms/src/pagination/ListConfiguredTablesPaginator.ts index a867a7ff7096..8757b93ef39b 100644 --- a/clients/client-cleanrooms/src/pagination/ListConfiguredTablesPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListConfiguredTablesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListConfiguredTablesCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListConfiguredTablesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConfiguredTablesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConfiguredTables( +export const paginateListConfiguredTables: ( config: CleanRoomsPaginationConfiguration, input: ListConfiguredTablesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConfiguredTablesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListConfiguredTablesCommandInput, + ListConfiguredTablesCommandOutput +>(CleanRoomsClient, ListConfiguredTablesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanrooms/src/pagination/ListMembersPaginator.ts b/clients/client-cleanrooms/src/pagination/ListMembersPaginator.ts index 21811aedaf81..41ea220024ba 100644 --- a/clients/client-cleanrooms/src/pagination/ListMembersPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListMembersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; import { ListMembersCommand, ListMembersCommandInput, ListMembersCommandOutput } from "../commands/ListMembersCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListMembersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMembersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMembers( +export const paginateListMembers: ( config: CleanRoomsPaginationConfiguration, input: ListMembersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMembersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListMembersCommandInput, + ListMembersCommandOutput +>(CleanRoomsClient, ListMembersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanrooms/src/pagination/ListMembershipsPaginator.ts b/clients/client-cleanrooms/src/pagination/ListMembershipsPaginator.ts index 56f1c77b7fef..fec911c187ef 100644 --- a/clients/client-cleanrooms/src/pagination/ListMembershipsPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListMembershipsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListMembershipsCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListMembershipsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMembershipsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMemberships( +export const paginateListMemberships: ( config: CleanRoomsPaginationConfiguration, input: ListMembershipsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMembershipsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListMembershipsCommandInput, + ListMembershipsCommandOutput +>(CleanRoomsClient, ListMembershipsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanrooms/src/pagination/ListPrivacyBudgetTemplatesPaginator.ts b/clients/client-cleanrooms/src/pagination/ListPrivacyBudgetTemplatesPaginator.ts index 7cfef7ec9ee7..91c685036705 100644 --- a/clients/client-cleanrooms/src/pagination/ListPrivacyBudgetTemplatesPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListPrivacyBudgetTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPrivacyBudgetTemplatesCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListPrivacyBudgetTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPrivacyBudgetTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPrivacyBudgetTemplates( +export const paginateListPrivacyBudgetTemplates: ( config: CleanRoomsPaginationConfiguration, input: ListPrivacyBudgetTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPrivacyBudgetTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListPrivacyBudgetTemplatesCommandInput, + ListPrivacyBudgetTemplatesCommandOutput +>(CleanRoomsClient, ListPrivacyBudgetTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanrooms/src/pagination/ListPrivacyBudgetsPaginator.ts b/clients/client-cleanrooms/src/pagination/ListPrivacyBudgetsPaginator.ts index 25bffe070ee0..9ca8743ece91 100644 --- a/clients/client-cleanrooms/src/pagination/ListPrivacyBudgetsPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListPrivacyBudgetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPrivacyBudgetsCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListPrivacyBudgetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPrivacyBudgetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPrivacyBudgets( +export const paginateListPrivacyBudgets: ( config: CleanRoomsPaginationConfiguration, input: ListPrivacyBudgetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPrivacyBudgetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListPrivacyBudgetsCommandInput, + ListPrivacyBudgetsCommandOutput +>(CleanRoomsClient, ListPrivacyBudgetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanrooms/src/pagination/ListProtectedQueriesPaginator.ts b/clients/client-cleanrooms/src/pagination/ListProtectedQueriesPaginator.ts index d19aa1077c6f..59556d1132fd 100644 --- a/clients/client-cleanrooms/src/pagination/ListProtectedQueriesPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListProtectedQueriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListProtectedQueriesCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListProtectedQueriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProtectedQueriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProtectedQueries( +export const paginateListProtectedQueries: ( config: CleanRoomsPaginationConfiguration, input: ListProtectedQueriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProtectedQueriesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListProtectedQueriesCommandInput, + ListProtectedQueriesCommandOutput +>(CleanRoomsClient, ListProtectedQueriesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanrooms/src/pagination/ListSchemasPaginator.ts b/clients/client-cleanrooms/src/pagination/ListSchemasPaginator.ts index ee7f9b81cba1..09ad7214cde8 100644 --- a/clients/client-cleanrooms/src/pagination/ListSchemasPaginator.ts +++ b/clients/client-cleanrooms/src/pagination/ListSchemasPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsClient } from "../CleanRoomsClient"; import { ListSchemasCommand, ListSchemasCommandInput, ListSchemasCommandOutput } from "../commands/ListSchemasCommand"; import { CleanRoomsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsClient, - input: ListSchemasCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSchemasCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSchemas( +export const paginateListSchemas: ( config: CleanRoomsPaginationConfiguration, input: ListSchemasCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSchemasCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRooms | CleanRoomsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsPaginationConfiguration, + ListSchemasCommandInput, + ListSchemasCommandOutput +>(CleanRoomsClient, ListSchemasCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanroomsml/src/pagination/ListAudienceExportJobsPaginator.ts b/clients/client-cleanroomsml/src/pagination/ListAudienceExportJobsPaginator.ts index 295377308952..7fc019669dec 100644 --- a/clients/client-cleanroomsml/src/pagination/ListAudienceExportJobsPaginator.ts +++ b/clients/client-cleanroomsml/src/pagination/ListAudienceExportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsMLClient } from "../CleanRoomsMLClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAudienceExportJobsCommand"; import { CleanRoomsMLPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsMLClient, - input: ListAudienceExportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAudienceExportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAudienceExportJobs( +export const paginateListAudienceExportJobs: ( config: CleanRoomsMLPaginationConfiguration, input: ListAudienceExportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAudienceExportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsMLClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRoomsML | CleanRoomsMLClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsMLPaginationConfiguration, + ListAudienceExportJobsCommandInput, + ListAudienceExportJobsCommandOutput +>(CleanRoomsMLClient, ListAudienceExportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanroomsml/src/pagination/ListAudienceGenerationJobsPaginator.ts b/clients/client-cleanroomsml/src/pagination/ListAudienceGenerationJobsPaginator.ts index 00e979cc4ef4..d4b8ee0b2a44 100644 --- a/clients/client-cleanroomsml/src/pagination/ListAudienceGenerationJobsPaginator.ts +++ b/clients/client-cleanroomsml/src/pagination/ListAudienceGenerationJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsMLClient } from "../CleanRoomsMLClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAudienceGenerationJobsCommand"; import { CleanRoomsMLPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsMLClient, - input: ListAudienceGenerationJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAudienceGenerationJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAudienceGenerationJobs( +export const paginateListAudienceGenerationJobs: ( config: CleanRoomsMLPaginationConfiguration, input: ListAudienceGenerationJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAudienceGenerationJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsMLClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRoomsML | CleanRoomsMLClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsMLPaginationConfiguration, + ListAudienceGenerationJobsCommandInput, + ListAudienceGenerationJobsCommandOutput +>(CleanRoomsMLClient, ListAudienceGenerationJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanroomsml/src/pagination/ListAudienceModelsPaginator.ts b/clients/client-cleanroomsml/src/pagination/ListAudienceModelsPaginator.ts index 20c3993abd5b..b56fb612a8d3 100644 --- a/clients/client-cleanroomsml/src/pagination/ListAudienceModelsPaginator.ts +++ b/clients/client-cleanroomsml/src/pagination/ListAudienceModelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsMLClient } from "../CleanRoomsMLClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAudienceModelsCommand"; import { CleanRoomsMLPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsMLClient, - input: ListAudienceModelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAudienceModelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAudienceModels( +export const paginateListAudienceModels: ( config: CleanRoomsMLPaginationConfiguration, input: ListAudienceModelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAudienceModelsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsMLClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRoomsML | CleanRoomsMLClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsMLPaginationConfiguration, + ListAudienceModelsCommandInput, + ListAudienceModelsCommandOutput +>(CleanRoomsMLClient, ListAudienceModelsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanroomsml/src/pagination/ListConfiguredAudienceModelsPaginator.ts b/clients/client-cleanroomsml/src/pagination/ListConfiguredAudienceModelsPaginator.ts index f677da1d944a..243ff2852b40 100644 --- a/clients/client-cleanroomsml/src/pagination/ListConfiguredAudienceModelsPaginator.ts +++ b/clients/client-cleanroomsml/src/pagination/ListConfiguredAudienceModelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsMLClient } from "../CleanRoomsMLClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListConfiguredAudienceModelsCommand"; import { CleanRoomsMLPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsMLClient, - input: ListConfiguredAudienceModelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConfiguredAudienceModelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConfiguredAudienceModels( +export const paginateListConfiguredAudienceModels: ( config: CleanRoomsMLPaginationConfiguration, input: ListConfiguredAudienceModelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConfiguredAudienceModelsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsMLClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRoomsML | CleanRoomsMLClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsMLPaginationConfiguration, + ListConfiguredAudienceModelsCommandInput, + ListConfiguredAudienceModelsCommandOutput +>(CleanRoomsMLClient, ListConfiguredAudienceModelsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cleanroomsml/src/pagination/ListTrainingDatasetsPaginator.ts b/clients/client-cleanroomsml/src/pagination/ListTrainingDatasetsPaginator.ts index be09b32e5fca..62b126cbba32 100644 --- a/clients/client-cleanroomsml/src/pagination/ListTrainingDatasetsPaginator.ts +++ b/clients/client-cleanroomsml/src/pagination/ListTrainingDatasetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CleanRoomsMLClient } from "../CleanRoomsMLClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListTrainingDatasetsCommand"; import { CleanRoomsMLPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CleanRoomsMLClient, - input: ListTrainingDatasetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTrainingDatasetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTrainingDatasets( +export const paginateListTrainingDatasets: ( config: CleanRoomsMLPaginationConfiguration, input: ListTrainingDatasetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTrainingDatasetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CleanRoomsMLClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CleanRoomsML | CleanRoomsMLClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CleanRoomsMLPaginationConfiguration, + ListTrainingDatasetsCommandInput, + ListTrainingDatasetsCommandOutput +>(CleanRoomsMLClient, ListTrainingDatasetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cloud9/package.json b/clients/client-cloud9/package.json index f0fe8b4df37f..74f2bb5c8a60 100644 --- a/clients/client-cloud9/package.json +++ b/clients/client-cloud9/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-cloud9/src/pagination/DescribeEnvironmentMembershipsPaginator.ts b/clients/client-cloud9/src/pagination/DescribeEnvironmentMembershipsPaginator.ts index bafbd073a00c..c42d5186a807 100644 --- a/clients/client-cloud9/src/pagination/DescribeEnvironmentMembershipsPaginator.ts +++ b/clients/client-cloud9/src/pagination/DescribeEnvironmentMembershipsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { Cloud9Client } from "../Cloud9Client"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeEnvironmentMembershipsCommand"; import { Cloud9PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Cloud9Client, - input: DescribeEnvironmentMembershipsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEnvironmentMembershipsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEnvironmentMemberships( +export const paginateDescribeEnvironmentMemberships: ( config: Cloud9PaginationConfiguration, input: DescribeEnvironmentMembershipsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEnvironmentMembershipsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Cloud9Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Cloud9 | Cloud9Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Cloud9PaginationConfiguration, + DescribeEnvironmentMembershipsCommandInput, + DescribeEnvironmentMembershipsCommandOutput +>(Cloud9Client, DescribeEnvironmentMembershipsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cloud9/src/pagination/ListEnvironmentsPaginator.ts b/clients/client-cloud9/src/pagination/ListEnvironmentsPaginator.ts index 7666ea34e468..311c01159831 100644 --- a/clients/client-cloud9/src/pagination/ListEnvironmentsPaginator.ts +++ b/clients/client-cloud9/src/pagination/ListEnvironmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { Cloud9Client } from "../Cloud9Client"; @@ -9,42 +10,15 @@ import { } from "../commands/ListEnvironmentsCommand"; import { Cloud9PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Cloud9Client, - input: ListEnvironmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironments( +export const paginateListEnvironments: ( config: Cloud9PaginationConfiguration, input: ListEnvironmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Cloud9Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Cloud9 | Cloud9Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Cloud9PaginationConfiguration, + ListEnvironmentsCommandInput, + ListEnvironmentsCommandOutput +>(Cloud9Client, ListEnvironmentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cloudcontrol/package.json b/clients/client-cloudcontrol/package.json index 867a57d21f23..eb2762f6e5b2 100644 --- a/clients/client-cloudcontrol/package.json +++ b/clients/client-cloudcontrol/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-cloudcontrol/src/pagination/ListResourceRequestsPaginator.ts b/clients/client-cloudcontrol/src/pagination/ListResourceRequestsPaginator.ts index 50510715cfb2..f5526eac0b6d 100644 --- a/clients/client-cloudcontrol/src/pagination/ListResourceRequestsPaginator.ts +++ b/clients/client-cloudcontrol/src/pagination/ListResourceRequestsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudControlClient } from "../CloudControlClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListResourceRequestsCommand"; import { CloudControlPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudControlClient, - input: ListResourceRequestsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourceRequestsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourceRequests( +export const paginateListResourceRequests: ( config: CloudControlPaginationConfiguration, input: ListResourceRequestsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourceRequestsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudControlClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudControl | CloudControlClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudControlPaginationConfiguration, + ListResourceRequestsCommandInput, + ListResourceRequestsCommandOutput +>(CloudControlClient, ListResourceRequestsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudcontrol/src/pagination/ListResourcesPaginator.ts b/clients/client-cloudcontrol/src/pagination/ListResourcesPaginator.ts index 1b8d06cb9bf3..ba89de4a6b05 100644 --- a/clients/client-cloudcontrol/src/pagination/ListResourcesPaginator.ts +++ b/clients/client-cloudcontrol/src/pagination/ListResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudControlClient } from "../CloudControlClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListResourcesCommand"; import { CloudControlPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudControlClient, - input: ListResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResources( +export const paginateListResources: ( config: CloudControlPaginationConfiguration, input: ListResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudControlClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudControl | CloudControlClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudControlPaginationConfiguration, + ListResourcesCommandInput, + ListResourcesCommandOutput +>(CloudControlClient, ListResourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListAppliedSchemaArnsPaginator.ts b/clients/client-clouddirectory/src/pagination/ListAppliedSchemaArnsPaginator.ts index d69553fccf02..139c24f7b013 100644 --- a/clients/client-clouddirectory/src/pagination/ListAppliedSchemaArnsPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListAppliedSchemaArnsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAppliedSchemaArnsCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListAppliedSchemaArnsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppliedSchemaArnsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppliedSchemaArns( +export const paginateListAppliedSchemaArns: ( config: CloudDirectoryPaginationConfiguration, input: ListAppliedSchemaArnsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppliedSchemaArnsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListAppliedSchemaArnsCommandInput, + ListAppliedSchemaArnsCommandOutput +>(CloudDirectoryClient, ListAppliedSchemaArnsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListAttachedIndicesPaginator.ts b/clients/client-clouddirectory/src/pagination/ListAttachedIndicesPaginator.ts index 0fb8b06f3dd7..80291b2796df 100644 --- a/clients/client-clouddirectory/src/pagination/ListAttachedIndicesPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListAttachedIndicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAttachedIndicesCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListAttachedIndicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAttachedIndicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAttachedIndices( +export const paginateListAttachedIndices: ( config: CloudDirectoryPaginationConfiguration, input: ListAttachedIndicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAttachedIndicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListAttachedIndicesCommandInput, + ListAttachedIndicesCommandOutput +>(CloudDirectoryClient, ListAttachedIndicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListDevelopmentSchemaArnsPaginator.ts b/clients/client-clouddirectory/src/pagination/ListDevelopmentSchemaArnsPaginator.ts index 91e942b0a263..70409ffd8adc 100644 --- a/clients/client-clouddirectory/src/pagination/ListDevelopmentSchemaArnsPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListDevelopmentSchemaArnsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListDevelopmentSchemaArnsCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListDevelopmentSchemaArnsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDevelopmentSchemaArnsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDevelopmentSchemaArns( +export const paginateListDevelopmentSchemaArns: ( config: CloudDirectoryPaginationConfiguration, input: ListDevelopmentSchemaArnsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDevelopmentSchemaArnsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListDevelopmentSchemaArnsCommandInput, + ListDevelopmentSchemaArnsCommandOutput +>(CloudDirectoryClient, ListDevelopmentSchemaArnsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListDirectoriesPaginator.ts b/clients/client-clouddirectory/src/pagination/ListDirectoriesPaginator.ts index 3e6e34527041..a1e86c0aa585 100644 --- a/clients/client-clouddirectory/src/pagination/ListDirectoriesPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListDirectoriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListDirectoriesCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListDirectoriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDirectoriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDirectories( +export const paginateListDirectories: ( config: CloudDirectoryPaginationConfiguration, input: ListDirectoriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDirectoriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListDirectoriesCommandInput, + ListDirectoriesCommandOutput +>(CloudDirectoryClient, ListDirectoriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListFacetAttributesPaginator.ts b/clients/client-clouddirectory/src/pagination/ListFacetAttributesPaginator.ts index 2fc1477199a7..fd6511f9a826 100644 --- a/clients/client-clouddirectory/src/pagination/ListFacetAttributesPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListFacetAttributesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListFacetAttributesCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListFacetAttributesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFacetAttributesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFacetAttributes( +export const paginateListFacetAttributes: ( config: CloudDirectoryPaginationConfiguration, input: ListFacetAttributesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFacetAttributesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListFacetAttributesCommandInput, + ListFacetAttributesCommandOutput +>(CloudDirectoryClient, ListFacetAttributesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListFacetNamesPaginator.ts b/clients/client-clouddirectory/src/pagination/ListFacetNamesPaginator.ts index 21bdd3809836..f35610065853 100644 --- a/clients/client-clouddirectory/src/pagination/ListFacetNamesPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListFacetNamesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListFacetNamesCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListFacetNamesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFacetNamesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFacetNames( +export const paginateListFacetNames: ( config: CloudDirectoryPaginationConfiguration, input: ListFacetNamesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFacetNamesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListFacetNamesCommandInput, + ListFacetNamesCommandOutput +>(CloudDirectoryClient, ListFacetNamesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListIndexPaginator.ts b/clients/client-clouddirectory/src/pagination/ListIndexPaginator.ts index a1d0f2e44df0..ebf7d0255539 100644 --- a/clients/client-clouddirectory/src/pagination/ListIndexPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListIndexPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; import { ListIndexCommand, ListIndexCommandInput, ListIndexCommandOutput } from "../commands/ListIndexCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListIndexCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIndexCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIndex( +export const paginateListIndex: ( config: CloudDirectoryPaginationConfiguration, input: ListIndexCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIndexCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListIndexCommandInput, + ListIndexCommandOutput +>(CloudDirectoryClient, ListIndexCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListManagedSchemaArnsPaginator.ts b/clients/client-clouddirectory/src/pagination/ListManagedSchemaArnsPaginator.ts index 52c0d0d0f51a..75bd48f5e329 100644 --- a/clients/client-clouddirectory/src/pagination/ListManagedSchemaArnsPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListManagedSchemaArnsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListManagedSchemaArnsCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListManagedSchemaArnsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListManagedSchemaArnsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListManagedSchemaArns( +export const paginateListManagedSchemaArns: ( config: CloudDirectoryPaginationConfiguration, input: ListManagedSchemaArnsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListManagedSchemaArnsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListManagedSchemaArnsCommandInput, + ListManagedSchemaArnsCommandOutput +>(CloudDirectoryClient, ListManagedSchemaArnsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListObjectAttributesPaginator.ts b/clients/client-clouddirectory/src/pagination/ListObjectAttributesPaginator.ts index 18693e29e466..726383f57d29 100644 --- a/clients/client-clouddirectory/src/pagination/ListObjectAttributesPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListObjectAttributesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListObjectAttributesCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListObjectAttributesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListObjectAttributesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListObjectAttributes( +export const paginateListObjectAttributes: ( config: CloudDirectoryPaginationConfiguration, input: ListObjectAttributesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListObjectAttributesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListObjectAttributesCommandInput, + ListObjectAttributesCommandOutput +>(CloudDirectoryClient, ListObjectAttributesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListObjectChildrenPaginator.ts b/clients/client-clouddirectory/src/pagination/ListObjectChildrenPaginator.ts index 204ef21d603a..4892d7271eeb 100644 --- a/clients/client-clouddirectory/src/pagination/ListObjectChildrenPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListObjectChildrenPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListObjectChildrenCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListObjectChildrenCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListObjectChildrenCommand(input), ...args); -}; /** * @public */ -export async function* paginateListObjectChildren( +export const paginateListObjectChildren: ( config: CloudDirectoryPaginationConfiguration, input: ListObjectChildrenCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListObjectChildrenCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListObjectChildrenCommandInput, + ListObjectChildrenCommandOutput +>(CloudDirectoryClient, ListObjectChildrenCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListObjectParentPathsPaginator.ts b/clients/client-clouddirectory/src/pagination/ListObjectParentPathsPaginator.ts index 081e5be2b170..c47951ededda 100644 --- a/clients/client-clouddirectory/src/pagination/ListObjectParentPathsPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListObjectParentPathsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListObjectParentPathsCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListObjectParentPathsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListObjectParentPathsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListObjectParentPaths( +export const paginateListObjectParentPaths: ( config: CloudDirectoryPaginationConfiguration, input: ListObjectParentPathsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListObjectParentPathsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListObjectParentPathsCommandInput, + ListObjectParentPathsCommandOutput +>(CloudDirectoryClient, ListObjectParentPathsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListObjectParentsPaginator.ts b/clients/client-clouddirectory/src/pagination/ListObjectParentsPaginator.ts index d59a216566e5..4bbfd2a41057 100644 --- a/clients/client-clouddirectory/src/pagination/ListObjectParentsPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListObjectParentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListObjectParentsCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListObjectParentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListObjectParentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListObjectParents( +export const paginateListObjectParents: ( config: CloudDirectoryPaginationConfiguration, input: ListObjectParentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListObjectParentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListObjectParentsCommandInput, + ListObjectParentsCommandOutput +>(CloudDirectoryClient, ListObjectParentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListObjectPoliciesPaginator.ts b/clients/client-clouddirectory/src/pagination/ListObjectPoliciesPaginator.ts index e002ecd6ba65..85332705255b 100644 --- a/clients/client-clouddirectory/src/pagination/ListObjectPoliciesPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListObjectPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListObjectPoliciesCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListObjectPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListObjectPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListObjectPolicies( +export const paginateListObjectPolicies: ( config: CloudDirectoryPaginationConfiguration, input: ListObjectPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListObjectPoliciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListObjectPoliciesCommandInput, + ListObjectPoliciesCommandOutput +>(CloudDirectoryClient, ListObjectPoliciesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListPolicyAttachmentsPaginator.ts b/clients/client-clouddirectory/src/pagination/ListPolicyAttachmentsPaginator.ts index 819d619afb32..fccac9e4fedd 100644 --- a/clients/client-clouddirectory/src/pagination/ListPolicyAttachmentsPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListPolicyAttachmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPolicyAttachmentsCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListPolicyAttachmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPolicyAttachmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPolicyAttachments( +export const paginateListPolicyAttachments: ( config: CloudDirectoryPaginationConfiguration, input: ListPolicyAttachmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPolicyAttachmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListPolicyAttachmentsCommandInput, + ListPolicyAttachmentsCommandOutput +>(CloudDirectoryClient, ListPolicyAttachmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListPublishedSchemaArnsPaginator.ts b/clients/client-clouddirectory/src/pagination/ListPublishedSchemaArnsPaginator.ts index aec44c4aa80c..9bb018df342b 100644 --- a/clients/client-clouddirectory/src/pagination/ListPublishedSchemaArnsPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListPublishedSchemaArnsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPublishedSchemaArnsCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListPublishedSchemaArnsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPublishedSchemaArnsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPublishedSchemaArns( +export const paginateListPublishedSchemaArns: ( config: CloudDirectoryPaginationConfiguration, input: ListPublishedSchemaArnsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPublishedSchemaArnsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListPublishedSchemaArnsCommandInput, + ListPublishedSchemaArnsCommandOutput +>(CloudDirectoryClient, ListPublishedSchemaArnsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-clouddirectory/src/pagination/ListTagsForResourcePaginator.ts index e3cf48e1c1be..d1314ea736a3 100644 --- a/clients/client-clouddirectory/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListTagsForResourceCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: CloudDirectoryPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(CloudDirectoryClient, ListTagsForResourceCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListTypedLinkFacetAttributesPaginator.ts b/clients/client-clouddirectory/src/pagination/ListTypedLinkFacetAttributesPaginator.ts index fcf68a3ba0a6..579096bb63b3 100644 --- a/clients/client-clouddirectory/src/pagination/ListTypedLinkFacetAttributesPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListTypedLinkFacetAttributesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListTypedLinkFacetAttributesCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListTypedLinkFacetAttributesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTypedLinkFacetAttributesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTypedLinkFacetAttributes( +export const paginateListTypedLinkFacetAttributes: ( config: CloudDirectoryPaginationConfiguration, input: ListTypedLinkFacetAttributesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTypedLinkFacetAttributesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListTypedLinkFacetAttributesCommandInput, + ListTypedLinkFacetAttributesCommandOutput +>(CloudDirectoryClient, ListTypedLinkFacetAttributesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/ListTypedLinkFacetNamesPaginator.ts b/clients/client-clouddirectory/src/pagination/ListTypedLinkFacetNamesPaginator.ts index 5b3469211d2d..014792319a00 100644 --- a/clients/client-clouddirectory/src/pagination/ListTypedLinkFacetNamesPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/ListTypedLinkFacetNamesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListTypedLinkFacetNamesCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: ListTypedLinkFacetNamesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTypedLinkFacetNamesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTypedLinkFacetNames( +export const paginateListTypedLinkFacetNames: ( config: CloudDirectoryPaginationConfiguration, input: ListTypedLinkFacetNamesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTypedLinkFacetNamesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + ListTypedLinkFacetNamesCommandInput, + ListTypedLinkFacetNamesCommandOutput +>(CloudDirectoryClient, ListTypedLinkFacetNamesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-clouddirectory/src/pagination/LookupPolicyPaginator.ts b/clients/client-clouddirectory/src/pagination/LookupPolicyPaginator.ts index ac0bbe722d77..e9a6506b1958 100644 --- a/clients/client-clouddirectory/src/pagination/LookupPolicyPaginator.ts +++ b/clients/client-clouddirectory/src/pagination/LookupPolicyPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudDirectoryClient } from "../CloudDirectoryClient"; @@ -9,42 +10,15 @@ import { } from "../commands/LookupPolicyCommand"; import { CloudDirectoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudDirectoryClient, - input: LookupPolicyCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new LookupPolicyCommand(input), ...args); -}; /** * @public */ -export async function* paginateLookupPolicy( +export const paginateLookupPolicy: ( config: CloudDirectoryPaginationConfiguration, input: LookupPolicyCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: LookupPolicyCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudDirectoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudDirectory | CloudDirectoryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudDirectoryPaginationConfiguration, + LookupPolicyCommandInput, + LookupPolicyCommandOutput +>(CloudDirectoryClient, LookupPolicyCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudformation/package.json b/clients/client-cloudformation/package.json index 7870a6562eb3..53817481e01f 100644 --- a/clients/client-cloudformation/package.json +++ b/clients/client-cloudformation/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-cloudformation/src/pagination/DescribeAccountLimitsPaginator.ts b/clients/client-cloudformation/src/pagination/DescribeAccountLimitsPaginator.ts index 54d3e55de49f..ace94939b974 100644 --- a/clients/client-cloudformation/src/pagination/DescribeAccountLimitsPaginator.ts +++ b/clients/client-cloudformation/src/pagination/DescribeAccountLimitsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; @@ -9,41 +10,15 @@ import { } from "../commands/DescribeAccountLimitsCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: DescribeAccountLimitsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAccountLimitsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAccountLimits( +export const paginateDescribeAccountLimits: ( config: CloudFormationPaginationConfiguration, input: DescribeAccountLimitsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAccountLimitsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + DescribeAccountLimitsCommandInput, + DescribeAccountLimitsCommandOutput +>(CloudFormationClient, DescribeAccountLimitsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-cloudformation/src/pagination/DescribeStackEventsPaginator.ts b/clients/client-cloudformation/src/pagination/DescribeStackEventsPaginator.ts index 59d8e6127860..1bc785bd520b 100644 --- a/clients/client-cloudformation/src/pagination/DescribeStackEventsPaginator.ts +++ b/clients/client-cloudformation/src/pagination/DescribeStackEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; @@ -9,41 +10,15 @@ import { } from "../commands/DescribeStackEventsCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: DescribeStackEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeStackEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeStackEvents( +export const paginateDescribeStackEvents: ( config: CloudFormationPaginationConfiguration, input: DescribeStackEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeStackEventsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + DescribeStackEventsCommandInput, + DescribeStackEventsCommandOutput +>(CloudFormationClient, DescribeStackEventsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-cloudformation/src/pagination/DescribeStackResourceDriftsPaginator.ts b/clients/client-cloudformation/src/pagination/DescribeStackResourceDriftsPaginator.ts index 7ef919b16023..80388bfaac94 100644 --- a/clients/client-cloudformation/src/pagination/DescribeStackResourceDriftsPaginator.ts +++ b/clients/client-cloudformation/src/pagination/DescribeStackResourceDriftsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeStackResourceDriftsCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: DescribeStackResourceDriftsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeStackResourceDriftsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeStackResourceDrifts( +export const paginateDescribeStackResourceDrifts: ( config: CloudFormationPaginationConfiguration, input: DescribeStackResourceDriftsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeStackResourceDriftsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + DescribeStackResourceDriftsCommandInput, + DescribeStackResourceDriftsCommandOutput +>(CloudFormationClient, DescribeStackResourceDriftsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudformation/src/pagination/DescribeStacksPaginator.ts b/clients/client-cloudformation/src/pagination/DescribeStacksPaginator.ts index 01813dd6c58a..e14d60f3606c 100644 --- a/clients/client-cloudformation/src/pagination/DescribeStacksPaginator.ts +++ b/clients/client-cloudformation/src/pagination/DescribeStacksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; @@ -9,41 +10,15 @@ import { } from "../commands/DescribeStacksCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: DescribeStacksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeStacksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeStacks( +export const paginateDescribeStacks: ( config: CloudFormationPaginationConfiguration, input: DescribeStacksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeStacksCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + DescribeStacksCommandInput, + DescribeStacksCommandOutput +>(CloudFormationClient, DescribeStacksCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-cloudformation/src/pagination/ListChangeSetsPaginator.ts b/clients/client-cloudformation/src/pagination/ListChangeSetsPaginator.ts index 5aaa0a3db210..3d870a2fc154 100644 --- a/clients/client-cloudformation/src/pagination/ListChangeSetsPaginator.ts +++ b/clients/client-cloudformation/src/pagination/ListChangeSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListChangeSetsCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: ListChangeSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChangeSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChangeSets( +export const paginateListChangeSets: ( config: CloudFormationPaginationConfiguration, input: ListChangeSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChangeSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + ListChangeSetsCommandInput, + ListChangeSetsCommandOutput +>(CloudFormationClient, ListChangeSetsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-cloudformation/src/pagination/ListExportsPaginator.ts b/clients/client-cloudformation/src/pagination/ListExportsPaginator.ts index 0092a1c56767..845d2fd87239 100644 --- a/clients/client-cloudformation/src/pagination/ListExportsPaginator.ts +++ b/clients/client-cloudformation/src/pagination/ListExportsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; import { ListExportsCommand, ListExportsCommandInput, ListExportsCommandOutput } from "../commands/ListExportsCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: ListExportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExports( +export const paginateListExports: ( config: CloudFormationPaginationConfiguration, input: ListExportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExportsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + ListExportsCommandInput, + ListExportsCommandOutput +>(CloudFormationClient, ListExportsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-cloudformation/src/pagination/ListImportsPaginator.ts b/clients/client-cloudformation/src/pagination/ListImportsPaginator.ts index 042f6e431bfb..36d0ab885a53 100644 --- a/clients/client-cloudformation/src/pagination/ListImportsPaginator.ts +++ b/clients/client-cloudformation/src/pagination/ListImportsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; import { ListImportsCommand, ListImportsCommandInput, ListImportsCommandOutput } from "../commands/ListImportsCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: ListImportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImports( +export const paginateListImports: ( config: CloudFormationPaginationConfiguration, input: ListImportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImportsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + ListImportsCommandInput, + ListImportsCommandOutput +>(CloudFormationClient, ListImportsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-cloudformation/src/pagination/ListStackInstancesPaginator.ts b/clients/client-cloudformation/src/pagination/ListStackInstancesPaginator.ts index 678a3d57ddba..e91242549486 100644 --- a/clients/client-cloudformation/src/pagination/ListStackInstancesPaginator.ts +++ b/clients/client-cloudformation/src/pagination/ListStackInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListStackInstancesCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: ListStackInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStackInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStackInstances( +export const paginateListStackInstances: ( config: CloudFormationPaginationConfiguration, input: ListStackInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStackInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + ListStackInstancesCommandInput, + ListStackInstancesCommandOutput +>(CloudFormationClient, ListStackInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudformation/src/pagination/ListStackResourcesPaginator.ts b/clients/client-cloudformation/src/pagination/ListStackResourcesPaginator.ts index 68b5d8e39e51..0adb5870b278 100644 --- a/clients/client-cloudformation/src/pagination/ListStackResourcesPaginator.ts +++ b/clients/client-cloudformation/src/pagination/ListStackResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListStackResourcesCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: ListStackResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStackResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStackResources( +export const paginateListStackResources: ( config: CloudFormationPaginationConfiguration, input: ListStackResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStackResourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + ListStackResourcesCommandInput, + ListStackResourcesCommandOutput +>(CloudFormationClient, ListStackResourcesCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-cloudformation/src/pagination/ListStackSetOperationResultsPaginator.ts b/clients/client-cloudformation/src/pagination/ListStackSetOperationResultsPaginator.ts index df71affa83e4..b01830b4e038 100644 --- a/clients/client-cloudformation/src/pagination/ListStackSetOperationResultsPaginator.ts +++ b/clients/client-cloudformation/src/pagination/ListStackSetOperationResultsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListStackSetOperationResultsCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: ListStackSetOperationResultsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStackSetOperationResultsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStackSetOperationResults( +export const paginateListStackSetOperationResults: ( config: CloudFormationPaginationConfiguration, input: ListStackSetOperationResultsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStackSetOperationResultsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + ListStackSetOperationResultsCommandInput, + ListStackSetOperationResultsCommandOutput +>(CloudFormationClient, ListStackSetOperationResultsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudformation/src/pagination/ListStackSetOperationsPaginator.ts b/clients/client-cloudformation/src/pagination/ListStackSetOperationsPaginator.ts index 0dc2e4c10ad4..87762e1f273c 100644 --- a/clients/client-cloudformation/src/pagination/ListStackSetOperationsPaginator.ts +++ b/clients/client-cloudformation/src/pagination/ListStackSetOperationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListStackSetOperationsCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: ListStackSetOperationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStackSetOperationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStackSetOperations( +export const paginateListStackSetOperations: ( config: CloudFormationPaginationConfiguration, input: ListStackSetOperationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStackSetOperationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + ListStackSetOperationsCommandInput, + ListStackSetOperationsCommandOutput +>(CloudFormationClient, ListStackSetOperationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudformation/src/pagination/ListStackSetsPaginator.ts b/clients/client-cloudformation/src/pagination/ListStackSetsPaginator.ts index caef8c82fcf3..acb03f727ca2 100644 --- a/clients/client-cloudformation/src/pagination/ListStackSetsPaginator.ts +++ b/clients/client-cloudformation/src/pagination/ListStackSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListStackSetsCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: ListStackSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStackSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStackSets( +export const paginateListStackSets: ( config: CloudFormationPaginationConfiguration, input: ListStackSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStackSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + ListStackSetsCommandInput, + ListStackSetsCommandOutput +>(CloudFormationClient, ListStackSetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudformation/src/pagination/ListStacksPaginator.ts b/clients/client-cloudformation/src/pagination/ListStacksPaginator.ts index 75dff354a5fe..c9652a3f8c65 100644 --- a/clients/client-cloudformation/src/pagination/ListStacksPaginator.ts +++ b/clients/client-cloudformation/src/pagination/ListStacksPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; import { ListStacksCommand, ListStacksCommandInput, ListStacksCommandOutput } from "../commands/ListStacksCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: ListStacksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStacksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStacks( +export const paginateListStacks: ( config: CloudFormationPaginationConfiguration, input: ListStacksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStacksCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + ListStacksCommandInput, + ListStacksCommandOutput +>(CloudFormationClient, ListStacksCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-cloudformation/src/pagination/ListTypeRegistrationsPaginator.ts b/clients/client-cloudformation/src/pagination/ListTypeRegistrationsPaginator.ts index 792b8b9c6bb5..587e12373329 100644 --- a/clients/client-cloudformation/src/pagination/ListTypeRegistrationsPaginator.ts +++ b/clients/client-cloudformation/src/pagination/ListTypeRegistrationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListTypeRegistrationsCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: ListTypeRegistrationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTypeRegistrationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTypeRegistrations( +export const paginateListTypeRegistrations: ( config: CloudFormationPaginationConfiguration, input: ListTypeRegistrationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTypeRegistrationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + ListTypeRegistrationsCommandInput, + ListTypeRegistrationsCommandOutput +>(CloudFormationClient, ListTypeRegistrationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudformation/src/pagination/ListTypeVersionsPaginator.ts b/clients/client-cloudformation/src/pagination/ListTypeVersionsPaginator.ts index 8eea27d9250a..f4d5e48c07ff 100644 --- a/clients/client-cloudformation/src/pagination/ListTypeVersionsPaginator.ts +++ b/clients/client-cloudformation/src/pagination/ListTypeVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListTypeVersionsCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: ListTypeVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTypeVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTypeVersions( +export const paginateListTypeVersions: ( config: CloudFormationPaginationConfiguration, input: ListTypeVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTypeVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + ListTypeVersionsCommandInput, + ListTypeVersionsCommandOutput +>(CloudFormationClient, ListTypeVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudformation/src/pagination/ListTypesPaginator.ts b/clients/client-cloudformation/src/pagination/ListTypesPaginator.ts index 7a7a301f86fc..9955ba30056f 100644 --- a/clients/client-cloudformation/src/pagination/ListTypesPaginator.ts +++ b/clients/client-cloudformation/src/pagination/ListTypesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFormationClient } from "../CloudFormationClient"; import { ListTypesCommand, ListTypesCommandInput, ListTypesCommandOutput } from "../commands/ListTypesCommand"; import { CloudFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFormationClient, - input: ListTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTypes( +export const paginateListTypes: ( config: CloudFormationPaginationConfiguration, input: ListTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTypesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFormation | CloudFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFormationPaginationConfiguration, + ListTypesCommandInput, + ListTypesCommandOutput +>(CloudFormationClient, ListTypesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudfront-keyvaluestore/src/pagination/ListKeysPaginator.ts b/clients/client-cloudfront-keyvaluestore/src/pagination/ListKeysPaginator.ts index b692a1fdf737..3f07f989b9ee 100644 --- a/clients/client-cloudfront-keyvaluestore/src/pagination/ListKeysPaginator.ts +++ b/clients/client-cloudfront-keyvaluestore/src/pagination/ListKeysPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFrontKeyValueStoreClient } from "../CloudFrontKeyValueStoreClient"; import { ListKeysCommand, ListKeysCommandInput, ListKeysCommandOutput } from "../commands/ListKeysCommand"; import { CloudFrontKeyValueStorePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFrontKeyValueStoreClient, - input: ListKeysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKeysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKeys( +export const paginateListKeys: ( config: CloudFrontKeyValueStorePaginationConfiguration, input: ListKeysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKeysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudFrontKeyValueStoreClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFrontKeyValueStore | CloudFrontKeyValueStoreClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFrontKeyValueStorePaginationConfiguration, + ListKeysCommandInput, + ListKeysCommandOutput +>(CloudFrontKeyValueStoreClient, ListKeysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudfront/src/pagination/ListCloudFrontOriginAccessIdentitiesPaginator.ts b/clients/client-cloudfront/src/pagination/ListCloudFrontOriginAccessIdentitiesPaginator.ts index 062d8f5b6b1e..21d855a941ad 100644 --- a/clients/client-cloudfront/src/pagination/ListCloudFrontOriginAccessIdentitiesPaginator.ts +++ b/clients/client-cloudfront/src/pagination/ListCloudFrontOriginAccessIdentitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFrontClient } from "../CloudFrontClient"; @@ -9,42 +10,21 @@ import { } from "../commands/ListCloudFrontOriginAccessIdentitiesCommand"; import { CloudFrontPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFrontClient, - input: ListCloudFrontOriginAccessIdentitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCloudFrontOriginAccessIdentitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCloudFrontOriginAccessIdentities( +export const paginateListCloudFrontOriginAccessIdentities: ( config: CloudFrontPaginationConfiguration, input: ListCloudFrontOriginAccessIdentitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCloudFrontOriginAccessIdentitiesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof CloudFrontClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFront | CloudFrontClient"); - } - yield page; - const prevToken = token; - token = page.CloudFrontOriginAccessIdentityList!.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFrontPaginationConfiguration, + ListCloudFrontOriginAccessIdentitiesCommandInput, + ListCloudFrontOriginAccessIdentitiesCommandOutput +>( + CloudFrontClient, + ListCloudFrontOriginAccessIdentitiesCommand, + "Marker", + "CloudFrontOriginAccessIdentityList.NextMarker", + "MaxItems" +); diff --git a/clients/client-cloudfront/src/pagination/ListDistributionsPaginator.ts b/clients/client-cloudfront/src/pagination/ListDistributionsPaginator.ts index 91439b224bbf..06d55e81b8f6 100644 --- a/clients/client-cloudfront/src/pagination/ListDistributionsPaginator.ts +++ b/clients/client-cloudfront/src/pagination/ListDistributionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFrontClient } from "../CloudFrontClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListDistributionsCommand"; import { CloudFrontPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFrontClient, - input: ListDistributionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDistributionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDistributions( +export const paginateListDistributions: ( config: CloudFrontPaginationConfiguration, input: ListDistributionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDistributionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof CloudFrontClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFront | CloudFrontClient"); - } - yield page; - const prevToken = token; - token = page.DistributionList!.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFrontPaginationConfiguration, + ListDistributionsCommandInput, + ListDistributionsCommandOutput +>(CloudFrontClient, ListDistributionsCommand, "Marker", "DistributionList.NextMarker", "MaxItems"); diff --git a/clients/client-cloudfront/src/pagination/ListInvalidationsPaginator.ts b/clients/client-cloudfront/src/pagination/ListInvalidationsPaginator.ts index ff775bb94601..84431bfc9522 100644 --- a/clients/client-cloudfront/src/pagination/ListInvalidationsPaginator.ts +++ b/clients/client-cloudfront/src/pagination/ListInvalidationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFrontClient } from "../CloudFrontClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListInvalidationsCommand"; import { CloudFrontPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFrontClient, - input: ListInvalidationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInvalidationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInvalidations( +export const paginateListInvalidations: ( config: CloudFrontPaginationConfiguration, input: ListInvalidationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInvalidationsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof CloudFrontClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFront | CloudFrontClient"); - } - yield page; - const prevToken = token; - token = page.InvalidationList!.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFrontPaginationConfiguration, + ListInvalidationsCommandInput, + ListInvalidationsCommandOutput +>(CloudFrontClient, ListInvalidationsCommand, "Marker", "InvalidationList.NextMarker", "MaxItems"); diff --git a/clients/client-cloudfront/src/pagination/ListKeyValueStoresPaginator.ts b/clients/client-cloudfront/src/pagination/ListKeyValueStoresPaginator.ts index 0e74105c9f6b..4d1a2502284c 100644 --- a/clients/client-cloudfront/src/pagination/ListKeyValueStoresPaginator.ts +++ b/clients/client-cloudfront/src/pagination/ListKeyValueStoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFrontClient } from "../CloudFrontClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListKeyValueStoresCommand"; import { CloudFrontPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFrontClient, - input: ListKeyValueStoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKeyValueStoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKeyValueStores( +export const paginateListKeyValueStores: ( config: CloudFrontPaginationConfiguration, input: ListKeyValueStoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKeyValueStoresCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof CloudFrontClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFront | CloudFrontClient"); - } - yield page; - const prevToken = token; - token = page.KeyValueStoreList!.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFrontPaginationConfiguration, + ListKeyValueStoresCommandInput, + ListKeyValueStoresCommandOutput +>(CloudFrontClient, ListKeyValueStoresCommand, "Marker", "KeyValueStoreList.NextMarker", "MaxItems"); diff --git a/clients/client-cloudfront/src/pagination/ListStreamingDistributionsPaginator.ts b/clients/client-cloudfront/src/pagination/ListStreamingDistributionsPaginator.ts index 7bb7b85638ca..de3124e1f453 100644 --- a/clients/client-cloudfront/src/pagination/ListStreamingDistributionsPaginator.ts +++ b/clients/client-cloudfront/src/pagination/ListStreamingDistributionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudFrontClient } from "../CloudFrontClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListStreamingDistributionsCommand"; import { CloudFrontPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudFrontClient, - input: ListStreamingDistributionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStreamingDistributionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStreamingDistributions( +export const paginateListStreamingDistributions: ( config: CloudFrontPaginationConfiguration, input: ListStreamingDistributionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStreamingDistributionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof CloudFrontClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudFront | CloudFrontClient"); - } - yield page; - const prevToken = token; - token = page.StreamingDistributionList!.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudFrontPaginationConfiguration, + ListStreamingDistributionsCommandInput, + ListStreamingDistributionsCommandOutput +>(CloudFrontClient, ListStreamingDistributionsCommand, "Marker", "StreamingDistributionList.NextMarker", "MaxItems"); diff --git a/clients/client-cloudhsm-v2/package.json b/clients/client-cloudhsm-v2/package.json index 3e8addd4ea3e..82e24d6e24c0 100644 --- a/clients/client-cloudhsm-v2/package.json +++ b/clients/client-cloudhsm-v2/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-cloudhsm-v2/src/pagination/DescribeBackupsPaginator.ts b/clients/client-cloudhsm-v2/src/pagination/DescribeBackupsPaginator.ts index b3b9b3c87d33..2a3375f243b7 100644 --- a/clients/client-cloudhsm-v2/src/pagination/DescribeBackupsPaginator.ts +++ b/clients/client-cloudhsm-v2/src/pagination/DescribeBackupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudHSMV2Client } from "../CloudHSMV2Client"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeBackupsCommand"; import { CloudHSMV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudHSMV2Client, - input: DescribeBackupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeBackupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeBackups( +export const paginateDescribeBackups: ( config: CloudHSMV2PaginationConfiguration, input: DescribeBackupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeBackupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudHSMV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudHSMV2 | CloudHSMV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudHSMV2PaginationConfiguration, + DescribeBackupsCommandInput, + DescribeBackupsCommandOutput +>(CloudHSMV2Client, DescribeBackupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudhsm-v2/src/pagination/DescribeClustersPaginator.ts b/clients/client-cloudhsm-v2/src/pagination/DescribeClustersPaginator.ts index 46863e489435..86b86fab708e 100644 --- a/clients/client-cloudhsm-v2/src/pagination/DescribeClustersPaginator.ts +++ b/clients/client-cloudhsm-v2/src/pagination/DescribeClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudHSMV2Client } from "../CloudHSMV2Client"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeClustersCommand"; import { CloudHSMV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudHSMV2Client, - input: DescribeClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClusters( +export const paginateDescribeClusters: ( config: CloudHSMV2PaginationConfiguration, input: DescribeClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClustersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudHSMV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudHSMV2 | CloudHSMV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudHSMV2PaginationConfiguration, + DescribeClustersCommandInput, + DescribeClustersCommandOutput +>(CloudHSMV2Client, DescribeClustersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudhsm-v2/src/pagination/ListTagsPaginator.ts b/clients/client-cloudhsm-v2/src/pagination/ListTagsPaginator.ts index bf860ecbfd09..488bff7c403c 100644 --- a/clients/client-cloudhsm-v2/src/pagination/ListTagsPaginator.ts +++ b/clients/client-cloudhsm-v2/src/pagination/ListTagsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudHSMV2Client } from "../CloudHSMV2Client"; import { ListTagsCommand, ListTagsCommandInput, ListTagsCommandOutput } from "../commands/ListTagsCommand"; import { CloudHSMV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudHSMV2Client, - input: ListTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTags( +export const paginateListTags: ( config: CloudHSMV2PaginationConfiguration, input: ListTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudHSMV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudHSMV2 | CloudHSMV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudHSMV2PaginationConfiguration, + ListTagsCommandInput, + ListTagsCommandOutput +>(CloudHSMV2Client, ListTagsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudtrail/package.json b/clients/client-cloudtrail/package.json index d77d55046931..6ca7bc00649f 100644 --- a/clients/client-cloudtrail/package.json +++ b/clients/client-cloudtrail/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-cloudtrail/src/pagination/GetQueryResultsPaginator.ts b/clients/client-cloudtrail/src/pagination/GetQueryResultsPaginator.ts index 092a00b65ae8..e8ea81bb59a2 100644 --- a/clients/client-cloudtrail/src/pagination/GetQueryResultsPaginator.ts +++ b/clients/client-cloudtrail/src/pagination/GetQueryResultsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudTrailClient } from "../CloudTrailClient"; @@ -9,41 +10,15 @@ import { } from "../commands/GetQueryResultsCommand"; import { CloudTrailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudTrailClient, - input: GetQueryResultsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetQueryResultsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetQueryResults( +export const paginateGetQueryResults: ( config: CloudTrailPaginationConfiguration, input: GetQueryResultsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetQueryResultsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof CloudTrailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudTrail | CloudTrailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudTrailPaginationConfiguration, + GetQueryResultsCommandInput, + GetQueryResultsCommandOutput +>(CloudTrailClient, GetQueryResultsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-cloudtrail/src/pagination/ListChannelsPaginator.ts b/clients/client-cloudtrail/src/pagination/ListChannelsPaginator.ts index e2bbc75d6e4e..ccfaabe4532a 100644 --- a/clients/client-cloudtrail/src/pagination/ListChannelsPaginator.ts +++ b/clients/client-cloudtrail/src/pagination/ListChannelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudTrailClient } from "../CloudTrailClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListChannelsCommand"; import { CloudTrailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudTrailClient, - input: ListChannelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannels( +export const paginateListChannels: ( config: CloudTrailPaginationConfiguration, input: ListChannelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudTrailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudTrail | CloudTrailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudTrailPaginationConfiguration, + ListChannelsCommandInput, + ListChannelsCommandOutput +>(CloudTrailClient, ListChannelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudtrail/src/pagination/ListEventDataStoresPaginator.ts b/clients/client-cloudtrail/src/pagination/ListEventDataStoresPaginator.ts index 61dd994d5102..00c17ad55e9d 100644 --- a/clients/client-cloudtrail/src/pagination/ListEventDataStoresPaginator.ts +++ b/clients/client-cloudtrail/src/pagination/ListEventDataStoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudTrailClient } from "../CloudTrailClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListEventDataStoresCommand"; import { CloudTrailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudTrailClient, - input: ListEventDataStoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEventDataStoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEventDataStores( +export const paginateListEventDataStores: ( config: CloudTrailPaginationConfiguration, input: ListEventDataStoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEventDataStoresCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudTrailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudTrail | CloudTrailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudTrailPaginationConfiguration, + ListEventDataStoresCommandInput, + ListEventDataStoresCommandOutput +>(CloudTrailClient, ListEventDataStoresCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudtrail/src/pagination/ListImportFailuresPaginator.ts b/clients/client-cloudtrail/src/pagination/ListImportFailuresPaginator.ts index 20fa92eec416..88e7d7263f4c 100644 --- a/clients/client-cloudtrail/src/pagination/ListImportFailuresPaginator.ts +++ b/clients/client-cloudtrail/src/pagination/ListImportFailuresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudTrailClient } from "../CloudTrailClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListImportFailuresCommand"; import { CloudTrailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudTrailClient, - input: ListImportFailuresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImportFailuresCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImportFailures( +export const paginateListImportFailures: ( config: CloudTrailPaginationConfiguration, input: ListImportFailuresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImportFailuresCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudTrailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudTrail | CloudTrailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudTrailPaginationConfiguration, + ListImportFailuresCommandInput, + ListImportFailuresCommandOutput +>(CloudTrailClient, ListImportFailuresCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudtrail/src/pagination/ListImportsPaginator.ts b/clients/client-cloudtrail/src/pagination/ListImportsPaginator.ts index ab97b20b793a..4e08d0c01874 100644 --- a/clients/client-cloudtrail/src/pagination/ListImportsPaginator.ts +++ b/clients/client-cloudtrail/src/pagination/ListImportsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudTrailClient } from "../CloudTrailClient"; import { ListImportsCommand, ListImportsCommandInput, ListImportsCommandOutput } from "../commands/ListImportsCommand"; import { CloudTrailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudTrailClient, - input: ListImportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImports( +export const paginateListImports: ( config: CloudTrailPaginationConfiguration, input: ListImportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImportsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudTrailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudTrail | CloudTrailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudTrailPaginationConfiguration, + ListImportsCommandInput, + ListImportsCommandOutput +>(CloudTrailClient, ListImportsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudtrail/src/pagination/ListPublicKeysPaginator.ts b/clients/client-cloudtrail/src/pagination/ListPublicKeysPaginator.ts index cbf14c700b2b..37d4498fe898 100644 --- a/clients/client-cloudtrail/src/pagination/ListPublicKeysPaginator.ts +++ b/clients/client-cloudtrail/src/pagination/ListPublicKeysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudTrailClient } from "../CloudTrailClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListPublicKeysCommand"; import { CloudTrailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudTrailClient, - input: ListPublicKeysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPublicKeysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPublicKeys( +export const paginateListPublicKeys: ( config: CloudTrailPaginationConfiguration, input: ListPublicKeysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPublicKeysCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof CloudTrailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudTrail | CloudTrailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudTrailPaginationConfiguration, + ListPublicKeysCommandInput, + ListPublicKeysCommandOutput +>(CloudTrailClient, ListPublicKeysCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-cloudtrail/src/pagination/ListQueriesPaginator.ts b/clients/client-cloudtrail/src/pagination/ListQueriesPaginator.ts index 42d34d5c6399..5217ade3aa1a 100644 --- a/clients/client-cloudtrail/src/pagination/ListQueriesPaginator.ts +++ b/clients/client-cloudtrail/src/pagination/ListQueriesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudTrailClient } from "../CloudTrailClient"; import { ListQueriesCommand, ListQueriesCommandInput, ListQueriesCommandOutput } from "../commands/ListQueriesCommand"; import { CloudTrailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudTrailClient, - input: ListQueriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListQueriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListQueries( +export const paginateListQueries: ( config: CloudTrailPaginationConfiguration, input: ListQueriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListQueriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudTrailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudTrail | CloudTrailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudTrailPaginationConfiguration, + ListQueriesCommandInput, + ListQueriesCommandOutput +>(CloudTrailClient, ListQueriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudtrail/src/pagination/ListTagsPaginator.ts b/clients/client-cloudtrail/src/pagination/ListTagsPaginator.ts index a621ca1f8638..f34c8c995afe 100644 --- a/clients/client-cloudtrail/src/pagination/ListTagsPaginator.ts +++ b/clients/client-cloudtrail/src/pagination/ListTagsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudTrailClient } from "../CloudTrailClient"; import { ListTagsCommand, ListTagsCommandInput, ListTagsCommandOutput } from "../commands/ListTagsCommand"; import { CloudTrailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudTrailClient, - input: ListTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTags( +export const paginateListTags: ( config: CloudTrailPaginationConfiguration, input: ListTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof CloudTrailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudTrail | CloudTrailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudTrailPaginationConfiguration, + ListTagsCommandInput, + ListTagsCommandOutput +>(CloudTrailClient, ListTagsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-cloudtrail/src/pagination/ListTrailsPaginator.ts b/clients/client-cloudtrail/src/pagination/ListTrailsPaginator.ts index 3f7b50f9cb23..ea7284e820e3 100644 --- a/clients/client-cloudtrail/src/pagination/ListTrailsPaginator.ts +++ b/clients/client-cloudtrail/src/pagination/ListTrailsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudTrailClient } from "../CloudTrailClient"; import { ListTrailsCommand, ListTrailsCommandInput, ListTrailsCommandOutput } from "../commands/ListTrailsCommand"; import { CloudTrailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudTrailClient, - input: ListTrailsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTrailsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTrails( +export const paginateListTrails: ( config: CloudTrailPaginationConfiguration, input: ListTrailsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTrailsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof CloudTrailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudTrail | CloudTrailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudTrailPaginationConfiguration, + ListTrailsCommandInput, + ListTrailsCommandOutput +>(CloudTrailClient, ListTrailsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-cloudtrail/src/pagination/LookupEventsPaginator.ts b/clients/client-cloudtrail/src/pagination/LookupEventsPaginator.ts index 5a2e037718a3..317f834e9138 100644 --- a/clients/client-cloudtrail/src/pagination/LookupEventsPaginator.ts +++ b/clients/client-cloudtrail/src/pagination/LookupEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudTrailClient } from "../CloudTrailClient"; @@ -9,42 +10,15 @@ import { } from "../commands/LookupEventsCommand"; import { CloudTrailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudTrailClient, - input: LookupEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new LookupEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateLookupEvents( +export const paginateLookupEvents: ( config: CloudTrailPaginationConfiguration, input: LookupEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: LookupEventsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudTrailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudTrail | CloudTrailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudTrailPaginationConfiguration, + LookupEventsCommandInput, + LookupEventsCommandOutput +>(CloudTrailClient, LookupEventsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudwatch-logs/package.json b/clients/client-cloudwatch-logs/package.json index 0709b189927b..7c1f08ad4911 100644 --- a/clients/client-cloudwatch-logs/package.json +++ b/clients/client-cloudwatch-logs/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/eventstream-serde-browser": "^2.0.15", "@smithy/eventstream-serde-config-resolver": "^2.0.15", "@smithy/eventstream-serde-node": "^2.0.15", diff --git a/clients/client-cloudwatch-logs/src/pagination/DescribeDeliveriesPaginator.ts b/clients/client-cloudwatch-logs/src/pagination/DescribeDeliveriesPaginator.ts index ca36c29aa66a..2eac8ad1d658 100644 --- a/clients/client-cloudwatch-logs/src/pagination/DescribeDeliveriesPaginator.ts +++ b/clients/client-cloudwatch-logs/src/pagination/DescribeDeliveriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchLogsClient } from "../CloudWatchLogsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeDeliveriesCommand"; import { CloudWatchLogsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchLogsClient, - input: DescribeDeliveriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDeliveriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDeliveries( +export const paginateDescribeDeliveries: ( config: CloudWatchLogsPaginationConfiguration, input: DescribeDeliveriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDeliveriesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof CloudWatchLogsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatchLogs | CloudWatchLogsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchLogsPaginationConfiguration, + DescribeDeliveriesCommandInput, + DescribeDeliveriesCommandOutput +>(CloudWatchLogsClient, DescribeDeliveriesCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-cloudwatch-logs/src/pagination/DescribeDeliveryDestinationsPaginator.ts b/clients/client-cloudwatch-logs/src/pagination/DescribeDeliveryDestinationsPaginator.ts index c76827f1fb9f..e3646df11a9c 100644 --- a/clients/client-cloudwatch-logs/src/pagination/DescribeDeliveryDestinationsPaginator.ts +++ b/clients/client-cloudwatch-logs/src/pagination/DescribeDeliveryDestinationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchLogsClient } from "../CloudWatchLogsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeDeliveryDestinationsCommand"; import { CloudWatchLogsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchLogsClient, - input: DescribeDeliveryDestinationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDeliveryDestinationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDeliveryDestinations( +export const paginateDescribeDeliveryDestinations: ( config: CloudWatchLogsPaginationConfiguration, input: DescribeDeliveryDestinationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDeliveryDestinationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof CloudWatchLogsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatchLogs | CloudWatchLogsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchLogsPaginationConfiguration, + DescribeDeliveryDestinationsCommandInput, + DescribeDeliveryDestinationsCommandOutput +>(CloudWatchLogsClient, DescribeDeliveryDestinationsCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-cloudwatch-logs/src/pagination/DescribeDeliverySourcesPaginator.ts b/clients/client-cloudwatch-logs/src/pagination/DescribeDeliverySourcesPaginator.ts index 846968e2ba27..1d30be49111b 100644 --- a/clients/client-cloudwatch-logs/src/pagination/DescribeDeliverySourcesPaginator.ts +++ b/clients/client-cloudwatch-logs/src/pagination/DescribeDeliverySourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchLogsClient } from "../CloudWatchLogsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeDeliverySourcesCommand"; import { CloudWatchLogsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchLogsClient, - input: DescribeDeliverySourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDeliverySourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDeliverySources( +export const paginateDescribeDeliverySources: ( config: CloudWatchLogsPaginationConfiguration, input: DescribeDeliverySourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDeliverySourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof CloudWatchLogsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatchLogs | CloudWatchLogsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchLogsPaginationConfiguration, + DescribeDeliverySourcesCommandInput, + DescribeDeliverySourcesCommandOutput +>(CloudWatchLogsClient, DescribeDeliverySourcesCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-cloudwatch-logs/src/pagination/DescribeDestinationsPaginator.ts b/clients/client-cloudwatch-logs/src/pagination/DescribeDestinationsPaginator.ts index 93c34969729e..cd8864a34b81 100644 --- a/clients/client-cloudwatch-logs/src/pagination/DescribeDestinationsPaginator.ts +++ b/clients/client-cloudwatch-logs/src/pagination/DescribeDestinationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchLogsClient } from "../CloudWatchLogsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeDestinationsCommand"; import { CloudWatchLogsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchLogsClient, - input: DescribeDestinationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDestinationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDestinations( +export const paginateDescribeDestinations: ( config: CloudWatchLogsPaginationConfiguration, input: DescribeDestinationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDestinationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof CloudWatchLogsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatchLogs | CloudWatchLogsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchLogsPaginationConfiguration, + DescribeDestinationsCommandInput, + DescribeDestinationsCommandOutput +>(CloudWatchLogsClient, DescribeDestinationsCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-cloudwatch-logs/src/pagination/DescribeLogGroupsPaginator.ts b/clients/client-cloudwatch-logs/src/pagination/DescribeLogGroupsPaginator.ts index 1407bd165c48..493a08dc2550 100644 --- a/clients/client-cloudwatch-logs/src/pagination/DescribeLogGroupsPaginator.ts +++ b/clients/client-cloudwatch-logs/src/pagination/DescribeLogGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchLogsClient } from "../CloudWatchLogsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeLogGroupsCommand"; import { CloudWatchLogsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchLogsClient, - input: DescribeLogGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLogGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLogGroups( +export const paginateDescribeLogGroups: ( config: CloudWatchLogsPaginationConfiguration, input: DescribeLogGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLogGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof CloudWatchLogsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatchLogs | CloudWatchLogsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchLogsPaginationConfiguration, + DescribeLogGroupsCommandInput, + DescribeLogGroupsCommandOutput +>(CloudWatchLogsClient, DescribeLogGroupsCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-cloudwatch-logs/src/pagination/DescribeLogStreamsPaginator.ts b/clients/client-cloudwatch-logs/src/pagination/DescribeLogStreamsPaginator.ts index b6c0f5b8c593..f490d5ab989d 100644 --- a/clients/client-cloudwatch-logs/src/pagination/DescribeLogStreamsPaginator.ts +++ b/clients/client-cloudwatch-logs/src/pagination/DescribeLogStreamsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchLogsClient } from "../CloudWatchLogsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeLogStreamsCommand"; import { CloudWatchLogsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchLogsClient, - input: DescribeLogStreamsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLogStreamsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLogStreams( +export const paginateDescribeLogStreams: ( config: CloudWatchLogsPaginationConfiguration, input: DescribeLogStreamsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLogStreamsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof CloudWatchLogsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatchLogs | CloudWatchLogsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchLogsPaginationConfiguration, + DescribeLogStreamsCommandInput, + DescribeLogStreamsCommandOutput +>(CloudWatchLogsClient, DescribeLogStreamsCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-cloudwatch-logs/src/pagination/DescribeMetricFiltersPaginator.ts b/clients/client-cloudwatch-logs/src/pagination/DescribeMetricFiltersPaginator.ts index b428cec08078..d888ce45a295 100644 --- a/clients/client-cloudwatch-logs/src/pagination/DescribeMetricFiltersPaginator.ts +++ b/clients/client-cloudwatch-logs/src/pagination/DescribeMetricFiltersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchLogsClient } from "../CloudWatchLogsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeMetricFiltersCommand"; import { CloudWatchLogsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchLogsClient, - input: DescribeMetricFiltersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMetricFiltersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMetricFilters( +export const paginateDescribeMetricFilters: ( config: CloudWatchLogsPaginationConfiguration, input: DescribeMetricFiltersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMetricFiltersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof CloudWatchLogsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatchLogs | CloudWatchLogsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchLogsPaginationConfiguration, + DescribeMetricFiltersCommandInput, + DescribeMetricFiltersCommandOutput +>(CloudWatchLogsClient, DescribeMetricFiltersCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-cloudwatch-logs/src/pagination/DescribeSubscriptionFiltersPaginator.ts b/clients/client-cloudwatch-logs/src/pagination/DescribeSubscriptionFiltersPaginator.ts index 52cb7d786fb0..1a5dd82752e5 100644 --- a/clients/client-cloudwatch-logs/src/pagination/DescribeSubscriptionFiltersPaginator.ts +++ b/clients/client-cloudwatch-logs/src/pagination/DescribeSubscriptionFiltersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchLogsClient } from "../CloudWatchLogsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeSubscriptionFiltersCommand"; import { CloudWatchLogsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchLogsClient, - input: DescribeSubscriptionFiltersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSubscriptionFiltersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSubscriptionFilters( +export const paginateDescribeSubscriptionFilters: ( config: CloudWatchLogsPaginationConfiguration, input: DescribeSubscriptionFiltersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSubscriptionFiltersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof CloudWatchLogsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatchLogs | CloudWatchLogsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchLogsPaginationConfiguration, + DescribeSubscriptionFiltersCommandInput, + DescribeSubscriptionFiltersCommandOutput +>(CloudWatchLogsClient, DescribeSubscriptionFiltersCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-cloudwatch-logs/src/pagination/FilterLogEventsPaginator.ts b/clients/client-cloudwatch-logs/src/pagination/FilterLogEventsPaginator.ts index ccef057d8557..d2ac6cf59d5c 100644 --- a/clients/client-cloudwatch-logs/src/pagination/FilterLogEventsPaginator.ts +++ b/clients/client-cloudwatch-logs/src/pagination/FilterLogEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchLogsClient } from "../CloudWatchLogsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/FilterLogEventsCommand"; import { CloudWatchLogsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchLogsClient, - input: FilterLogEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new FilterLogEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateFilterLogEvents( +export const paginateFilterLogEvents: ( config: CloudWatchLogsPaginationConfiguration, input: FilterLogEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: FilterLogEventsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof CloudWatchLogsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatchLogs | CloudWatchLogsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchLogsPaginationConfiguration, + FilterLogEventsCommandInput, + FilterLogEventsCommandOutput +>(CloudWatchLogsClient, FilterLogEventsCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-cloudwatch-logs/src/pagination/GetLogEventsPaginator.ts b/clients/client-cloudwatch-logs/src/pagination/GetLogEventsPaginator.ts index 308530977fa0..97f219a48262 100644 --- a/clients/client-cloudwatch-logs/src/pagination/GetLogEventsPaginator.ts +++ b/clients/client-cloudwatch-logs/src/pagination/GetLogEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchLogsClient } from "../CloudWatchLogsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetLogEventsCommand"; import { CloudWatchLogsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchLogsClient, - input: GetLogEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetLogEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetLogEvents( +export const paginateGetLogEvents: ( config: CloudWatchLogsPaginationConfiguration, input: GetLogEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetLogEventsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof CloudWatchLogsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatchLogs | CloudWatchLogsClient"); - } - yield page; - const prevToken = token; - token = page.nextForwardToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchLogsPaginationConfiguration, + GetLogEventsCommandInput, + GetLogEventsCommandOutput +>(CloudWatchLogsClient, GetLogEventsCommand, "nextToken", "nextForwardToken", "limit"); diff --git a/clients/client-cloudwatch-logs/src/pagination/ListAnomaliesPaginator.ts b/clients/client-cloudwatch-logs/src/pagination/ListAnomaliesPaginator.ts index be334a441ad6..5b46fdb76344 100644 --- a/clients/client-cloudwatch-logs/src/pagination/ListAnomaliesPaginator.ts +++ b/clients/client-cloudwatch-logs/src/pagination/ListAnomaliesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchLogsClient } from "../CloudWatchLogsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAnomaliesCommand"; import { CloudWatchLogsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchLogsClient, - input: ListAnomaliesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnomaliesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnomalies( +export const paginateListAnomalies: ( config: CloudWatchLogsPaginationConfiguration, input: ListAnomaliesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnomaliesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof CloudWatchLogsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatchLogs | CloudWatchLogsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchLogsPaginationConfiguration, + ListAnomaliesCommandInput, + ListAnomaliesCommandOutput +>(CloudWatchLogsClient, ListAnomaliesCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-cloudwatch-logs/src/pagination/ListLogAnomalyDetectorsPaginator.ts b/clients/client-cloudwatch-logs/src/pagination/ListLogAnomalyDetectorsPaginator.ts index aefdcfb9b949..4ede215808aa 100644 --- a/clients/client-cloudwatch-logs/src/pagination/ListLogAnomalyDetectorsPaginator.ts +++ b/clients/client-cloudwatch-logs/src/pagination/ListLogAnomalyDetectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchLogsClient } from "../CloudWatchLogsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListLogAnomalyDetectorsCommand"; import { CloudWatchLogsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchLogsClient, - input: ListLogAnomalyDetectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLogAnomalyDetectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLogAnomalyDetectors( +export const paginateListLogAnomalyDetectors: ( config: CloudWatchLogsPaginationConfiguration, input: ListLogAnomalyDetectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLogAnomalyDetectorsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof CloudWatchLogsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatchLogs | CloudWatchLogsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchLogsPaginationConfiguration, + ListLogAnomalyDetectorsCommandInput, + ListLogAnomalyDetectorsCommandOutput +>(CloudWatchLogsClient, ListLogAnomalyDetectorsCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-cloudwatch/package.json b/clients/client-cloudwatch/package.json index 74b978691ecb..d1c49dd88f74 100644 --- a/clients/client-cloudwatch/package.json +++ b/clients/client-cloudwatch/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-cloudwatch/src/pagination/DescribeAlarmHistoryPaginator.ts b/clients/client-cloudwatch/src/pagination/DescribeAlarmHistoryPaginator.ts index 718b115165a0..83e36abece83 100644 --- a/clients/client-cloudwatch/src/pagination/DescribeAlarmHistoryPaginator.ts +++ b/clients/client-cloudwatch/src/pagination/DescribeAlarmHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchClient } from "../CloudWatchClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeAlarmHistoryCommand"; import { CloudWatchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchClient, - input: DescribeAlarmHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAlarmHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAlarmHistory( +export const paginateDescribeAlarmHistory: ( config: CloudWatchPaginationConfiguration, input: DescribeAlarmHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAlarmHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof CloudWatchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatch | CloudWatchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchPaginationConfiguration, + DescribeAlarmHistoryCommandInput, + DescribeAlarmHistoryCommandOutput +>(CloudWatchClient, DescribeAlarmHistoryCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-cloudwatch/src/pagination/DescribeAlarmsPaginator.ts b/clients/client-cloudwatch/src/pagination/DescribeAlarmsPaginator.ts index c72f90aec7d4..112e5e9a88d3 100644 --- a/clients/client-cloudwatch/src/pagination/DescribeAlarmsPaginator.ts +++ b/clients/client-cloudwatch/src/pagination/DescribeAlarmsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchClient } from "../CloudWatchClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeAlarmsCommand"; import { CloudWatchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchClient, - input: DescribeAlarmsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAlarmsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAlarms( +export const paginateDescribeAlarms: ( config: CloudWatchPaginationConfiguration, input: DescribeAlarmsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAlarmsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof CloudWatchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatch | CloudWatchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchPaginationConfiguration, + DescribeAlarmsCommandInput, + DescribeAlarmsCommandOutput +>(CloudWatchClient, DescribeAlarmsCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-cloudwatch/src/pagination/DescribeAnomalyDetectorsPaginator.ts b/clients/client-cloudwatch/src/pagination/DescribeAnomalyDetectorsPaginator.ts index 0fc71cb2beef..772156493dfc 100644 --- a/clients/client-cloudwatch/src/pagination/DescribeAnomalyDetectorsPaginator.ts +++ b/clients/client-cloudwatch/src/pagination/DescribeAnomalyDetectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchClient } from "../CloudWatchClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeAnomalyDetectorsCommand"; import { CloudWatchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchClient, - input: DescribeAnomalyDetectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAnomalyDetectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAnomalyDetectors( +export const paginateDescribeAnomalyDetectors: ( config: CloudWatchPaginationConfiguration, input: DescribeAnomalyDetectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAnomalyDetectorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudWatchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatch | CloudWatchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchPaginationConfiguration, + DescribeAnomalyDetectorsCommandInput, + DescribeAnomalyDetectorsCommandOutput +>(CloudWatchClient, DescribeAnomalyDetectorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudwatch/src/pagination/DescribeInsightRulesPaginator.ts b/clients/client-cloudwatch/src/pagination/DescribeInsightRulesPaginator.ts index b46f04d011ba..397c74cad60d 100644 --- a/clients/client-cloudwatch/src/pagination/DescribeInsightRulesPaginator.ts +++ b/clients/client-cloudwatch/src/pagination/DescribeInsightRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchClient } from "../CloudWatchClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeInsightRulesCommand"; import { CloudWatchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchClient, - input: DescribeInsightRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInsightRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInsightRules( +export const paginateDescribeInsightRules: ( config: CloudWatchPaginationConfiguration, input: DescribeInsightRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInsightRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudWatchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatch | CloudWatchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchPaginationConfiguration, + DescribeInsightRulesCommandInput, + DescribeInsightRulesCommandOutput +>(CloudWatchClient, DescribeInsightRulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudwatch/src/pagination/GetMetricDataPaginator.ts b/clients/client-cloudwatch/src/pagination/GetMetricDataPaginator.ts index 8234cf12bef4..6b1442731e8a 100644 --- a/clients/client-cloudwatch/src/pagination/GetMetricDataPaginator.ts +++ b/clients/client-cloudwatch/src/pagination/GetMetricDataPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchClient } from "../CloudWatchClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetMetricDataCommand"; import { CloudWatchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchClient, - input: GetMetricDataCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetMetricDataCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetMetricData( +export const paginateGetMetricData: ( config: CloudWatchPaginationConfiguration, input: GetMetricDataCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetMetricDataCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxDatapoints"] = config.pageSize; - if (config.client instanceof CloudWatchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatch | CloudWatchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchPaginationConfiguration, + GetMetricDataCommandInput, + GetMetricDataCommandOutput +>(CloudWatchClient, GetMetricDataCommand, "NextToken", "NextToken", "MaxDatapoints"); diff --git a/clients/client-cloudwatch/src/pagination/ListDashboardsPaginator.ts b/clients/client-cloudwatch/src/pagination/ListDashboardsPaginator.ts index 092fe9421b57..688b9317759b 100644 --- a/clients/client-cloudwatch/src/pagination/ListDashboardsPaginator.ts +++ b/clients/client-cloudwatch/src/pagination/ListDashboardsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchClient } from "../CloudWatchClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListDashboardsCommand"; import { CloudWatchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchClient, - input: ListDashboardsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDashboardsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDashboards( +export const paginateListDashboards: ( config: CloudWatchPaginationConfiguration, input: ListDashboardsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDashboardsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof CloudWatchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatch | CloudWatchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchPaginationConfiguration, + ListDashboardsCommandInput, + ListDashboardsCommandOutput +>(CloudWatchClient, ListDashboardsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-cloudwatch/src/pagination/ListManagedInsightRulesPaginator.ts b/clients/client-cloudwatch/src/pagination/ListManagedInsightRulesPaginator.ts index 543ec1d11139..bdbee388d175 100644 --- a/clients/client-cloudwatch/src/pagination/ListManagedInsightRulesPaginator.ts +++ b/clients/client-cloudwatch/src/pagination/ListManagedInsightRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchClient } from "../CloudWatchClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListManagedInsightRulesCommand"; import { CloudWatchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchClient, - input: ListManagedInsightRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListManagedInsightRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListManagedInsightRules( +export const paginateListManagedInsightRules: ( config: CloudWatchPaginationConfiguration, input: ListManagedInsightRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListManagedInsightRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudWatchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatch | CloudWatchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchPaginationConfiguration, + ListManagedInsightRulesCommandInput, + ListManagedInsightRulesCommandOutput +>(CloudWatchClient, ListManagedInsightRulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudwatch/src/pagination/ListMetricStreamsPaginator.ts b/clients/client-cloudwatch/src/pagination/ListMetricStreamsPaginator.ts index f43f7df14c3a..6b22a7411272 100644 --- a/clients/client-cloudwatch/src/pagination/ListMetricStreamsPaginator.ts +++ b/clients/client-cloudwatch/src/pagination/ListMetricStreamsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchClient } from "../CloudWatchClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListMetricStreamsCommand"; import { CloudWatchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchClient, - input: ListMetricStreamsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMetricStreamsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMetricStreams( +export const paginateListMetricStreams: ( config: CloudWatchPaginationConfiguration, input: ListMetricStreamsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMetricStreamsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CloudWatchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatch | CloudWatchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchPaginationConfiguration, + ListMetricStreamsCommandInput, + ListMetricStreamsCommandOutput +>(CloudWatchClient, ListMetricStreamsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cloudwatch/src/pagination/ListMetricsPaginator.ts b/clients/client-cloudwatch/src/pagination/ListMetricsPaginator.ts index 931c878335d8..3cb3d313b877 100644 --- a/clients/client-cloudwatch/src/pagination/ListMetricsPaginator.ts +++ b/clients/client-cloudwatch/src/pagination/ListMetricsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CloudWatchClient } from "../CloudWatchClient"; import { ListMetricsCommand, ListMetricsCommandInput, ListMetricsCommandOutput } from "../commands/ListMetricsCommand"; import { CloudWatchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CloudWatchClient, - input: ListMetricsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMetricsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMetrics( +export const paginateListMetrics: ( config: CloudWatchPaginationConfiguration, input: ListMetricsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMetricsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof CloudWatchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CloudWatch | CloudWatchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CloudWatchPaginationConfiguration, + ListMetricsCommandInput, + ListMetricsCommandOutput +>(CloudWatchClient, ListMetricsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-codeartifact/src/pagination/ListDomainsPaginator.ts b/clients/client-codeartifact/src/pagination/ListDomainsPaginator.ts index 945610a1e542..cf3c2aa04f82 100644 --- a/clients/client-codeartifact/src/pagination/ListDomainsPaginator.ts +++ b/clients/client-codeartifact/src/pagination/ListDomainsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeartifactClient } from "../CodeartifactClient"; import { ListDomainsCommand, ListDomainsCommandInput, ListDomainsCommandOutput } from "../commands/ListDomainsCommand"; import { CodeartifactPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeartifactClient, - input: ListDomainsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomains( +export const paginateListDomains: ( config: CodeartifactPaginationConfiguration, input: ListDomainsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeartifactClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Codeartifact | CodeartifactClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeartifactPaginationConfiguration, + ListDomainsCommandInput, + ListDomainsCommandOutput +>(CodeartifactClient, ListDomainsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codeartifact/src/pagination/ListPackageVersionAssetsPaginator.ts b/clients/client-codeartifact/src/pagination/ListPackageVersionAssetsPaginator.ts index dbcce945e97c..776d73253650 100644 --- a/clients/client-codeartifact/src/pagination/ListPackageVersionAssetsPaginator.ts +++ b/clients/client-codeartifact/src/pagination/ListPackageVersionAssetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeartifactClient } from "../CodeartifactClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPackageVersionAssetsCommand"; import { CodeartifactPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeartifactClient, - input: ListPackageVersionAssetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPackageVersionAssetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPackageVersionAssets( +export const paginateListPackageVersionAssets: ( config: CodeartifactPaginationConfiguration, input: ListPackageVersionAssetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPackageVersionAssetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeartifactClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Codeartifact | CodeartifactClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeartifactPaginationConfiguration, + ListPackageVersionAssetsCommandInput, + ListPackageVersionAssetsCommandOutput +>(CodeartifactClient, ListPackageVersionAssetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codeartifact/src/pagination/ListPackageVersionsPaginator.ts b/clients/client-codeartifact/src/pagination/ListPackageVersionsPaginator.ts index 67d1108b73d5..083aecb91ec6 100644 --- a/clients/client-codeartifact/src/pagination/ListPackageVersionsPaginator.ts +++ b/clients/client-codeartifact/src/pagination/ListPackageVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeartifactClient } from "../CodeartifactClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPackageVersionsCommand"; import { CodeartifactPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeartifactClient, - input: ListPackageVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPackageVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPackageVersions( +export const paginateListPackageVersions: ( config: CodeartifactPaginationConfiguration, input: ListPackageVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPackageVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeartifactClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Codeartifact | CodeartifactClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeartifactPaginationConfiguration, + ListPackageVersionsCommandInput, + ListPackageVersionsCommandOutput +>(CodeartifactClient, ListPackageVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codeartifact/src/pagination/ListPackagesPaginator.ts b/clients/client-codeartifact/src/pagination/ListPackagesPaginator.ts index 4f7cda0e05e7..5df1049208e1 100644 --- a/clients/client-codeartifact/src/pagination/ListPackagesPaginator.ts +++ b/clients/client-codeartifact/src/pagination/ListPackagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeartifactClient } from "../CodeartifactClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPackagesCommand"; import { CodeartifactPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeartifactClient, - input: ListPackagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPackagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPackages( +export const paginateListPackages: ( config: CodeartifactPaginationConfiguration, input: ListPackagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPackagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeartifactClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Codeartifact | CodeartifactClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeartifactPaginationConfiguration, + ListPackagesCommandInput, + ListPackagesCommandOutput +>(CodeartifactClient, ListPackagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codeartifact/src/pagination/ListRepositoriesInDomainPaginator.ts b/clients/client-codeartifact/src/pagination/ListRepositoriesInDomainPaginator.ts index eb81782c11d4..9ee8a4201b6e 100644 --- a/clients/client-codeartifact/src/pagination/ListRepositoriesInDomainPaginator.ts +++ b/clients/client-codeartifact/src/pagination/ListRepositoriesInDomainPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeartifactClient } from "../CodeartifactClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRepositoriesInDomainCommand"; import { CodeartifactPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeartifactClient, - input: ListRepositoriesInDomainCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRepositoriesInDomainCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRepositoriesInDomain( +export const paginateListRepositoriesInDomain: ( config: CodeartifactPaginationConfiguration, input: ListRepositoriesInDomainCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRepositoriesInDomainCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeartifactClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Codeartifact | CodeartifactClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeartifactPaginationConfiguration, + ListRepositoriesInDomainCommandInput, + ListRepositoriesInDomainCommandOutput +>(CodeartifactClient, ListRepositoriesInDomainCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codeartifact/src/pagination/ListRepositoriesPaginator.ts b/clients/client-codeartifact/src/pagination/ListRepositoriesPaginator.ts index e29ed24b97f0..34b85b1a841c 100644 --- a/clients/client-codeartifact/src/pagination/ListRepositoriesPaginator.ts +++ b/clients/client-codeartifact/src/pagination/ListRepositoriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeartifactClient } from "../CodeartifactClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRepositoriesCommand"; import { CodeartifactPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeartifactClient, - input: ListRepositoriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRepositoriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRepositories( +export const paginateListRepositories: ( config: CodeartifactPaginationConfiguration, input: ListRepositoriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRepositoriesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeartifactClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Codeartifact | CodeartifactClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeartifactPaginationConfiguration, + ListRepositoriesCommandInput, + ListRepositoriesCommandOutput +>(CodeartifactClient, ListRepositoriesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codebuild/package.json b/clients/client-codebuild/package.json index fa762d50fcc1..6b7992ddf800 100644 --- a/clients/client-codebuild/package.json +++ b/clients/client-codebuild/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-codebuild/src/pagination/DescribeCodeCoveragesPaginator.ts b/clients/client-codebuild/src/pagination/DescribeCodeCoveragesPaginator.ts index 4300e484c7cc..6875cdd5fcb3 100644 --- a/clients/client-codebuild/src/pagination/DescribeCodeCoveragesPaginator.ts +++ b/clients/client-codebuild/src/pagination/DescribeCodeCoveragesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeBuildClient } from "../CodeBuildClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeCodeCoveragesCommand"; import { CodeBuildPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeBuildClient, - input: DescribeCodeCoveragesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCodeCoveragesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCodeCoverages( +export const paginateDescribeCodeCoverages: ( config: CodeBuildPaginationConfiguration, input: DescribeCodeCoveragesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCodeCoveragesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeBuildClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeBuild | CodeBuildClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeBuildPaginationConfiguration, + DescribeCodeCoveragesCommandInput, + DescribeCodeCoveragesCommandOutput +>(CodeBuildClient, DescribeCodeCoveragesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codebuild/src/pagination/DescribeTestCasesPaginator.ts b/clients/client-codebuild/src/pagination/DescribeTestCasesPaginator.ts index 56d9aae2d26c..d488847d16fd 100644 --- a/clients/client-codebuild/src/pagination/DescribeTestCasesPaginator.ts +++ b/clients/client-codebuild/src/pagination/DescribeTestCasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeBuildClient } from "../CodeBuildClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeTestCasesCommand"; import { CodeBuildPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeBuildClient, - input: DescribeTestCasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTestCasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTestCases( +export const paginateDescribeTestCases: ( config: CodeBuildPaginationConfiguration, input: DescribeTestCasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTestCasesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeBuildClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeBuild | CodeBuildClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeBuildPaginationConfiguration, + DescribeTestCasesCommandInput, + DescribeTestCasesCommandOutput +>(CodeBuildClient, DescribeTestCasesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codebuild/src/pagination/ListBuildBatchesForProjectPaginator.ts b/clients/client-codebuild/src/pagination/ListBuildBatchesForProjectPaginator.ts index ec821ae2c63d..4b6ad51a8a98 100644 --- a/clients/client-codebuild/src/pagination/ListBuildBatchesForProjectPaginator.ts +++ b/clients/client-codebuild/src/pagination/ListBuildBatchesForProjectPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeBuildClient } from "../CodeBuildClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListBuildBatchesForProjectCommand"; import { CodeBuildPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeBuildClient, - input: ListBuildBatchesForProjectCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBuildBatchesForProjectCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBuildBatchesForProject( +export const paginateListBuildBatchesForProject: ( config: CodeBuildPaginationConfiguration, input: ListBuildBatchesForProjectCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBuildBatchesForProjectCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeBuildClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeBuild | CodeBuildClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeBuildPaginationConfiguration, + ListBuildBatchesForProjectCommandInput, + ListBuildBatchesForProjectCommandOutput +>(CodeBuildClient, ListBuildBatchesForProjectCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codebuild/src/pagination/ListBuildBatchesPaginator.ts b/clients/client-codebuild/src/pagination/ListBuildBatchesPaginator.ts index 8085d59dfd71..5023d7fc094c 100644 --- a/clients/client-codebuild/src/pagination/ListBuildBatchesPaginator.ts +++ b/clients/client-codebuild/src/pagination/ListBuildBatchesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeBuildClient } from "../CodeBuildClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListBuildBatchesCommand"; import { CodeBuildPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeBuildClient, - input: ListBuildBatchesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBuildBatchesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBuildBatches( +export const paginateListBuildBatches: ( config: CodeBuildPaginationConfiguration, input: ListBuildBatchesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBuildBatchesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeBuildClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeBuild | CodeBuildClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeBuildPaginationConfiguration, + ListBuildBatchesCommandInput, + ListBuildBatchesCommandOutput +>(CodeBuildClient, ListBuildBatchesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codebuild/src/pagination/ListBuildsForProjectPaginator.ts b/clients/client-codebuild/src/pagination/ListBuildsForProjectPaginator.ts index a0fe9b76568d..ef7cbe8cfa5e 100644 --- a/clients/client-codebuild/src/pagination/ListBuildsForProjectPaginator.ts +++ b/clients/client-codebuild/src/pagination/ListBuildsForProjectPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeBuildClient } from "../CodeBuildClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListBuildsForProjectCommand"; import { CodeBuildPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeBuildClient, - input: ListBuildsForProjectCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBuildsForProjectCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBuildsForProject( +export const paginateListBuildsForProject: ( config: CodeBuildPaginationConfiguration, input: ListBuildsForProjectCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBuildsForProjectCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof CodeBuildClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeBuild | CodeBuildClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeBuildPaginationConfiguration, + ListBuildsForProjectCommandInput, + ListBuildsForProjectCommandOutput +>(CodeBuildClient, ListBuildsForProjectCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-codebuild/src/pagination/ListBuildsPaginator.ts b/clients/client-codebuild/src/pagination/ListBuildsPaginator.ts index 93cfb8d2a8d9..bcf6b0c68bc1 100644 --- a/clients/client-codebuild/src/pagination/ListBuildsPaginator.ts +++ b/clients/client-codebuild/src/pagination/ListBuildsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeBuildClient } from "../CodeBuildClient"; import { ListBuildsCommand, ListBuildsCommandInput, ListBuildsCommandOutput } from "../commands/ListBuildsCommand"; import { CodeBuildPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeBuildClient, - input: ListBuildsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBuildsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBuilds( +export const paginateListBuilds: ( config: CodeBuildPaginationConfiguration, input: ListBuildsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBuildsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof CodeBuildClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeBuild | CodeBuildClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeBuildPaginationConfiguration, + ListBuildsCommandInput, + ListBuildsCommandOutput +>(CodeBuildClient, ListBuildsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-codebuild/src/pagination/ListProjectsPaginator.ts b/clients/client-codebuild/src/pagination/ListProjectsPaginator.ts index 8f7b40d96098..daa458489135 100644 --- a/clients/client-codebuild/src/pagination/ListProjectsPaginator.ts +++ b/clients/client-codebuild/src/pagination/ListProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeBuildClient } from "../CodeBuildClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListProjectsCommand"; import { CodeBuildPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeBuildClient, - input: ListProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProjects( +export const paginateListProjects: ( config: CodeBuildPaginationConfiguration, input: ListProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProjectsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof CodeBuildClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeBuild | CodeBuildClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeBuildPaginationConfiguration, + ListProjectsCommandInput, + ListProjectsCommandOutput +>(CodeBuildClient, ListProjectsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-codebuild/src/pagination/ListReportGroupsPaginator.ts b/clients/client-codebuild/src/pagination/ListReportGroupsPaginator.ts index 6c416553cdaf..7a64e5cc9bbb 100644 --- a/clients/client-codebuild/src/pagination/ListReportGroupsPaginator.ts +++ b/clients/client-codebuild/src/pagination/ListReportGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeBuildClient } from "../CodeBuildClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListReportGroupsCommand"; import { CodeBuildPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeBuildClient, - input: ListReportGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReportGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReportGroups( +export const paginateListReportGroups: ( config: CodeBuildPaginationConfiguration, input: ListReportGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReportGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeBuildClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeBuild | CodeBuildClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeBuildPaginationConfiguration, + ListReportGroupsCommandInput, + ListReportGroupsCommandOutput +>(CodeBuildClient, ListReportGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codebuild/src/pagination/ListReportsForReportGroupPaginator.ts b/clients/client-codebuild/src/pagination/ListReportsForReportGroupPaginator.ts index 25529217ea1f..6b2eca7336cd 100644 --- a/clients/client-codebuild/src/pagination/ListReportsForReportGroupPaginator.ts +++ b/clients/client-codebuild/src/pagination/ListReportsForReportGroupPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeBuildClient } from "../CodeBuildClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListReportsForReportGroupCommand"; import { CodeBuildPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeBuildClient, - input: ListReportsForReportGroupCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReportsForReportGroupCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReportsForReportGroup( +export const paginateListReportsForReportGroup: ( config: CodeBuildPaginationConfiguration, input: ListReportsForReportGroupCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReportsForReportGroupCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeBuildClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeBuild | CodeBuildClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeBuildPaginationConfiguration, + ListReportsForReportGroupCommandInput, + ListReportsForReportGroupCommandOutput +>(CodeBuildClient, ListReportsForReportGroupCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codebuild/src/pagination/ListReportsPaginator.ts b/clients/client-codebuild/src/pagination/ListReportsPaginator.ts index 883ef241d1cd..a65ad6b4a15f 100644 --- a/clients/client-codebuild/src/pagination/ListReportsPaginator.ts +++ b/clients/client-codebuild/src/pagination/ListReportsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeBuildClient } from "../CodeBuildClient"; import { ListReportsCommand, ListReportsCommandInput, ListReportsCommandOutput } from "../commands/ListReportsCommand"; import { CodeBuildPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeBuildClient, - input: ListReportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReports( +export const paginateListReports: ( config: CodeBuildPaginationConfiguration, input: ListReportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReportsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeBuildClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeBuild | CodeBuildClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeBuildPaginationConfiguration, + ListReportsCommandInput, + ListReportsCommandOutput +>(CodeBuildClient, ListReportsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codebuild/src/pagination/ListSharedProjectsPaginator.ts b/clients/client-codebuild/src/pagination/ListSharedProjectsPaginator.ts index 369b7c86f090..c53630929a6d 100644 --- a/clients/client-codebuild/src/pagination/ListSharedProjectsPaginator.ts +++ b/clients/client-codebuild/src/pagination/ListSharedProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeBuildClient } from "../CodeBuildClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSharedProjectsCommand"; import { CodeBuildPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeBuildClient, - input: ListSharedProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSharedProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSharedProjects( +export const paginateListSharedProjects: ( config: CodeBuildPaginationConfiguration, input: ListSharedProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSharedProjectsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeBuildClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeBuild | CodeBuildClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeBuildPaginationConfiguration, + ListSharedProjectsCommandInput, + ListSharedProjectsCommandOutput +>(CodeBuildClient, ListSharedProjectsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codebuild/src/pagination/ListSharedReportGroupsPaginator.ts b/clients/client-codebuild/src/pagination/ListSharedReportGroupsPaginator.ts index 584720654c33..1fb5b0822f00 100644 --- a/clients/client-codebuild/src/pagination/ListSharedReportGroupsPaginator.ts +++ b/clients/client-codebuild/src/pagination/ListSharedReportGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeBuildClient } from "../CodeBuildClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSharedReportGroupsCommand"; import { CodeBuildPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeBuildClient, - input: ListSharedReportGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSharedReportGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSharedReportGroups( +export const paginateListSharedReportGroups: ( config: CodeBuildPaginationConfiguration, input: ListSharedReportGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSharedReportGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeBuildClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeBuild | CodeBuildClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeBuildPaginationConfiguration, + ListSharedReportGroupsCommandInput, + ListSharedReportGroupsCommandOutput +>(CodeBuildClient, ListSharedReportGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecatalyst/src/pagination/ListAccessTokensPaginator.ts b/clients/client-codecatalyst/src/pagination/ListAccessTokensPaginator.ts index 5c80b77e24d2..6c7073a0c433 100644 --- a/clients/client-codecatalyst/src/pagination/ListAccessTokensPaginator.ts +++ b/clients/client-codecatalyst/src/pagination/ListAccessTokensPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCatalystClient } from "../CodeCatalystClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAccessTokensCommand"; import { CodeCatalystPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCatalystClient, - input: ListAccessTokensCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessTokensCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessTokens( +export const paginateListAccessTokens: ( config: CodeCatalystPaginationConfiguration, input: ListAccessTokensCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessTokensCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCatalystClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCatalyst | CodeCatalystClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCatalystPaginationConfiguration, + ListAccessTokensCommandInput, + ListAccessTokensCommandOutput +>(CodeCatalystClient, ListAccessTokensCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecatalyst/src/pagination/ListDevEnvironmentSessionsPaginator.ts b/clients/client-codecatalyst/src/pagination/ListDevEnvironmentSessionsPaginator.ts index c2bf2ebc24e8..564e15312cf8 100644 --- a/clients/client-codecatalyst/src/pagination/ListDevEnvironmentSessionsPaginator.ts +++ b/clients/client-codecatalyst/src/pagination/ListDevEnvironmentSessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCatalystClient } from "../CodeCatalystClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListDevEnvironmentSessionsCommand"; import { CodeCatalystPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCatalystClient, - input: ListDevEnvironmentSessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDevEnvironmentSessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDevEnvironmentSessions( +export const paginateListDevEnvironmentSessions: ( config: CodeCatalystPaginationConfiguration, input: ListDevEnvironmentSessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDevEnvironmentSessionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCatalystClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCatalyst | CodeCatalystClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCatalystPaginationConfiguration, + ListDevEnvironmentSessionsCommandInput, + ListDevEnvironmentSessionsCommandOutput +>(CodeCatalystClient, ListDevEnvironmentSessionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecatalyst/src/pagination/ListDevEnvironmentsPaginator.ts b/clients/client-codecatalyst/src/pagination/ListDevEnvironmentsPaginator.ts index b4704844e147..e37260ca2ac1 100644 --- a/clients/client-codecatalyst/src/pagination/ListDevEnvironmentsPaginator.ts +++ b/clients/client-codecatalyst/src/pagination/ListDevEnvironmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCatalystClient } from "../CodeCatalystClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListDevEnvironmentsCommand"; import { CodeCatalystPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCatalystClient, - input: ListDevEnvironmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDevEnvironmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDevEnvironments( +export const paginateListDevEnvironments: ( config: CodeCatalystPaginationConfiguration, input: ListDevEnvironmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDevEnvironmentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCatalystClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCatalyst | CodeCatalystClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCatalystPaginationConfiguration, + ListDevEnvironmentsCommandInput, + ListDevEnvironmentsCommandOutput +>(CodeCatalystClient, ListDevEnvironmentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecatalyst/src/pagination/ListEventLogsPaginator.ts b/clients/client-codecatalyst/src/pagination/ListEventLogsPaginator.ts index 937ebf4aa30a..00446a0c130e 100644 --- a/clients/client-codecatalyst/src/pagination/ListEventLogsPaginator.ts +++ b/clients/client-codecatalyst/src/pagination/ListEventLogsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCatalystClient } from "../CodeCatalystClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListEventLogsCommand"; import { CodeCatalystPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCatalystClient, - input: ListEventLogsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEventLogsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEventLogs( +export const paginateListEventLogs: ( config: CodeCatalystPaginationConfiguration, input: ListEventLogsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEventLogsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCatalystClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCatalyst | CodeCatalystClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCatalystPaginationConfiguration, + ListEventLogsCommandInput, + ListEventLogsCommandOutput +>(CodeCatalystClient, ListEventLogsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecatalyst/src/pagination/ListProjectsPaginator.ts b/clients/client-codecatalyst/src/pagination/ListProjectsPaginator.ts index 7fc531327051..ec0d87582e12 100644 --- a/clients/client-codecatalyst/src/pagination/ListProjectsPaginator.ts +++ b/clients/client-codecatalyst/src/pagination/ListProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCatalystClient } from "../CodeCatalystClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListProjectsCommand"; import { CodeCatalystPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCatalystClient, - input: ListProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProjects( +export const paginateListProjects: ( config: CodeCatalystPaginationConfiguration, input: ListProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProjectsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCatalystClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCatalyst | CodeCatalystClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCatalystPaginationConfiguration, + ListProjectsCommandInput, + ListProjectsCommandOutput +>(CodeCatalystClient, ListProjectsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecatalyst/src/pagination/ListSourceRepositoriesPaginator.ts b/clients/client-codecatalyst/src/pagination/ListSourceRepositoriesPaginator.ts index 0e76159fc988..21093692aee3 100644 --- a/clients/client-codecatalyst/src/pagination/ListSourceRepositoriesPaginator.ts +++ b/clients/client-codecatalyst/src/pagination/ListSourceRepositoriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCatalystClient } from "../CodeCatalystClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSourceRepositoriesCommand"; import { CodeCatalystPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCatalystClient, - input: ListSourceRepositoriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSourceRepositoriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSourceRepositories( +export const paginateListSourceRepositories: ( config: CodeCatalystPaginationConfiguration, input: ListSourceRepositoriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSourceRepositoriesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCatalystClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCatalyst | CodeCatalystClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCatalystPaginationConfiguration, + ListSourceRepositoriesCommandInput, + ListSourceRepositoriesCommandOutput +>(CodeCatalystClient, ListSourceRepositoriesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecatalyst/src/pagination/ListSourceRepositoryBranchesPaginator.ts b/clients/client-codecatalyst/src/pagination/ListSourceRepositoryBranchesPaginator.ts index 76e93d9ebe47..9195e2b09a61 100644 --- a/clients/client-codecatalyst/src/pagination/ListSourceRepositoryBranchesPaginator.ts +++ b/clients/client-codecatalyst/src/pagination/ListSourceRepositoryBranchesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCatalystClient } from "../CodeCatalystClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSourceRepositoryBranchesCommand"; import { CodeCatalystPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCatalystClient, - input: ListSourceRepositoryBranchesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSourceRepositoryBranchesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSourceRepositoryBranches( +export const paginateListSourceRepositoryBranches: ( config: CodeCatalystPaginationConfiguration, input: ListSourceRepositoryBranchesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSourceRepositoryBranchesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCatalystClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCatalyst | CodeCatalystClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCatalystPaginationConfiguration, + ListSourceRepositoryBranchesCommandInput, + ListSourceRepositoryBranchesCommandOutput +>(CodeCatalystClient, ListSourceRepositoryBranchesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecatalyst/src/pagination/ListSpacesPaginator.ts b/clients/client-codecatalyst/src/pagination/ListSpacesPaginator.ts index 6d903eca7f78..944135cc7d65 100644 --- a/clients/client-codecatalyst/src/pagination/ListSpacesPaginator.ts +++ b/clients/client-codecatalyst/src/pagination/ListSpacesPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCatalystClient } from "../CodeCatalystClient"; import { ListSpacesCommand, ListSpacesCommandInput, ListSpacesCommandOutput } from "../commands/ListSpacesCommand"; import { CodeCatalystPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCatalystClient, - input: ListSpacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSpacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSpaces( +export const paginateListSpaces: ( config: CodeCatalystPaginationConfiguration, input: ListSpacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSpacesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof CodeCatalystClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCatalyst | CodeCatalystClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCatalystPaginationConfiguration, + ListSpacesCommandInput, + ListSpacesCommandOutput +>(CodeCatalystClient, ListSpacesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-codecatalyst/src/pagination/ListWorkflowRunsPaginator.ts b/clients/client-codecatalyst/src/pagination/ListWorkflowRunsPaginator.ts index 0c186111361e..b005287fab0d 100644 --- a/clients/client-codecatalyst/src/pagination/ListWorkflowRunsPaginator.ts +++ b/clients/client-codecatalyst/src/pagination/ListWorkflowRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCatalystClient } from "../CodeCatalystClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListWorkflowRunsCommand"; import { CodeCatalystPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCatalystClient, - input: ListWorkflowRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkflowRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkflowRuns( +export const paginateListWorkflowRuns: ( config: CodeCatalystPaginationConfiguration, input: ListWorkflowRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkflowRunsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCatalystClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCatalyst | CodeCatalystClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCatalystPaginationConfiguration, + ListWorkflowRunsCommandInput, + ListWorkflowRunsCommandOutput +>(CodeCatalystClient, ListWorkflowRunsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecatalyst/src/pagination/ListWorkflowsPaginator.ts b/clients/client-codecatalyst/src/pagination/ListWorkflowsPaginator.ts index 7eacb640eb27..a1b93c79440b 100644 --- a/clients/client-codecatalyst/src/pagination/ListWorkflowsPaginator.ts +++ b/clients/client-codecatalyst/src/pagination/ListWorkflowsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCatalystClient } from "../CodeCatalystClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListWorkflowsCommand"; import { CodeCatalystPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCatalystClient, - input: ListWorkflowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkflowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkflows( +export const paginateListWorkflows: ( config: CodeCatalystPaginationConfiguration, input: ListWorkflowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkflowsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCatalystClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCatalyst | CodeCatalystClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCatalystPaginationConfiguration, + ListWorkflowsCommandInput, + ListWorkflowsCommandOutput +>(CodeCatalystClient, ListWorkflowsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecommit/package.json b/clients/client-codecommit/package.json index 48b6431f8453..4f9be94ebdaf 100644 --- a/clients/client-codecommit/package.json +++ b/clients/client-codecommit/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-codecommit/src/pagination/DescribeMergeConflictsPaginator.ts b/clients/client-codecommit/src/pagination/DescribeMergeConflictsPaginator.ts index bb039f19228d..ac43078d9f2c 100644 --- a/clients/client-codecommit/src/pagination/DescribeMergeConflictsPaginator.ts +++ b/clients/client-codecommit/src/pagination/DescribeMergeConflictsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCommitClient } from "../CodeCommitClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribeMergeConflictsCommand"; import { CodeCommitPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCommitClient, - input: DescribeMergeConflictsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMergeConflictsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMergeConflicts( +export const paginateDescribeMergeConflicts: ( config: CodeCommitPaginationConfiguration, input: DescribeMergeConflictsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMergeConflictsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxMergeHunks"] = config.pageSize; - if (config.client instanceof CodeCommitClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCommit | CodeCommitClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCommitPaginationConfiguration, + DescribeMergeConflictsCommandInput, + DescribeMergeConflictsCommandOutput +>(CodeCommitClient, DescribeMergeConflictsCommand, "nextToken", "nextToken", "maxMergeHunks"); diff --git a/clients/client-codecommit/src/pagination/DescribePullRequestEventsPaginator.ts b/clients/client-codecommit/src/pagination/DescribePullRequestEventsPaginator.ts index d9d753384627..bb9c7d6f4913 100644 --- a/clients/client-codecommit/src/pagination/DescribePullRequestEventsPaginator.ts +++ b/clients/client-codecommit/src/pagination/DescribePullRequestEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCommitClient } from "../CodeCommitClient"; @@ -9,42 +10,15 @@ import { } from "../commands/DescribePullRequestEventsCommand"; import { CodeCommitPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCommitClient, - input: DescribePullRequestEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePullRequestEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePullRequestEvents( +export const paginateDescribePullRequestEvents: ( config: CodeCommitPaginationConfiguration, input: DescribePullRequestEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePullRequestEventsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCommitClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCommit | CodeCommitClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCommitPaginationConfiguration, + DescribePullRequestEventsCommandInput, + DescribePullRequestEventsCommandOutput +>(CodeCommitClient, DescribePullRequestEventsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecommit/src/pagination/GetCommentReactionsPaginator.ts b/clients/client-codecommit/src/pagination/GetCommentReactionsPaginator.ts index 750427dd29e9..a9604b86ac44 100644 --- a/clients/client-codecommit/src/pagination/GetCommentReactionsPaginator.ts +++ b/clients/client-codecommit/src/pagination/GetCommentReactionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCommitClient } from "../CodeCommitClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetCommentReactionsCommand"; import { CodeCommitPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCommitClient, - input: GetCommentReactionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCommentReactionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCommentReactions( +export const paginateGetCommentReactions: ( config: CodeCommitPaginationConfiguration, input: GetCommentReactionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCommentReactionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCommitClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCommit | CodeCommitClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCommitPaginationConfiguration, + GetCommentReactionsCommandInput, + GetCommentReactionsCommandOutput +>(CodeCommitClient, GetCommentReactionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecommit/src/pagination/GetCommentsForComparedCommitPaginator.ts b/clients/client-codecommit/src/pagination/GetCommentsForComparedCommitPaginator.ts index f7f137e82fc3..78e27158945f 100644 --- a/clients/client-codecommit/src/pagination/GetCommentsForComparedCommitPaginator.ts +++ b/clients/client-codecommit/src/pagination/GetCommentsForComparedCommitPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCommitClient } from "../CodeCommitClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetCommentsForComparedCommitCommand"; import { CodeCommitPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCommitClient, - input: GetCommentsForComparedCommitCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCommentsForComparedCommitCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCommentsForComparedCommit( +export const paginateGetCommentsForComparedCommit: ( config: CodeCommitPaginationConfiguration, input: GetCommentsForComparedCommitCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCommentsForComparedCommitCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCommitClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCommit | CodeCommitClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCommitPaginationConfiguration, + GetCommentsForComparedCommitCommandInput, + GetCommentsForComparedCommitCommandOutput +>(CodeCommitClient, GetCommentsForComparedCommitCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecommit/src/pagination/GetCommentsForPullRequestPaginator.ts b/clients/client-codecommit/src/pagination/GetCommentsForPullRequestPaginator.ts index bddfc1463480..140cf066d88c 100644 --- a/clients/client-codecommit/src/pagination/GetCommentsForPullRequestPaginator.ts +++ b/clients/client-codecommit/src/pagination/GetCommentsForPullRequestPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCommitClient } from "../CodeCommitClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetCommentsForPullRequestCommand"; import { CodeCommitPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCommitClient, - input: GetCommentsForPullRequestCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCommentsForPullRequestCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCommentsForPullRequest( +export const paginateGetCommentsForPullRequest: ( config: CodeCommitPaginationConfiguration, input: GetCommentsForPullRequestCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCommentsForPullRequestCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCommitClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCommit | CodeCommitClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCommitPaginationConfiguration, + GetCommentsForPullRequestCommandInput, + GetCommentsForPullRequestCommandOutput +>(CodeCommitClient, GetCommentsForPullRequestCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecommit/src/pagination/GetDifferencesPaginator.ts b/clients/client-codecommit/src/pagination/GetDifferencesPaginator.ts index fb6b07043e4c..e9cf7c9bf5f0 100644 --- a/clients/client-codecommit/src/pagination/GetDifferencesPaginator.ts +++ b/clients/client-codecommit/src/pagination/GetDifferencesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCommitClient } from "../CodeCommitClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetDifferencesCommand"; import { CodeCommitPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCommitClient, - input: GetDifferencesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetDifferencesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetDifferences( +export const paginateGetDifferences: ( config: CodeCommitPaginationConfiguration, input: GetDifferencesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetDifferencesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CodeCommitClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCommit | CodeCommitClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCommitPaginationConfiguration, + GetDifferencesCommandInput, + GetDifferencesCommandOutput +>(CodeCommitClient, GetDifferencesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-codecommit/src/pagination/GetMergeConflictsPaginator.ts b/clients/client-codecommit/src/pagination/GetMergeConflictsPaginator.ts index a001dfc97648..0cc28277deb2 100644 --- a/clients/client-codecommit/src/pagination/GetMergeConflictsPaginator.ts +++ b/clients/client-codecommit/src/pagination/GetMergeConflictsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCommitClient } from "../CodeCommitClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetMergeConflictsCommand"; import { CodeCommitPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCommitClient, - input: GetMergeConflictsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetMergeConflictsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetMergeConflicts( +export const paginateGetMergeConflicts: ( config: CodeCommitPaginationConfiguration, input: GetMergeConflictsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetMergeConflictsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxConflictFiles"] = config.pageSize; - if (config.client instanceof CodeCommitClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCommit | CodeCommitClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCommitPaginationConfiguration, + GetMergeConflictsCommandInput, + GetMergeConflictsCommandOutput +>(CodeCommitClient, GetMergeConflictsCommand, "nextToken", "nextToken", "maxConflictFiles"); diff --git a/clients/client-codecommit/src/pagination/ListApprovalRuleTemplatesPaginator.ts b/clients/client-codecommit/src/pagination/ListApprovalRuleTemplatesPaginator.ts index 0f2481d2c627..b7a6da5e0029 100644 --- a/clients/client-codecommit/src/pagination/ListApprovalRuleTemplatesPaginator.ts +++ b/clients/client-codecommit/src/pagination/ListApprovalRuleTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCommitClient } from "../CodeCommitClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListApprovalRuleTemplatesCommand"; import { CodeCommitPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCommitClient, - input: ListApprovalRuleTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApprovalRuleTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApprovalRuleTemplates( +export const paginateListApprovalRuleTemplates: ( config: CodeCommitPaginationConfiguration, input: ListApprovalRuleTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApprovalRuleTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCommitClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCommit | CodeCommitClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCommitPaginationConfiguration, + ListApprovalRuleTemplatesCommandInput, + ListApprovalRuleTemplatesCommandOutput +>(CodeCommitClient, ListApprovalRuleTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecommit/src/pagination/ListAssociatedApprovalRuleTemplatesForRepositoryPaginator.ts b/clients/client-codecommit/src/pagination/ListAssociatedApprovalRuleTemplatesForRepositoryPaginator.ts index 430d8bc2f1f7..c675a34e5646 100644 --- a/clients/client-codecommit/src/pagination/ListAssociatedApprovalRuleTemplatesForRepositoryPaginator.ts +++ b/clients/client-codecommit/src/pagination/ListAssociatedApprovalRuleTemplatesForRepositoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCommitClient } from "../CodeCommitClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListAssociatedApprovalRuleTemplatesForRepositoryCommand"; import { CodeCommitPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCommitClient, - input: ListAssociatedApprovalRuleTemplatesForRepositoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssociatedApprovalRuleTemplatesForRepositoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssociatedApprovalRuleTemplatesForRepository( +export const paginateListAssociatedApprovalRuleTemplatesForRepository: ( config: CodeCommitPaginationConfiguration, input: ListAssociatedApprovalRuleTemplatesForRepositoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssociatedApprovalRuleTemplatesForRepositoryCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCommitClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCommit | CodeCommitClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCommitPaginationConfiguration, + ListAssociatedApprovalRuleTemplatesForRepositoryCommandInput, + ListAssociatedApprovalRuleTemplatesForRepositoryCommandOutput +>(CodeCommitClient, ListAssociatedApprovalRuleTemplatesForRepositoryCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecommit/src/pagination/ListBranchesPaginator.ts b/clients/client-codecommit/src/pagination/ListBranchesPaginator.ts index 1aad0efd82e6..ed9413d6021d 100644 --- a/clients/client-codecommit/src/pagination/ListBranchesPaginator.ts +++ b/clients/client-codecommit/src/pagination/ListBranchesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCommitClient } from "../CodeCommitClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListBranchesCommand"; import { CodeCommitPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCommitClient, - input: ListBranchesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBranchesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBranches( +export const paginateListBranches: ( config: CodeCommitPaginationConfiguration, input: ListBranchesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBranchesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof CodeCommitClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCommit | CodeCommitClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCommitPaginationConfiguration, + ListBranchesCommandInput, + ListBranchesCommandOutput +>(CodeCommitClient, ListBranchesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-codecommit/src/pagination/ListFileCommitHistoryPaginator.ts b/clients/client-codecommit/src/pagination/ListFileCommitHistoryPaginator.ts index 89a4942ddcc4..99ad27c07625 100644 --- a/clients/client-codecommit/src/pagination/ListFileCommitHistoryPaginator.ts +++ b/clients/client-codecommit/src/pagination/ListFileCommitHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCommitClient } from "../CodeCommitClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListFileCommitHistoryCommand"; import { CodeCommitPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCommitClient, - input: ListFileCommitHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFileCommitHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFileCommitHistory( +export const paginateListFileCommitHistory: ( config: CodeCommitPaginationConfiguration, input: ListFileCommitHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFileCommitHistoryCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCommitClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCommit | CodeCommitClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCommitPaginationConfiguration, + ListFileCommitHistoryCommandInput, + ListFileCommitHistoryCommandOutput +>(CodeCommitClient, ListFileCommitHistoryCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecommit/src/pagination/ListPullRequestsPaginator.ts b/clients/client-codecommit/src/pagination/ListPullRequestsPaginator.ts index 2f30c0fbe92c..b0ef9a201dfc 100644 --- a/clients/client-codecommit/src/pagination/ListPullRequestsPaginator.ts +++ b/clients/client-codecommit/src/pagination/ListPullRequestsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCommitClient } from "../CodeCommitClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPullRequestsCommand"; import { CodeCommitPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCommitClient, - input: ListPullRequestsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPullRequestsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPullRequests( +export const paginateListPullRequests: ( config: CodeCommitPaginationConfiguration, input: ListPullRequestsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPullRequestsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCommitClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCommit | CodeCommitClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCommitPaginationConfiguration, + ListPullRequestsCommandInput, + ListPullRequestsCommandOutput +>(CodeCommitClient, ListPullRequestsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecommit/src/pagination/ListRepositoriesForApprovalRuleTemplatePaginator.ts b/clients/client-codecommit/src/pagination/ListRepositoriesForApprovalRuleTemplatePaginator.ts index a269759dfad5..bf909c1b432e 100644 --- a/clients/client-codecommit/src/pagination/ListRepositoriesForApprovalRuleTemplatePaginator.ts +++ b/clients/client-codecommit/src/pagination/ListRepositoriesForApprovalRuleTemplatePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCommitClient } from "../CodeCommitClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRepositoriesForApprovalRuleTemplateCommand"; import { CodeCommitPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCommitClient, - input: ListRepositoriesForApprovalRuleTemplateCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRepositoriesForApprovalRuleTemplateCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRepositoriesForApprovalRuleTemplate( +export const paginateListRepositoriesForApprovalRuleTemplate: ( config: CodeCommitPaginationConfiguration, input: ListRepositoriesForApprovalRuleTemplateCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRepositoriesForApprovalRuleTemplateCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeCommitClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCommit | CodeCommitClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCommitPaginationConfiguration, + ListRepositoriesForApprovalRuleTemplateCommandInput, + ListRepositoriesForApprovalRuleTemplateCommandOutput +>(CodeCommitClient, ListRepositoriesForApprovalRuleTemplateCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codecommit/src/pagination/ListRepositoriesPaginator.ts b/clients/client-codecommit/src/pagination/ListRepositoriesPaginator.ts index 8a4232d8479d..1ad483495cf0 100644 --- a/clients/client-codecommit/src/pagination/ListRepositoriesPaginator.ts +++ b/clients/client-codecommit/src/pagination/ListRepositoriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeCommitClient } from "../CodeCommitClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListRepositoriesCommand"; import { CodeCommitPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeCommitClient, - input: ListRepositoriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRepositoriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRepositories( +export const paginateListRepositories: ( config: CodeCommitPaginationConfiguration, input: ListRepositoriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRepositoriesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof CodeCommitClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeCommit | CodeCommitClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeCommitPaginationConfiguration, + ListRepositoriesCommandInput, + ListRepositoriesCommandOutput +>(CodeCommitClient, ListRepositoriesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-codedeploy/package.json b/clients/client-codedeploy/package.json index 422f068f50fa..c792093da023 100644 --- a/clients/client-codedeploy/package.json +++ b/clients/client-codedeploy/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-codedeploy/src/pagination/ListApplicationRevisionsPaginator.ts b/clients/client-codedeploy/src/pagination/ListApplicationRevisionsPaginator.ts index 13c1de09b660..791e1f8b4ef4 100644 --- a/clients/client-codedeploy/src/pagination/ListApplicationRevisionsPaginator.ts +++ b/clients/client-codedeploy/src/pagination/ListApplicationRevisionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeDeployClient } from "../CodeDeployClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListApplicationRevisionsCommand"; import { CodeDeployPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeDeployClient, - input: ListApplicationRevisionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationRevisionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationRevisions( +export const paginateListApplicationRevisions: ( config: CodeDeployPaginationConfiguration, input: ListApplicationRevisionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationRevisionsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof CodeDeployClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeDeploy | CodeDeployClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeDeployPaginationConfiguration, + ListApplicationRevisionsCommandInput, + ListApplicationRevisionsCommandOutput +>(CodeDeployClient, ListApplicationRevisionsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-codedeploy/src/pagination/ListApplicationsPaginator.ts b/clients/client-codedeploy/src/pagination/ListApplicationsPaginator.ts index 7faa723e1264..0d06fcf2413a 100644 --- a/clients/client-codedeploy/src/pagination/ListApplicationsPaginator.ts +++ b/clients/client-codedeploy/src/pagination/ListApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeDeployClient } from "../CodeDeployClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListApplicationsCommand"; import { CodeDeployPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeDeployClient, - input: ListApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplications( +export const paginateListApplications: ( config: CodeDeployPaginationConfiguration, input: ListApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof CodeDeployClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeDeploy | CodeDeployClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeDeployPaginationConfiguration, + ListApplicationsCommandInput, + ListApplicationsCommandOutput +>(CodeDeployClient, ListApplicationsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-codedeploy/src/pagination/ListDeploymentConfigsPaginator.ts b/clients/client-codedeploy/src/pagination/ListDeploymentConfigsPaginator.ts index abcaef545ebc..d7e45bd9fd03 100644 --- a/clients/client-codedeploy/src/pagination/ListDeploymentConfigsPaginator.ts +++ b/clients/client-codedeploy/src/pagination/ListDeploymentConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeDeployClient } from "../CodeDeployClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListDeploymentConfigsCommand"; import { CodeDeployPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeDeployClient, - input: ListDeploymentConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeploymentConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeploymentConfigs( +export const paginateListDeploymentConfigs: ( config: CodeDeployPaginationConfiguration, input: ListDeploymentConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeploymentConfigsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof CodeDeployClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeDeploy | CodeDeployClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeDeployPaginationConfiguration, + ListDeploymentConfigsCommandInput, + ListDeploymentConfigsCommandOutput +>(CodeDeployClient, ListDeploymentConfigsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-codedeploy/src/pagination/ListDeploymentGroupsPaginator.ts b/clients/client-codedeploy/src/pagination/ListDeploymentGroupsPaginator.ts index 95857384b418..2bdea5f22776 100644 --- a/clients/client-codedeploy/src/pagination/ListDeploymentGroupsPaginator.ts +++ b/clients/client-codedeploy/src/pagination/ListDeploymentGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeDeployClient } from "../CodeDeployClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListDeploymentGroupsCommand"; import { CodeDeployPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeDeployClient, - input: ListDeploymentGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeploymentGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeploymentGroups( +export const paginateListDeploymentGroups: ( config: CodeDeployPaginationConfiguration, input: ListDeploymentGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeploymentGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof CodeDeployClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeDeploy | CodeDeployClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeDeployPaginationConfiguration, + ListDeploymentGroupsCommandInput, + ListDeploymentGroupsCommandOutput +>(CodeDeployClient, ListDeploymentGroupsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-codedeploy/src/pagination/ListDeploymentInstancesPaginator.ts b/clients/client-codedeploy/src/pagination/ListDeploymentInstancesPaginator.ts index 5f50c8f44932..95667d6feba7 100644 --- a/clients/client-codedeploy/src/pagination/ListDeploymentInstancesPaginator.ts +++ b/clients/client-codedeploy/src/pagination/ListDeploymentInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeDeployClient } from "../CodeDeployClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListDeploymentInstancesCommand"; import { CodeDeployPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeDeployClient, - input: ListDeploymentInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeploymentInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeploymentInstances( +export const paginateListDeploymentInstances: ( config: CodeDeployPaginationConfiguration, input: ListDeploymentInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeploymentInstancesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof CodeDeployClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeDeploy | CodeDeployClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeDeployPaginationConfiguration, + ListDeploymentInstancesCommandInput, + ListDeploymentInstancesCommandOutput +>(CodeDeployClient, ListDeploymentInstancesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-codedeploy/src/pagination/ListDeploymentsPaginator.ts b/clients/client-codedeploy/src/pagination/ListDeploymentsPaginator.ts index 2f9aaf4cf0f1..783a0f3996cb 100644 --- a/clients/client-codedeploy/src/pagination/ListDeploymentsPaginator.ts +++ b/clients/client-codedeploy/src/pagination/ListDeploymentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeDeployClient } from "../CodeDeployClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListDeploymentsCommand"; import { CodeDeployPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeDeployClient, - input: ListDeploymentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeploymentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeployments( +export const paginateListDeployments: ( config: CodeDeployPaginationConfiguration, input: ListDeploymentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeploymentsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof CodeDeployClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeDeploy | CodeDeployClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeDeployPaginationConfiguration, + ListDeploymentsCommandInput, + ListDeploymentsCommandOutput +>(CodeDeployClient, ListDeploymentsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-codeguru-reviewer/src/pagination/ListCodeReviewsPaginator.ts b/clients/client-codeguru-reviewer/src/pagination/ListCodeReviewsPaginator.ts index 6f29ddce7a35..f48e9e2089b4 100644 --- a/clients/client-codeguru-reviewer/src/pagination/ListCodeReviewsPaginator.ts +++ b/clients/client-codeguru-reviewer/src/pagination/ListCodeReviewsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeGuruReviewerClient } from "../CodeGuruReviewerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListCodeReviewsCommand"; import { CodeGuruReviewerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeGuruReviewerClient, - input: ListCodeReviewsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCodeReviewsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCodeReviews( +export const paginateListCodeReviews: ( config: CodeGuruReviewerPaginationConfiguration, input: ListCodeReviewsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCodeReviewsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CodeGuruReviewerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeGuruReviewer | CodeGuruReviewerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeGuruReviewerPaginationConfiguration, + ListCodeReviewsCommandInput, + ListCodeReviewsCommandOutput +>(CodeGuruReviewerClient, ListCodeReviewsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-codeguru-reviewer/src/pagination/ListRecommendationFeedbackPaginator.ts b/clients/client-codeguru-reviewer/src/pagination/ListRecommendationFeedbackPaginator.ts index a8adcc8c03de..352f2f27f8c4 100644 --- a/clients/client-codeguru-reviewer/src/pagination/ListRecommendationFeedbackPaginator.ts +++ b/clients/client-codeguru-reviewer/src/pagination/ListRecommendationFeedbackPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeGuruReviewerClient } from "../CodeGuruReviewerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRecommendationFeedbackCommand"; import { CodeGuruReviewerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeGuruReviewerClient, - input: ListRecommendationFeedbackCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecommendationFeedbackCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecommendationFeedback( +export const paginateListRecommendationFeedback: ( config: CodeGuruReviewerPaginationConfiguration, input: ListRecommendationFeedbackCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecommendationFeedbackCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CodeGuruReviewerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeGuruReviewer | CodeGuruReviewerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeGuruReviewerPaginationConfiguration, + ListRecommendationFeedbackCommandInput, + ListRecommendationFeedbackCommandOutput +>(CodeGuruReviewerClient, ListRecommendationFeedbackCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-codeguru-reviewer/src/pagination/ListRecommendationsPaginator.ts b/clients/client-codeguru-reviewer/src/pagination/ListRecommendationsPaginator.ts index 4a1d867726c6..7bc241f6ff2a 100644 --- a/clients/client-codeguru-reviewer/src/pagination/ListRecommendationsPaginator.ts +++ b/clients/client-codeguru-reviewer/src/pagination/ListRecommendationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeGuruReviewerClient } from "../CodeGuruReviewerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRecommendationsCommand"; import { CodeGuruReviewerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeGuruReviewerClient, - input: ListRecommendationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecommendationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecommendations( +export const paginateListRecommendations: ( config: CodeGuruReviewerPaginationConfiguration, input: ListRecommendationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecommendationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CodeGuruReviewerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeGuruReviewer | CodeGuruReviewerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeGuruReviewerPaginationConfiguration, + ListRecommendationsCommandInput, + ListRecommendationsCommandOutput +>(CodeGuruReviewerClient, ListRecommendationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-codeguru-reviewer/src/pagination/ListRepositoryAssociationsPaginator.ts b/clients/client-codeguru-reviewer/src/pagination/ListRepositoryAssociationsPaginator.ts index 9e2e749b8c6e..794cd3675059 100644 --- a/clients/client-codeguru-reviewer/src/pagination/ListRepositoryAssociationsPaginator.ts +++ b/clients/client-codeguru-reviewer/src/pagination/ListRepositoryAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeGuruReviewerClient } from "../CodeGuruReviewerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRepositoryAssociationsCommand"; import { CodeGuruReviewerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeGuruReviewerClient, - input: ListRepositoryAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRepositoryAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRepositoryAssociations( +export const paginateListRepositoryAssociations: ( config: CodeGuruReviewerPaginationConfiguration, input: ListRepositoryAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRepositoryAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CodeGuruReviewerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeGuruReviewer | CodeGuruReviewerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeGuruReviewerPaginationConfiguration, + ListRepositoryAssociationsCommandInput, + ListRepositoryAssociationsCommandOutput +>(CodeGuruReviewerClient, ListRepositoryAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-codeguru-security/src/pagination/GetFindingsPaginator.ts b/clients/client-codeguru-security/src/pagination/GetFindingsPaginator.ts index 780a5a15e337..e217c4b63e48 100644 --- a/clients/client-codeguru-security/src/pagination/GetFindingsPaginator.ts +++ b/clients/client-codeguru-security/src/pagination/GetFindingsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeGuruSecurityClient } from "../CodeGuruSecurityClient"; import { GetFindingsCommand, GetFindingsCommandInput, GetFindingsCommandOutput } from "../commands/GetFindingsCommand"; import { CodeGuruSecurityPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeGuruSecurityClient, - input: GetFindingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetFindingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetFindings( +export const paginateGetFindings: ( config: CodeGuruSecurityPaginationConfiguration, input: GetFindingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetFindingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeGuruSecurityClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeGuruSecurity | CodeGuruSecurityClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeGuruSecurityPaginationConfiguration, + GetFindingsCommandInput, + GetFindingsCommandOutput +>(CodeGuruSecurityClient, GetFindingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codeguru-security/src/pagination/ListFindingsMetricsPaginator.ts b/clients/client-codeguru-security/src/pagination/ListFindingsMetricsPaginator.ts index e1a785904b19..3a3f56bc8c3f 100644 --- a/clients/client-codeguru-security/src/pagination/ListFindingsMetricsPaginator.ts +++ b/clients/client-codeguru-security/src/pagination/ListFindingsMetricsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeGuruSecurityClient } from "../CodeGuruSecurityClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListFindingsMetricsCommand"; import { CodeGuruSecurityPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeGuruSecurityClient, - input: ListFindingsMetricsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFindingsMetricsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFindingsMetrics( +export const paginateListFindingsMetrics: ( config: CodeGuruSecurityPaginationConfiguration, input: ListFindingsMetricsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFindingsMetricsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeGuruSecurityClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeGuruSecurity | CodeGuruSecurityClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeGuruSecurityPaginationConfiguration, + ListFindingsMetricsCommandInput, + ListFindingsMetricsCommandOutput +>(CodeGuruSecurityClient, ListFindingsMetricsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codeguru-security/src/pagination/ListScansPaginator.ts b/clients/client-codeguru-security/src/pagination/ListScansPaginator.ts index 34357a722a3e..7b2def5e8e53 100644 --- a/clients/client-codeguru-security/src/pagination/ListScansPaginator.ts +++ b/clients/client-codeguru-security/src/pagination/ListScansPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeGuruSecurityClient } from "../CodeGuruSecurityClient"; import { ListScansCommand, ListScansCommandInput, ListScansCommandOutput } from "../commands/ListScansCommand"; import { CodeGuruSecurityPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeGuruSecurityClient, - input: ListScansCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListScansCommand(input), ...args); -}; /** * @public */ -export async function* paginateListScans( +export const paginateListScans: ( config: CodeGuruSecurityPaginationConfiguration, input: ListScansCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListScansCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeGuruSecurityClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeGuruSecurity | CodeGuruSecurityClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeGuruSecurityPaginationConfiguration, + ListScansCommandInput, + ListScansCommandOutput +>(CodeGuruSecurityClient, ListScansCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codeguruprofiler/src/pagination/GetFindingsReportAccountSummaryPaginator.ts b/clients/client-codeguruprofiler/src/pagination/GetFindingsReportAccountSummaryPaginator.ts index 3dc9ca1464c9..20c8a454eca0 100644 --- a/clients/client-codeguruprofiler/src/pagination/GetFindingsReportAccountSummaryPaginator.ts +++ b/clients/client-codeguruprofiler/src/pagination/GetFindingsReportAccountSummaryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeGuruProfilerClient } from "../CodeGuruProfilerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/GetFindingsReportAccountSummaryCommand"; import { CodeGuruProfilerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeGuruProfilerClient, - input: GetFindingsReportAccountSummaryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetFindingsReportAccountSummaryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetFindingsReportAccountSummary( +export const paginateGetFindingsReportAccountSummary: ( config: CodeGuruProfilerPaginationConfiguration, input: GetFindingsReportAccountSummaryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetFindingsReportAccountSummaryCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeGuruProfilerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeGuruProfiler | CodeGuruProfilerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeGuruProfilerPaginationConfiguration, + GetFindingsReportAccountSummaryCommandInput, + GetFindingsReportAccountSummaryCommandOutput +>(CodeGuruProfilerClient, GetFindingsReportAccountSummaryCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codeguruprofiler/src/pagination/ListFindingsReportsPaginator.ts b/clients/client-codeguruprofiler/src/pagination/ListFindingsReportsPaginator.ts index 6b74b30dabe1..90c70151a269 100644 --- a/clients/client-codeguruprofiler/src/pagination/ListFindingsReportsPaginator.ts +++ b/clients/client-codeguruprofiler/src/pagination/ListFindingsReportsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeGuruProfilerClient } from "../CodeGuruProfilerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListFindingsReportsCommand"; import { CodeGuruProfilerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeGuruProfilerClient, - input: ListFindingsReportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFindingsReportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFindingsReports( +export const paginateListFindingsReports: ( config: CodeGuruProfilerPaginationConfiguration, input: ListFindingsReportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFindingsReportsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeGuruProfilerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeGuruProfiler | CodeGuruProfilerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeGuruProfilerPaginationConfiguration, + ListFindingsReportsCommandInput, + ListFindingsReportsCommandOutput +>(CodeGuruProfilerClient, ListFindingsReportsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codeguruprofiler/src/pagination/ListProfileTimesPaginator.ts b/clients/client-codeguruprofiler/src/pagination/ListProfileTimesPaginator.ts index a1fdb7d682b9..346de7d057eb 100644 --- a/clients/client-codeguruprofiler/src/pagination/ListProfileTimesPaginator.ts +++ b/clients/client-codeguruprofiler/src/pagination/ListProfileTimesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeGuruProfilerClient } from "../CodeGuruProfilerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListProfileTimesCommand"; import { CodeGuruProfilerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeGuruProfilerClient, - input: ListProfileTimesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProfileTimesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProfileTimes( +export const paginateListProfileTimes: ( config: CodeGuruProfilerPaginationConfiguration, input: ListProfileTimesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProfileTimesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeGuruProfilerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeGuruProfiler | CodeGuruProfilerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeGuruProfilerPaginationConfiguration, + ListProfileTimesCommandInput, + ListProfileTimesCommandOutput +>(CodeGuruProfilerClient, ListProfileTimesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codeguruprofiler/src/pagination/ListProfilingGroupsPaginator.ts b/clients/client-codeguruprofiler/src/pagination/ListProfilingGroupsPaginator.ts index 0e4c6e02178d..bb9172985c67 100644 --- a/clients/client-codeguruprofiler/src/pagination/ListProfilingGroupsPaginator.ts +++ b/clients/client-codeguruprofiler/src/pagination/ListProfilingGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeGuruProfilerClient } from "../CodeGuruProfilerClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListProfilingGroupsCommand"; import { CodeGuruProfilerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeGuruProfilerClient, - input: ListProfilingGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProfilingGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProfilingGroups( +export const paginateListProfilingGroups: ( config: CodeGuruProfilerPaginationConfiguration, input: ListProfilingGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProfilingGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodeGuruProfilerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeGuruProfiler | CodeGuruProfilerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeGuruProfilerPaginationConfiguration, + ListProfilingGroupsCommandInput, + ListProfilingGroupsCommandOutput +>(CodeGuruProfilerClient, ListProfilingGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codepipeline/package.json b/clients/client-codepipeline/package.json index 07ce111e414a..c8bb0c5a59ff 100644 --- a/clients/client-codepipeline/package.json +++ b/clients/client-codepipeline/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-codepipeline/src/pagination/ListActionExecutionsPaginator.ts b/clients/client-codepipeline/src/pagination/ListActionExecutionsPaginator.ts index 45853063c3cb..97619b2cccf1 100644 --- a/clients/client-codepipeline/src/pagination/ListActionExecutionsPaginator.ts +++ b/clients/client-codepipeline/src/pagination/ListActionExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodePipelineClient } from "../CodePipelineClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListActionExecutionsCommand"; import { CodePipelinePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodePipelineClient, - input: ListActionExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListActionExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListActionExecutions( +export const paginateListActionExecutions: ( config: CodePipelinePaginationConfiguration, input: ListActionExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListActionExecutionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodePipelineClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodePipeline | CodePipelineClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodePipelinePaginationConfiguration, + ListActionExecutionsCommandInput, + ListActionExecutionsCommandOutput +>(CodePipelineClient, ListActionExecutionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codepipeline/src/pagination/ListActionTypesPaginator.ts b/clients/client-codepipeline/src/pagination/ListActionTypesPaginator.ts index 4de5cc3135f1..c65881522e2b 100644 --- a/clients/client-codepipeline/src/pagination/ListActionTypesPaginator.ts +++ b/clients/client-codepipeline/src/pagination/ListActionTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodePipelineClient } from "../CodePipelineClient"; @@ -9,41 +10,15 @@ import { } from "../commands/ListActionTypesCommand"; import { CodePipelinePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodePipelineClient, - input: ListActionTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListActionTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListActionTypes( +export const paginateListActionTypes: ( config: CodePipelinePaginationConfiguration, input: ListActionTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListActionTypesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof CodePipelineClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodePipeline | CodePipelineClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodePipelinePaginationConfiguration, + ListActionTypesCommandInput, + ListActionTypesCommandOutput +>(CodePipelineClient, ListActionTypesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-codepipeline/src/pagination/ListPipelineExecutionsPaginator.ts b/clients/client-codepipeline/src/pagination/ListPipelineExecutionsPaginator.ts index 751d02036889..4a459a67234d 100644 --- a/clients/client-codepipeline/src/pagination/ListPipelineExecutionsPaginator.ts +++ b/clients/client-codepipeline/src/pagination/ListPipelineExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodePipelineClient } from "../CodePipelineClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPipelineExecutionsCommand"; import { CodePipelinePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodePipelineClient, - input: ListPipelineExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPipelineExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPipelineExecutions( +export const paginateListPipelineExecutions: ( config: CodePipelinePaginationConfiguration, input: ListPipelineExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPipelineExecutionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodePipelineClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodePipeline | CodePipelineClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodePipelinePaginationConfiguration, + ListPipelineExecutionsCommandInput, + ListPipelineExecutionsCommandOutput +>(CodePipelineClient, ListPipelineExecutionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codepipeline/src/pagination/ListPipelinesPaginator.ts b/clients/client-codepipeline/src/pagination/ListPipelinesPaginator.ts index bcdf6585d7cf..6240f3970b89 100644 --- a/clients/client-codepipeline/src/pagination/ListPipelinesPaginator.ts +++ b/clients/client-codepipeline/src/pagination/ListPipelinesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodePipelineClient } from "../CodePipelineClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListPipelinesCommand"; import { CodePipelinePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodePipelineClient, - input: ListPipelinesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPipelinesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPipelines( +export const paginateListPipelines: ( config: CodePipelinePaginationConfiguration, input: ListPipelinesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPipelinesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodePipelineClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodePipeline | CodePipelineClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodePipelinePaginationConfiguration, + ListPipelinesCommandInput, + ListPipelinesCommandOutput +>(CodePipelineClient, ListPipelinesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codepipeline/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-codepipeline/src/pagination/ListTagsForResourcePaginator.ts index a5ca99f114c1..ec197b7f9840 100644 --- a/clients/client-codepipeline/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-codepipeline/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodePipelineClient } from "../CodePipelineClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListTagsForResourceCommand"; import { CodePipelinePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodePipelineClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: CodePipelinePaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CodePipelineClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodePipeline | CodePipelineClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodePipelinePaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(CodePipelineClient, ListTagsForResourceCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-codepipeline/src/pagination/ListWebhooksPaginator.ts b/clients/client-codepipeline/src/pagination/ListWebhooksPaginator.ts index 5128519c2609..b27b265fa5bd 100644 --- a/clients/client-codepipeline/src/pagination/ListWebhooksPaginator.ts +++ b/clients/client-codepipeline/src/pagination/ListWebhooksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodePipelineClient } from "../CodePipelineClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListWebhooksCommand"; import { CodePipelinePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodePipelineClient, - input: ListWebhooksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWebhooksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWebhooks( +export const paginateListWebhooks: ( config: CodePipelinePaginationConfiguration, input: ListWebhooksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWebhooksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CodePipelineClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodePipeline | CodePipelineClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodePipelinePaginationConfiguration, + ListWebhooksCommandInput, + ListWebhooksCommandOutput +>(CodePipelineClient, ListWebhooksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-codestar-connections/package.json b/clients/client-codestar-connections/package.json index 183a6a1c4dc5..9cf5ee85807a 100644 --- a/clients/client-codestar-connections/package.json +++ b/clients/client-codestar-connections/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-codestar-connections/src/pagination/ListConnectionsPaginator.ts b/clients/client-codestar-connections/src/pagination/ListConnectionsPaginator.ts index 386a9a385c5a..22ae2dd0cdfc 100644 --- a/clients/client-codestar-connections/src/pagination/ListConnectionsPaginator.ts +++ b/clients/client-codestar-connections/src/pagination/ListConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeStarConnectionsClient } from "../CodeStarConnectionsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListConnectionsCommand"; import { CodeStarConnectionsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeStarConnectionsClient, - input: ListConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConnections( +export const paginateListConnections: ( config: CodeStarConnectionsPaginationConfiguration, input: ListConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CodeStarConnectionsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeStarConnections | CodeStarConnectionsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeStarConnectionsPaginationConfiguration, + ListConnectionsCommandInput, + ListConnectionsCommandOutput +>(CodeStarConnectionsClient, ListConnectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-codestar-connections/src/pagination/ListHostsPaginator.ts b/clients/client-codestar-connections/src/pagination/ListHostsPaginator.ts index dcc7a1bb6f17..02c179c5ddaf 100644 --- a/clients/client-codestar-connections/src/pagination/ListHostsPaginator.ts +++ b/clients/client-codestar-connections/src/pagination/ListHostsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeStarConnectionsClient } from "../CodeStarConnectionsClient"; import { ListHostsCommand, ListHostsCommandInput, ListHostsCommandOutput } from "../commands/ListHostsCommand"; import { CodeStarConnectionsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeStarConnectionsClient, - input: ListHostsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHostsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHosts( +export const paginateListHosts: ( config: CodeStarConnectionsPaginationConfiguration, input: ListHostsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHostsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CodeStarConnectionsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeStarConnections | CodeStarConnectionsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeStarConnectionsPaginationConfiguration, + ListHostsCommandInput, + ListHostsCommandOutput +>(CodeStarConnectionsClient, ListHostsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-codestar-connections/src/pagination/ListRepositoryLinksPaginator.ts b/clients/client-codestar-connections/src/pagination/ListRepositoryLinksPaginator.ts index bd0fe046c6f6..843a948f3494 100644 --- a/clients/client-codestar-connections/src/pagination/ListRepositoryLinksPaginator.ts +++ b/clients/client-codestar-connections/src/pagination/ListRepositoryLinksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeStarConnectionsClient } from "../CodeStarConnectionsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListRepositoryLinksCommand"; import { CodeStarConnectionsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeStarConnectionsClient, - input: ListRepositoryLinksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRepositoryLinksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRepositoryLinks( +export const paginateListRepositoryLinks: ( config: CodeStarConnectionsPaginationConfiguration, input: ListRepositoryLinksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRepositoryLinksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CodeStarConnectionsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeStarConnections | CodeStarConnectionsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeStarConnectionsPaginationConfiguration, + ListRepositoryLinksCommandInput, + ListRepositoryLinksCommandOutput +>(CodeStarConnectionsClient, ListRepositoryLinksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-codestar-connections/src/pagination/ListSyncConfigurationsPaginator.ts b/clients/client-codestar-connections/src/pagination/ListSyncConfigurationsPaginator.ts index 0e0b50ec2c90..09d58816f694 100644 --- a/clients/client-codestar-connections/src/pagination/ListSyncConfigurationsPaginator.ts +++ b/clients/client-codestar-connections/src/pagination/ListSyncConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodeStarConnectionsClient } from "../CodeStarConnectionsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListSyncConfigurationsCommand"; import { CodeStarConnectionsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodeStarConnectionsClient, - input: ListSyncConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSyncConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSyncConfigurations( +export const paginateListSyncConfigurations: ( config: CodeStarConnectionsPaginationConfiguration, input: ListSyncConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSyncConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CodeStarConnectionsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodeStarConnections | CodeStarConnectionsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodeStarConnectionsPaginationConfiguration, + ListSyncConfigurationsCommandInput, + ListSyncConfigurationsCommandOutput +>(CodeStarConnectionsClient, ListSyncConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-codestar-notifications/src/pagination/ListEventTypesPaginator.ts b/clients/client-codestar-notifications/src/pagination/ListEventTypesPaginator.ts index 9ac28d8804d1..d17d27496c53 100644 --- a/clients/client-codestar-notifications/src/pagination/ListEventTypesPaginator.ts +++ b/clients/client-codestar-notifications/src/pagination/ListEventTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodestarNotificationsClient } from "../CodestarNotificationsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListEventTypesCommand"; import { CodestarNotificationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodestarNotificationsClient, - input: ListEventTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEventTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEventTypes( +export const paginateListEventTypes: ( config: CodestarNotificationsPaginationConfiguration, input: ListEventTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEventTypesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CodestarNotificationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodestarNotifications | CodestarNotificationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodestarNotificationsPaginationConfiguration, + ListEventTypesCommandInput, + ListEventTypesCommandOutput +>(CodestarNotificationsClient, ListEventTypesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-codestar-notifications/src/pagination/ListNotificationRulesPaginator.ts b/clients/client-codestar-notifications/src/pagination/ListNotificationRulesPaginator.ts index b76dd187dd6b..af3b06700e13 100644 --- a/clients/client-codestar-notifications/src/pagination/ListNotificationRulesPaginator.ts +++ b/clients/client-codestar-notifications/src/pagination/ListNotificationRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodestarNotificationsClient } from "../CodestarNotificationsClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListNotificationRulesCommand"; import { CodestarNotificationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodestarNotificationsClient, - input: ListNotificationRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNotificationRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNotificationRules( +export const paginateListNotificationRules: ( config: CodestarNotificationsPaginationConfiguration, input: ListNotificationRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNotificationRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CodestarNotificationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodestarNotifications | CodestarNotificationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodestarNotificationsPaginationConfiguration, + ListNotificationRulesCommandInput, + ListNotificationRulesCommandOutput +>(CodestarNotificationsClient, ListNotificationRulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-codestar-notifications/src/pagination/ListTargetsPaginator.ts b/clients/client-codestar-notifications/src/pagination/ListTargetsPaginator.ts index 3d4cae18d329..a8026eaa1ace 100644 --- a/clients/client-codestar-notifications/src/pagination/ListTargetsPaginator.ts +++ b/clients/client-codestar-notifications/src/pagination/ListTargetsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CodestarNotificationsClient } from "../CodestarNotificationsClient"; import { ListTargetsCommand, ListTargetsCommandInput, ListTargetsCommandOutput } from "../commands/ListTargetsCommand"; import { CodestarNotificationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CodestarNotificationsClient, - input: ListTargetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTargetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTargets( +export const paginateListTargets: ( config: CodestarNotificationsPaginationConfiguration, input: ListTargetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTargetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CodestarNotificationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CodestarNotifications | CodestarNotificationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CodestarNotificationsPaginationConfiguration, + ListTargetsCommandInput, + ListTargetsCommandOutput +>(CodestarNotificationsClient, ListTargetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cognito-identity-provider/package.json b/clients/client-cognito-identity-provider/package.json index a25eeea48b1f..93fbba0ecb2a 100644 --- a/clients/client-cognito-identity-provider/package.json +++ b/clients/client-cognito-identity-provider/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-cognito-identity-provider/src/pagination/AdminListGroupsForUserPaginator.ts b/clients/client-cognito-identity-provider/src/pagination/AdminListGroupsForUserPaginator.ts index af7b33e06008..89c602e01386 100644 --- a/clients/client-cognito-identity-provider/src/pagination/AdminListGroupsForUserPaginator.ts +++ b/clients/client-cognito-identity-provider/src/pagination/AdminListGroupsForUserPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CognitoIdentityProviderClient } from "../CognitoIdentityProviderClient"; @@ -9,42 +10,15 @@ import { } from "../commands/AdminListGroupsForUserCommand"; import { CognitoIdentityProviderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CognitoIdentityProviderClient, - input: AdminListGroupsForUserCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new AdminListGroupsForUserCommand(input), ...args); -}; /** * @public */ -export async function* paginateAdminListGroupsForUser( +export const paginateAdminListGroupsForUser: ( config: CognitoIdentityProviderPaginationConfiguration, input: AdminListGroupsForUserCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: AdminListGroupsForUserCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof CognitoIdentityProviderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CognitoIdentityProvider | CognitoIdentityProviderClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CognitoIdentityProviderPaginationConfiguration, + AdminListGroupsForUserCommandInput, + AdminListGroupsForUserCommandOutput +>(CognitoIdentityProviderClient, AdminListGroupsForUserCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-cognito-identity-provider/src/pagination/AdminListUserAuthEventsPaginator.ts b/clients/client-cognito-identity-provider/src/pagination/AdminListUserAuthEventsPaginator.ts index 31b64b697422..32367e98b7e4 100644 --- a/clients/client-cognito-identity-provider/src/pagination/AdminListUserAuthEventsPaginator.ts +++ b/clients/client-cognito-identity-provider/src/pagination/AdminListUserAuthEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CognitoIdentityProviderClient } from "../CognitoIdentityProviderClient"; @@ -9,42 +10,15 @@ import { } from "../commands/AdminListUserAuthEventsCommand"; import { CognitoIdentityProviderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CognitoIdentityProviderClient, - input: AdminListUserAuthEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new AdminListUserAuthEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateAdminListUserAuthEvents( +export const paginateAdminListUserAuthEvents: ( config: CognitoIdentityProviderPaginationConfiguration, input: AdminListUserAuthEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: AdminListUserAuthEventsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CognitoIdentityProviderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CognitoIdentityProvider | CognitoIdentityProviderClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CognitoIdentityProviderPaginationConfiguration, + AdminListUserAuthEventsCommandInput, + AdminListUserAuthEventsCommandOutput +>(CognitoIdentityProviderClient, AdminListUserAuthEventsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cognito-identity-provider/src/pagination/ListGroupsPaginator.ts b/clients/client-cognito-identity-provider/src/pagination/ListGroupsPaginator.ts index 0e66630ff821..5fa448eaa7dd 100644 --- a/clients/client-cognito-identity-provider/src/pagination/ListGroupsPaginator.ts +++ b/clients/client-cognito-identity-provider/src/pagination/ListGroupsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CognitoIdentityProviderClient } from "../CognitoIdentityProviderClient"; import { ListGroupsCommand, ListGroupsCommandInput, ListGroupsCommandOutput } from "../commands/ListGroupsCommand"; import { CognitoIdentityProviderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CognitoIdentityProviderClient, - input: ListGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroups( +export const paginateListGroups: ( config: CognitoIdentityProviderPaginationConfiguration, input: ListGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof CognitoIdentityProviderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CognitoIdentityProvider | CognitoIdentityProviderClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CognitoIdentityProviderPaginationConfiguration, + ListGroupsCommandInput, + ListGroupsCommandOutput +>(CognitoIdentityProviderClient, ListGroupsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-cognito-identity-provider/src/pagination/ListIdentityProvidersPaginator.ts b/clients/client-cognito-identity-provider/src/pagination/ListIdentityProvidersPaginator.ts index 0bdc87071824..7d23353c0abd 100644 --- a/clients/client-cognito-identity-provider/src/pagination/ListIdentityProvidersPaginator.ts +++ b/clients/client-cognito-identity-provider/src/pagination/ListIdentityProvidersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CognitoIdentityProviderClient } from "../CognitoIdentityProviderClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListIdentityProvidersCommand"; import { CognitoIdentityProviderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CognitoIdentityProviderClient, - input: ListIdentityProvidersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIdentityProvidersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIdentityProviders( +export const paginateListIdentityProviders: ( config: CognitoIdentityProviderPaginationConfiguration, input: ListIdentityProvidersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIdentityProvidersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CognitoIdentityProviderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CognitoIdentityProvider | CognitoIdentityProviderClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CognitoIdentityProviderPaginationConfiguration, + ListIdentityProvidersCommandInput, + ListIdentityProvidersCommandOutput +>(CognitoIdentityProviderClient, ListIdentityProvidersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cognito-identity-provider/src/pagination/ListResourceServersPaginator.ts b/clients/client-cognito-identity-provider/src/pagination/ListResourceServersPaginator.ts index 0b84ae416b32..974f01bdd2a5 100644 --- a/clients/client-cognito-identity-provider/src/pagination/ListResourceServersPaginator.ts +++ b/clients/client-cognito-identity-provider/src/pagination/ListResourceServersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CognitoIdentityProviderClient } from "../CognitoIdentityProviderClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListResourceServersCommand"; import { CognitoIdentityProviderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CognitoIdentityProviderClient, - input: ListResourceServersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourceServersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourceServers( +export const paginateListResourceServers: ( config: CognitoIdentityProviderPaginationConfiguration, input: ListResourceServersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourceServersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CognitoIdentityProviderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CognitoIdentityProvider | CognitoIdentityProviderClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CognitoIdentityProviderPaginationConfiguration, + ListResourceServersCommandInput, + ListResourceServersCommandOutput +>(CognitoIdentityProviderClient, ListResourceServersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cognito-identity-provider/src/pagination/ListUserPoolClientsPaginator.ts b/clients/client-cognito-identity-provider/src/pagination/ListUserPoolClientsPaginator.ts index 74a7a7d3bef7..596d4bac7d3a 100644 --- a/clients/client-cognito-identity-provider/src/pagination/ListUserPoolClientsPaginator.ts +++ b/clients/client-cognito-identity-provider/src/pagination/ListUserPoolClientsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CognitoIdentityProviderClient } from "../CognitoIdentityProviderClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListUserPoolClientsCommand"; import { CognitoIdentityProviderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CognitoIdentityProviderClient, - input: ListUserPoolClientsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUserPoolClientsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUserPoolClients( +export const paginateListUserPoolClients: ( config: CognitoIdentityProviderPaginationConfiguration, input: ListUserPoolClientsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUserPoolClientsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CognitoIdentityProviderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CognitoIdentityProvider | CognitoIdentityProviderClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CognitoIdentityProviderPaginationConfiguration, + ListUserPoolClientsCommandInput, + ListUserPoolClientsCommandOutput +>(CognitoIdentityProviderClient, ListUserPoolClientsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cognito-identity-provider/src/pagination/ListUserPoolsPaginator.ts b/clients/client-cognito-identity-provider/src/pagination/ListUserPoolsPaginator.ts index b08b494acda0..726240255b61 100644 --- a/clients/client-cognito-identity-provider/src/pagination/ListUserPoolsPaginator.ts +++ b/clients/client-cognito-identity-provider/src/pagination/ListUserPoolsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CognitoIdentityProviderClient } from "../CognitoIdentityProviderClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListUserPoolsCommand"; import { CognitoIdentityProviderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CognitoIdentityProviderClient, - input: ListUserPoolsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUserPoolsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUserPools( +export const paginateListUserPools: ( config: CognitoIdentityProviderPaginationConfiguration, input: ListUserPoolsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUserPoolsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CognitoIdentityProviderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CognitoIdentityProvider | CognitoIdentityProviderClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CognitoIdentityProviderPaginationConfiguration, + ListUserPoolsCommandInput, + ListUserPoolsCommandOutput +>(CognitoIdentityProviderClient, ListUserPoolsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cognito-identity-provider/src/pagination/ListUsersInGroupPaginator.ts b/clients/client-cognito-identity-provider/src/pagination/ListUsersInGroupPaginator.ts index 6f5d71793dec..ccb97cc844e7 100644 --- a/clients/client-cognito-identity-provider/src/pagination/ListUsersInGroupPaginator.ts +++ b/clients/client-cognito-identity-provider/src/pagination/ListUsersInGroupPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CognitoIdentityProviderClient } from "../CognitoIdentityProviderClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListUsersInGroupCommand"; import { CognitoIdentityProviderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CognitoIdentityProviderClient, - input: ListUsersInGroupCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUsersInGroupCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUsersInGroup( +export const paginateListUsersInGroup: ( config: CognitoIdentityProviderPaginationConfiguration, input: ListUsersInGroupCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUsersInGroupCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof CognitoIdentityProviderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CognitoIdentityProvider | CognitoIdentityProviderClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CognitoIdentityProviderPaginationConfiguration, + ListUsersInGroupCommandInput, + ListUsersInGroupCommandOutput +>(CognitoIdentityProviderClient, ListUsersInGroupCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-cognito-identity-provider/src/pagination/ListUsersPaginator.ts b/clients/client-cognito-identity-provider/src/pagination/ListUsersPaginator.ts index e2151fb7985a..860441310606 100644 --- a/clients/client-cognito-identity-provider/src/pagination/ListUsersPaginator.ts +++ b/clients/client-cognito-identity-provider/src/pagination/ListUsersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CognitoIdentityProviderClient } from "../CognitoIdentityProviderClient"; import { ListUsersCommand, ListUsersCommandInput, ListUsersCommandOutput } from "../commands/ListUsersCommand"; import { CognitoIdentityProviderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CognitoIdentityProviderClient, - input: ListUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUsers( +export const paginateListUsers: ( config: CognitoIdentityProviderPaginationConfiguration, input: ListUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PaginationToken - let token: typeof input.PaginationToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUsersCommandOutput; - while (hasNext) { - input.PaginationToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof CognitoIdentityProviderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CognitoIdentityProvider | CognitoIdentityProviderClient"); - } - yield page; - const prevToken = token; - token = page.PaginationToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CognitoIdentityProviderPaginationConfiguration, + ListUsersCommandInput, + ListUsersCommandOutput +>(CognitoIdentityProviderClient, ListUsersCommand, "PaginationToken", "PaginationToken", "Limit"); diff --git a/clients/client-cognito-identity/package.json b/clients/client-cognito-identity/package.json index aa175603e924..4822d895157a 100644 --- a/clients/client-cognito-identity/package.json +++ b/clients/client-cognito-identity/package.json @@ -35,6 +35,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-cognito-identity/src/pagination/ListIdentityPoolsPaginator.ts b/clients/client-cognito-identity/src/pagination/ListIdentityPoolsPaginator.ts index 2c58fd9d6862..885006039605 100644 --- a/clients/client-cognito-identity/src/pagination/ListIdentityPoolsPaginator.ts +++ b/clients/client-cognito-identity/src/pagination/ListIdentityPoolsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { CognitoIdentityClient } from "../CognitoIdentityClient"; @@ -9,42 +10,15 @@ import { } from "../commands/ListIdentityPoolsCommand"; import { CognitoIdentityPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CognitoIdentityClient, - input: ListIdentityPoolsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIdentityPoolsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIdentityPools( +export const paginateListIdentityPools: ( config: CognitoIdentityPaginationConfiguration, input: ListIdentityPoolsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIdentityPoolsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CognitoIdentityClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CognitoIdentity | CognitoIdentityClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CognitoIdentityPaginationConfiguration, + ListIdentityPoolsCommandInput, + ListIdentityPoolsCommandOutput +>(CognitoIdentityClient, ListIdentityPoolsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/package.json b/clients/client-comprehend/package.json index 97698574345a..da793ebcb4fe 100644 --- a/clients/client-comprehend/package.json +++ b/clients/client-comprehend/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-comprehend/src/pagination/ListDatasetsPaginator.ts b/clients/client-comprehend/src/pagination/ListDatasetsPaginator.ts index a372fc921c9a..2f85640d4c15 100644 --- a/clients/client-comprehend/src/pagination/ListDatasetsPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListDatasetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListDatasetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasets( +export const paginateListDatasets: ( config: ComprehendPaginationConfiguration, input: ListDatasetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListDatasetsCommandInput, + ListDatasetsCommandOutput +>(ComprehendClient, ListDatasetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListDocumentClassificationJobsPaginator.ts b/clients/client-comprehend/src/pagination/ListDocumentClassificationJobsPaginator.ts index d58ec1e2efee..3dc5d38e3d6c 100644 --- a/clients/client-comprehend/src/pagination/ListDocumentClassificationJobsPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListDocumentClassificationJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListDocumentClassificationJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDocumentClassificationJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDocumentClassificationJobs( +export const paginateListDocumentClassificationJobs: ( config: ComprehendPaginationConfiguration, input: ListDocumentClassificationJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDocumentClassificationJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListDocumentClassificationJobsCommandInput, + ListDocumentClassificationJobsCommandOutput +>(ComprehendClient, ListDocumentClassificationJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListDocumentClassifierSummariesPaginator.ts b/clients/client-comprehend/src/pagination/ListDocumentClassifierSummariesPaginator.ts index dbe0460c5745..33c13ab6b9f3 100644 --- a/clients/client-comprehend/src/pagination/ListDocumentClassifierSummariesPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListDocumentClassifierSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListDocumentClassifierSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDocumentClassifierSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDocumentClassifierSummaries( +export const paginateListDocumentClassifierSummaries: ( config: ComprehendPaginationConfiguration, input: ListDocumentClassifierSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDocumentClassifierSummariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListDocumentClassifierSummariesCommandInput, + ListDocumentClassifierSummariesCommandOutput +>(ComprehendClient, ListDocumentClassifierSummariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListDocumentClassifiersPaginator.ts b/clients/client-comprehend/src/pagination/ListDocumentClassifiersPaginator.ts index 57ae23704ea6..3eedce941d5b 100644 --- a/clients/client-comprehend/src/pagination/ListDocumentClassifiersPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListDocumentClassifiersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListDocumentClassifiersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDocumentClassifiersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDocumentClassifiers( +export const paginateListDocumentClassifiers: ( config: ComprehendPaginationConfiguration, input: ListDocumentClassifiersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDocumentClassifiersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListDocumentClassifiersCommandInput, + ListDocumentClassifiersCommandOutput +>(ComprehendClient, ListDocumentClassifiersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListDominantLanguageDetectionJobsPaginator.ts b/clients/client-comprehend/src/pagination/ListDominantLanguageDetectionJobsPaginator.ts index 8ff5538ec80a..58c479a144db 100644 --- a/clients/client-comprehend/src/pagination/ListDominantLanguageDetectionJobsPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListDominantLanguageDetectionJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListDominantLanguageDetectionJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDominantLanguageDetectionJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDominantLanguageDetectionJobs( +export const paginateListDominantLanguageDetectionJobs: ( config: ComprehendPaginationConfiguration, input: ListDominantLanguageDetectionJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDominantLanguageDetectionJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListDominantLanguageDetectionJobsCommandInput, + ListDominantLanguageDetectionJobsCommandOutput +>(ComprehendClient, ListDominantLanguageDetectionJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListEndpointsPaginator.ts b/clients/client-comprehend/src/pagination/ListEndpointsPaginator.ts index 9736b7f7a6dc..cb275a003c95 100644 --- a/clients/client-comprehend/src/pagination/ListEndpointsPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEndpoints( +export const paginateListEndpoints: ( config: ComprehendPaginationConfiguration, input: ListEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListEndpointsCommandInput, + ListEndpointsCommandOutput +>(ComprehendClient, ListEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListEntitiesDetectionJobsPaginator.ts b/clients/client-comprehend/src/pagination/ListEntitiesDetectionJobsPaginator.ts index c6ae8a510196..7293ad9b4d0f 100644 --- a/clients/client-comprehend/src/pagination/ListEntitiesDetectionJobsPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListEntitiesDetectionJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListEntitiesDetectionJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEntitiesDetectionJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEntitiesDetectionJobs( +export const paginateListEntitiesDetectionJobs: ( config: ComprehendPaginationConfiguration, input: ListEntitiesDetectionJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEntitiesDetectionJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListEntitiesDetectionJobsCommandInput, + ListEntitiesDetectionJobsCommandOutput +>(ComprehendClient, ListEntitiesDetectionJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListEntityRecognizerSummariesPaginator.ts b/clients/client-comprehend/src/pagination/ListEntityRecognizerSummariesPaginator.ts index 3861762eed98..0b4fd7086637 100644 --- a/clients/client-comprehend/src/pagination/ListEntityRecognizerSummariesPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListEntityRecognizerSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListEntityRecognizerSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEntityRecognizerSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEntityRecognizerSummaries( +export const paginateListEntityRecognizerSummaries: ( config: ComprehendPaginationConfiguration, input: ListEntityRecognizerSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEntityRecognizerSummariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListEntityRecognizerSummariesCommandInput, + ListEntityRecognizerSummariesCommandOutput +>(ComprehendClient, ListEntityRecognizerSummariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListEntityRecognizersPaginator.ts b/clients/client-comprehend/src/pagination/ListEntityRecognizersPaginator.ts index bc36cb71f72e..9e219966825e 100644 --- a/clients/client-comprehend/src/pagination/ListEntityRecognizersPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListEntityRecognizersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListEntityRecognizersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEntityRecognizersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEntityRecognizers( +export const paginateListEntityRecognizers: ( config: ComprehendPaginationConfiguration, input: ListEntityRecognizersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEntityRecognizersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListEntityRecognizersCommandInput, + ListEntityRecognizersCommandOutput +>(ComprehendClient, ListEntityRecognizersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListEventsDetectionJobsPaginator.ts b/clients/client-comprehend/src/pagination/ListEventsDetectionJobsPaginator.ts index 578ce5780c9a..0c3fa2a29429 100644 --- a/clients/client-comprehend/src/pagination/ListEventsDetectionJobsPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListEventsDetectionJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListEventsDetectionJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEventsDetectionJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEventsDetectionJobs( +export const paginateListEventsDetectionJobs: ( config: ComprehendPaginationConfiguration, input: ListEventsDetectionJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEventsDetectionJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListEventsDetectionJobsCommandInput, + ListEventsDetectionJobsCommandOutput +>(ComprehendClient, ListEventsDetectionJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListFlywheelIterationHistoryPaginator.ts b/clients/client-comprehend/src/pagination/ListFlywheelIterationHistoryPaginator.ts index bc404c5b898b..202fb8fdfe2b 100644 --- a/clients/client-comprehend/src/pagination/ListFlywheelIterationHistoryPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListFlywheelIterationHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListFlywheelIterationHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFlywheelIterationHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFlywheelIterationHistory( +export const paginateListFlywheelIterationHistory: ( config: ComprehendPaginationConfiguration, input: ListFlywheelIterationHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFlywheelIterationHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListFlywheelIterationHistoryCommandInput, + ListFlywheelIterationHistoryCommandOutput +>(ComprehendClient, ListFlywheelIterationHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListFlywheelsPaginator.ts b/clients/client-comprehend/src/pagination/ListFlywheelsPaginator.ts index 47b12c8b2d9a..3ce33f13bd9b 100644 --- a/clients/client-comprehend/src/pagination/ListFlywheelsPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListFlywheelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListFlywheelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFlywheelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFlywheels( +export const paginateListFlywheels: ( config: ComprehendPaginationConfiguration, input: ListFlywheelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFlywheelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListFlywheelsCommandInput, + ListFlywheelsCommandOutput +>(ComprehendClient, ListFlywheelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListKeyPhrasesDetectionJobsPaginator.ts b/clients/client-comprehend/src/pagination/ListKeyPhrasesDetectionJobsPaginator.ts index b3e9ff883bbb..3601c871fcd8 100644 --- a/clients/client-comprehend/src/pagination/ListKeyPhrasesDetectionJobsPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListKeyPhrasesDetectionJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListKeyPhrasesDetectionJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKeyPhrasesDetectionJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKeyPhrasesDetectionJobs( +export const paginateListKeyPhrasesDetectionJobs: ( config: ComprehendPaginationConfiguration, input: ListKeyPhrasesDetectionJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKeyPhrasesDetectionJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListKeyPhrasesDetectionJobsCommandInput, + ListKeyPhrasesDetectionJobsCommandOutput +>(ComprehendClient, ListKeyPhrasesDetectionJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListPiiEntitiesDetectionJobsPaginator.ts b/clients/client-comprehend/src/pagination/ListPiiEntitiesDetectionJobsPaginator.ts index 7167f156c6fb..0a3d706d7e4f 100644 --- a/clients/client-comprehend/src/pagination/ListPiiEntitiesDetectionJobsPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListPiiEntitiesDetectionJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListPiiEntitiesDetectionJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPiiEntitiesDetectionJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPiiEntitiesDetectionJobs( +export const paginateListPiiEntitiesDetectionJobs: ( config: ComprehendPaginationConfiguration, input: ListPiiEntitiesDetectionJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPiiEntitiesDetectionJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListPiiEntitiesDetectionJobsCommandInput, + ListPiiEntitiesDetectionJobsCommandOutput +>(ComprehendClient, ListPiiEntitiesDetectionJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListSentimentDetectionJobsPaginator.ts b/clients/client-comprehend/src/pagination/ListSentimentDetectionJobsPaginator.ts index 1558a48dbc57..228d01b8cb6c 100644 --- a/clients/client-comprehend/src/pagination/ListSentimentDetectionJobsPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListSentimentDetectionJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListSentimentDetectionJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSentimentDetectionJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSentimentDetectionJobs( +export const paginateListSentimentDetectionJobs: ( config: ComprehendPaginationConfiguration, input: ListSentimentDetectionJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSentimentDetectionJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListSentimentDetectionJobsCommandInput, + ListSentimentDetectionJobsCommandOutput +>(ComprehendClient, ListSentimentDetectionJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListTargetedSentimentDetectionJobsPaginator.ts b/clients/client-comprehend/src/pagination/ListTargetedSentimentDetectionJobsPaginator.ts index fc499823a85c..3a48fc9c5cb0 100644 --- a/clients/client-comprehend/src/pagination/ListTargetedSentimentDetectionJobsPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListTargetedSentimentDetectionJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListTargetedSentimentDetectionJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTargetedSentimentDetectionJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTargetedSentimentDetectionJobs( +export const paginateListTargetedSentimentDetectionJobs: ( config: ComprehendPaginationConfiguration, input: ListTargetedSentimentDetectionJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTargetedSentimentDetectionJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListTargetedSentimentDetectionJobsCommandInput, + ListTargetedSentimentDetectionJobsCommandOutput +>(ComprehendClient, ListTargetedSentimentDetectionJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-comprehend/src/pagination/ListTopicsDetectionJobsPaginator.ts b/clients/client-comprehend/src/pagination/ListTopicsDetectionJobsPaginator.ts index 032f853978b0..14366542d623 100644 --- a/clients/client-comprehend/src/pagination/ListTopicsDetectionJobsPaginator.ts +++ b/clients/client-comprehend/src/pagination/ListTopicsDetectionJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComprehendClient } from "../ComprehendClient"; import { ComprehendPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComprehendClient, - input: ListTopicsDetectionJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTopicsDetectionJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTopicsDetectionJobs( +export const paginateListTopicsDetectionJobs: ( config: ComprehendPaginationConfiguration, input: ListTopicsDetectionJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTopicsDetectionJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ComprehendClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Comprehend | ComprehendClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComprehendPaginationConfiguration, + ListTopicsDetectionJobsCommandInput, + ListTopicsDetectionJobsCommandOutput +>(ComprehendClient, ListTopicsDetectionJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-compute-optimizer/package.json b/clients/client-compute-optimizer/package.json index e0175b871afe..a3eb55c8ed6d 100644 --- a/clients/client-compute-optimizer/package.json +++ b/clients/client-compute-optimizer/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-compute-optimizer/src/pagination/DescribeRecommendationExportJobsPaginator.ts b/clients/client-compute-optimizer/src/pagination/DescribeRecommendationExportJobsPaginator.ts index 8d79075ae419..25e0c1c94d90 100644 --- a/clients/client-compute-optimizer/src/pagination/DescribeRecommendationExportJobsPaginator.ts +++ b/clients/client-compute-optimizer/src/pagination/DescribeRecommendationExportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComputeOptimizerClient } from "../ComputeOptimizerClient"; import { ComputeOptimizerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComputeOptimizerClient, - input: DescribeRecommendationExportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRecommendationExportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRecommendationExportJobs( +export const paginateDescribeRecommendationExportJobs: ( config: ComputeOptimizerPaginationConfiguration, input: DescribeRecommendationExportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRecommendationExportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ComputeOptimizerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ComputeOptimizer | ComputeOptimizerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComputeOptimizerPaginationConfiguration, + DescribeRecommendationExportJobsCommandInput, + DescribeRecommendationExportJobsCommandOutput +>(ComputeOptimizerClient, DescribeRecommendationExportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-compute-optimizer/src/pagination/GetEnrollmentStatusesForOrganizationPaginator.ts b/clients/client-compute-optimizer/src/pagination/GetEnrollmentStatusesForOrganizationPaginator.ts index 0cad82ac6cc9..c57665bb3cdb 100644 --- a/clients/client-compute-optimizer/src/pagination/GetEnrollmentStatusesForOrganizationPaginator.ts +++ b/clients/client-compute-optimizer/src/pagination/GetEnrollmentStatusesForOrganizationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComputeOptimizerClient } from "../ComputeOptimizerClient"; import { ComputeOptimizerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComputeOptimizerClient, - input: GetEnrollmentStatusesForOrganizationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetEnrollmentStatusesForOrganizationCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetEnrollmentStatusesForOrganization( +export const paginateGetEnrollmentStatusesForOrganization: ( config: ComputeOptimizerPaginationConfiguration, input: GetEnrollmentStatusesForOrganizationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetEnrollmentStatusesForOrganizationCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ComputeOptimizerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ComputeOptimizer | ComputeOptimizerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComputeOptimizerPaginationConfiguration, + GetEnrollmentStatusesForOrganizationCommandInput, + GetEnrollmentStatusesForOrganizationCommandOutput +>(ComputeOptimizerClient, GetEnrollmentStatusesForOrganizationCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-compute-optimizer/src/pagination/GetLambdaFunctionRecommendationsPaginator.ts b/clients/client-compute-optimizer/src/pagination/GetLambdaFunctionRecommendationsPaginator.ts index 31c9c595a39f..9af901c0fdce 100644 --- a/clients/client-compute-optimizer/src/pagination/GetLambdaFunctionRecommendationsPaginator.ts +++ b/clients/client-compute-optimizer/src/pagination/GetLambdaFunctionRecommendationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComputeOptimizerClient } from "../ComputeOptimizerClient"; import { ComputeOptimizerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComputeOptimizerClient, - input: GetLambdaFunctionRecommendationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetLambdaFunctionRecommendationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetLambdaFunctionRecommendations( +export const paginateGetLambdaFunctionRecommendations: ( config: ComputeOptimizerPaginationConfiguration, input: GetLambdaFunctionRecommendationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetLambdaFunctionRecommendationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ComputeOptimizerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ComputeOptimizer | ComputeOptimizerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComputeOptimizerPaginationConfiguration, + GetLambdaFunctionRecommendationsCommandInput, + GetLambdaFunctionRecommendationsCommandOutput +>(ComputeOptimizerClient, GetLambdaFunctionRecommendationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-compute-optimizer/src/pagination/GetRecommendationPreferencesPaginator.ts b/clients/client-compute-optimizer/src/pagination/GetRecommendationPreferencesPaginator.ts index 22dfa97d9b42..88cba46359c9 100644 --- a/clients/client-compute-optimizer/src/pagination/GetRecommendationPreferencesPaginator.ts +++ b/clients/client-compute-optimizer/src/pagination/GetRecommendationPreferencesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComputeOptimizerClient } from "../ComputeOptimizerClient"; import { ComputeOptimizerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComputeOptimizerClient, - input: GetRecommendationPreferencesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetRecommendationPreferencesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetRecommendationPreferences( +export const paginateGetRecommendationPreferences: ( config: ComputeOptimizerPaginationConfiguration, input: GetRecommendationPreferencesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetRecommendationPreferencesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ComputeOptimizerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ComputeOptimizer | ComputeOptimizerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComputeOptimizerPaginationConfiguration, + GetRecommendationPreferencesCommandInput, + GetRecommendationPreferencesCommandOutput +>(ComputeOptimizerClient, GetRecommendationPreferencesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-compute-optimizer/src/pagination/GetRecommendationSummariesPaginator.ts b/clients/client-compute-optimizer/src/pagination/GetRecommendationSummariesPaginator.ts index 03e1ede09bde..9d40236fbb59 100644 --- a/clients/client-compute-optimizer/src/pagination/GetRecommendationSummariesPaginator.ts +++ b/clients/client-compute-optimizer/src/pagination/GetRecommendationSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ComputeOptimizerClient } from "../ComputeOptimizerClient"; import { ComputeOptimizerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ComputeOptimizerClient, - input: GetRecommendationSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetRecommendationSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetRecommendationSummaries( +export const paginateGetRecommendationSummaries: ( config: ComputeOptimizerPaginationConfiguration, input: GetRecommendationSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetRecommendationSummariesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ComputeOptimizerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ComputeOptimizer | ComputeOptimizerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ComputeOptimizerPaginationConfiguration, + GetRecommendationSummariesCommandInput, + GetRecommendationSummariesCommandOutput +>(ComputeOptimizerClient, GetRecommendationSummariesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-config-service/package.json b/clients/client-config-service/package.json index bd406a96e4c0..34d8c9c9500b 100644 --- a/clients/client-config-service/package.json +++ b/clients/client-config-service/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-config-service/src/pagination/DescribeAggregateComplianceByConfigRulesPaginator.ts b/clients/client-config-service/src/pagination/DescribeAggregateComplianceByConfigRulesPaginator.ts index 0685a7861f27..6527d3f3a4b8 100644 --- a/clients/client-config-service/src/pagination/DescribeAggregateComplianceByConfigRulesPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeAggregateComplianceByConfigRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeAggregateComplianceByConfigRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAggregateComplianceByConfigRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAggregateComplianceByConfigRules( +export const paginateDescribeAggregateComplianceByConfigRules: ( config: ConfigServicePaginationConfiguration, input: DescribeAggregateComplianceByConfigRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAggregateComplianceByConfigRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeAggregateComplianceByConfigRulesCommandInput, + DescribeAggregateComplianceByConfigRulesCommandOutput +>(ConfigServiceClient, DescribeAggregateComplianceByConfigRulesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeAggregateComplianceByConformancePacksPaginator.ts b/clients/client-config-service/src/pagination/DescribeAggregateComplianceByConformancePacksPaginator.ts index d2405d0d8bd6..336f41810174 100644 --- a/clients/client-config-service/src/pagination/DescribeAggregateComplianceByConformancePacksPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeAggregateComplianceByConformancePacksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeAggregateComplianceByConformancePacksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAggregateComplianceByConformancePacksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAggregateComplianceByConformancePacks( +export const paginateDescribeAggregateComplianceByConformancePacks: ( config: ConfigServicePaginationConfiguration, input: DescribeAggregateComplianceByConformancePacksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAggregateComplianceByConformancePacksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeAggregateComplianceByConformancePacksCommandInput, + DescribeAggregateComplianceByConformancePacksCommandOutput +>(ConfigServiceClient, DescribeAggregateComplianceByConformancePacksCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeAggregationAuthorizationsPaginator.ts b/clients/client-config-service/src/pagination/DescribeAggregationAuthorizationsPaginator.ts index 2facfe5a4f2b..1cb69d0e90ad 100644 --- a/clients/client-config-service/src/pagination/DescribeAggregationAuthorizationsPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeAggregationAuthorizationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeAggregationAuthorizationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAggregationAuthorizationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAggregationAuthorizations( +export const paginateDescribeAggregationAuthorizations: ( config: ConfigServicePaginationConfiguration, input: DescribeAggregationAuthorizationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAggregationAuthorizationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeAggregationAuthorizationsCommandInput, + DescribeAggregationAuthorizationsCommandOutput +>(ConfigServiceClient, DescribeAggregationAuthorizationsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeComplianceByConfigRulePaginator.ts b/clients/client-config-service/src/pagination/DescribeComplianceByConfigRulePaginator.ts index d9c85e57ee71..29ab3f9c507f 100644 --- a/clients/client-config-service/src/pagination/DescribeComplianceByConfigRulePaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeComplianceByConfigRulePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeComplianceByConfigRuleCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeComplianceByConfigRuleCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeComplianceByConfigRule( +export const paginateDescribeComplianceByConfigRule: ( config: ConfigServicePaginationConfiguration, input: DescribeComplianceByConfigRuleCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeComplianceByConfigRuleCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeComplianceByConfigRuleCommandInput, + DescribeComplianceByConfigRuleCommandOutput +>(ConfigServiceClient, DescribeComplianceByConfigRuleCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-config-service/src/pagination/DescribeComplianceByResourcePaginator.ts b/clients/client-config-service/src/pagination/DescribeComplianceByResourcePaginator.ts index 79d219b39358..6e9814126ef6 100644 --- a/clients/client-config-service/src/pagination/DescribeComplianceByResourcePaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeComplianceByResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeComplianceByResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeComplianceByResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeComplianceByResource( +export const paginateDescribeComplianceByResource: ( config: ConfigServicePaginationConfiguration, input: DescribeComplianceByResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeComplianceByResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeComplianceByResourceCommandInput, + DescribeComplianceByResourceCommandOutput +>(ConfigServiceClient, DescribeComplianceByResourceCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeConfigRuleEvaluationStatusPaginator.ts b/clients/client-config-service/src/pagination/DescribeConfigRuleEvaluationStatusPaginator.ts index cbc6a532d360..9e4d8dab2de2 100644 --- a/clients/client-config-service/src/pagination/DescribeConfigRuleEvaluationStatusPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeConfigRuleEvaluationStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeConfigRuleEvaluationStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeConfigRuleEvaluationStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeConfigRuleEvaluationStatus( +export const paginateDescribeConfigRuleEvaluationStatus: ( config: ConfigServicePaginationConfiguration, input: DescribeConfigRuleEvaluationStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeConfigRuleEvaluationStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeConfigRuleEvaluationStatusCommandInput, + DescribeConfigRuleEvaluationStatusCommandOutput +>(ConfigServiceClient, DescribeConfigRuleEvaluationStatusCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeConfigRulesPaginator.ts b/clients/client-config-service/src/pagination/DescribeConfigRulesPaginator.ts index 7bb1edd837c1..e19ff2cf8e4d 100644 --- a/clients/client-config-service/src/pagination/DescribeConfigRulesPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeConfigRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeConfigRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeConfigRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeConfigRules( +export const paginateDescribeConfigRules: ( config: ConfigServicePaginationConfiguration, input: DescribeConfigRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeConfigRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeConfigRulesCommandInput, + DescribeConfigRulesCommandOutput +>(ConfigServiceClient, DescribeConfigRulesCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-config-service/src/pagination/DescribeConfigurationAggregatorSourcesStatusPaginator.ts b/clients/client-config-service/src/pagination/DescribeConfigurationAggregatorSourcesStatusPaginator.ts index 5ab4e12cdf9d..535bc819f0de 100644 --- a/clients/client-config-service/src/pagination/DescribeConfigurationAggregatorSourcesStatusPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeConfigurationAggregatorSourcesStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeConfigurationAggregatorSourcesStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeConfigurationAggregatorSourcesStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeConfigurationAggregatorSourcesStatus( +export const paginateDescribeConfigurationAggregatorSourcesStatus: ( config: ConfigServicePaginationConfiguration, input: DescribeConfigurationAggregatorSourcesStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeConfigurationAggregatorSourcesStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeConfigurationAggregatorSourcesStatusCommandInput, + DescribeConfigurationAggregatorSourcesStatusCommandOutput +>(ConfigServiceClient, DescribeConfigurationAggregatorSourcesStatusCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeConfigurationAggregatorsPaginator.ts b/clients/client-config-service/src/pagination/DescribeConfigurationAggregatorsPaginator.ts index 9ca892b495e5..6611c0477d94 100644 --- a/clients/client-config-service/src/pagination/DescribeConfigurationAggregatorsPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeConfigurationAggregatorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeConfigurationAggregatorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeConfigurationAggregatorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeConfigurationAggregators( +export const paginateDescribeConfigurationAggregators: ( config: ConfigServicePaginationConfiguration, input: DescribeConfigurationAggregatorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeConfigurationAggregatorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeConfigurationAggregatorsCommandInput, + DescribeConfigurationAggregatorsCommandOutput +>(ConfigServiceClient, DescribeConfigurationAggregatorsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeConformancePackCompliancePaginator.ts b/clients/client-config-service/src/pagination/DescribeConformancePackCompliancePaginator.ts index c2c0a403a71e..eddcff05d14a 100644 --- a/clients/client-config-service/src/pagination/DescribeConformancePackCompliancePaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeConformancePackCompliancePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeConformancePackComplianceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeConformancePackComplianceCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeConformancePackCompliance( +export const paginateDescribeConformancePackCompliance: ( config: ConfigServicePaginationConfiguration, input: DescribeConformancePackComplianceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeConformancePackComplianceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeConformancePackComplianceCommandInput, + DescribeConformancePackComplianceCommandOutput +>(ConfigServiceClient, DescribeConformancePackComplianceCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeConformancePackStatusPaginator.ts b/clients/client-config-service/src/pagination/DescribeConformancePackStatusPaginator.ts index 97c4a81ef291..fff27a77a454 100644 --- a/clients/client-config-service/src/pagination/DescribeConformancePackStatusPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeConformancePackStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeConformancePackStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeConformancePackStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeConformancePackStatus( +export const paginateDescribeConformancePackStatus: ( config: ConfigServicePaginationConfiguration, input: DescribeConformancePackStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeConformancePackStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeConformancePackStatusCommandInput, + DescribeConformancePackStatusCommandOutput +>(ConfigServiceClient, DescribeConformancePackStatusCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeConformancePacksPaginator.ts b/clients/client-config-service/src/pagination/DescribeConformancePacksPaginator.ts index e26aafc2c72b..e45dcfc3e844 100644 --- a/clients/client-config-service/src/pagination/DescribeConformancePacksPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeConformancePacksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeConformancePacksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeConformancePacksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeConformancePacks( +export const paginateDescribeConformancePacks: ( config: ConfigServicePaginationConfiguration, input: DescribeConformancePacksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeConformancePacksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeConformancePacksCommandInput, + DescribeConformancePacksCommandOutput +>(ConfigServiceClient, DescribeConformancePacksCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeOrganizationConfigRuleStatusesPaginator.ts b/clients/client-config-service/src/pagination/DescribeOrganizationConfigRuleStatusesPaginator.ts index 961f9bbf59ab..613de899ddd1 100644 --- a/clients/client-config-service/src/pagination/DescribeOrganizationConfigRuleStatusesPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeOrganizationConfigRuleStatusesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeOrganizationConfigRuleStatusesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOrganizationConfigRuleStatusesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOrganizationConfigRuleStatuses( +export const paginateDescribeOrganizationConfigRuleStatuses: ( config: ConfigServicePaginationConfiguration, input: DescribeOrganizationConfigRuleStatusesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOrganizationConfigRuleStatusesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeOrganizationConfigRuleStatusesCommandInput, + DescribeOrganizationConfigRuleStatusesCommandOutput +>(ConfigServiceClient, DescribeOrganizationConfigRuleStatusesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeOrganizationConfigRulesPaginator.ts b/clients/client-config-service/src/pagination/DescribeOrganizationConfigRulesPaginator.ts index 4d292920ffaa..d78981d33695 100644 --- a/clients/client-config-service/src/pagination/DescribeOrganizationConfigRulesPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeOrganizationConfigRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeOrganizationConfigRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOrganizationConfigRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOrganizationConfigRules( +export const paginateDescribeOrganizationConfigRules: ( config: ConfigServicePaginationConfiguration, input: DescribeOrganizationConfigRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOrganizationConfigRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeOrganizationConfigRulesCommandInput, + DescribeOrganizationConfigRulesCommandOutput +>(ConfigServiceClient, DescribeOrganizationConfigRulesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeOrganizationConformancePackStatusesPaginator.ts b/clients/client-config-service/src/pagination/DescribeOrganizationConformancePackStatusesPaginator.ts index e3f71b2d0f74..20faee92f56b 100644 --- a/clients/client-config-service/src/pagination/DescribeOrganizationConformancePackStatusesPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeOrganizationConformancePackStatusesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeOrganizationConformancePackStatusesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOrganizationConformancePackStatusesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOrganizationConformancePackStatuses( +export const paginateDescribeOrganizationConformancePackStatuses: ( config: ConfigServicePaginationConfiguration, input: DescribeOrganizationConformancePackStatusesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOrganizationConformancePackStatusesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeOrganizationConformancePackStatusesCommandInput, + DescribeOrganizationConformancePackStatusesCommandOutput +>(ConfigServiceClient, DescribeOrganizationConformancePackStatusesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeOrganizationConformancePacksPaginator.ts b/clients/client-config-service/src/pagination/DescribeOrganizationConformancePacksPaginator.ts index fb957fead196..1cb9fc99a5ed 100644 --- a/clients/client-config-service/src/pagination/DescribeOrganizationConformancePacksPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeOrganizationConformancePacksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeOrganizationConformancePacksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOrganizationConformancePacksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOrganizationConformancePacks( +export const paginateDescribeOrganizationConformancePacks: ( config: ConfigServicePaginationConfiguration, input: DescribeOrganizationConformancePacksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOrganizationConformancePacksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeOrganizationConformancePacksCommandInput, + DescribeOrganizationConformancePacksCommandOutput +>(ConfigServiceClient, DescribeOrganizationConformancePacksCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribePendingAggregationRequestsPaginator.ts b/clients/client-config-service/src/pagination/DescribePendingAggregationRequestsPaginator.ts index 416d3aaa99a4..b2c5a755be35 100644 --- a/clients/client-config-service/src/pagination/DescribePendingAggregationRequestsPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribePendingAggregationRequestsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribePendingAggregationRequestsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePendingAggregationRequestsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePendingAggregationRequests( +export const paginateDescribePendingAggregationRequests: ( config: ConfigServicePaginationConfiguration, input: DescribePendingAggregationRequestsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePendingAggregationRequestsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribePendingAggregationRequestsCommandInput, + DescribePendingAggregationRequestsCommandOutput +>(ConfigServiceClient, DescribePendingAggregationRequestsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeRemediationExceptionsPaginator.ts b/clients/client-config-service/src/pagination/DescribeRemediationExceptionsPaginator.ts index bdf5b1d0259a..b133a75bc9d7 100644 --- a/clients/client-config-service/src/pagination/DescribeRemediationExceptionsPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeRemediationExceptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeRemediationExceptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRemediationExceptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRemediationExceptions( +export const paginateDescribeRemediationExceptions: ( config: ConfigServicePaginationConfiguration, input: DescribeRemediationExceptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRemediationExceptionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeRemediationExceptionsCommandInput, + DescribeRemediationExceptionsCommandOutput +>(ConfigServiceClient, DescribeRemediationExceptionsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeRemediationExecutionStatusPaginator.ts b/clients/client-config-service/src/pagination/DescribeRemediationExecutionStatusPaginator.ts index 5335d151f529..48146f9bdc42 100644 --- a/clients/client-config-service/src/pagination/DescribeRemediationExecutionStatusPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeRemediationExecutionStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeRemediationExecutionStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRemediationExecutionStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRemediationExecutionStatus( +export const paginateDescribeRemediationExecutionStatus: ( config: ConfigServicePaginationConfiguration, input: DescribeRemediationExecutionStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRemediationExecutionStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeRemediationExecutionStatusCommandInput, + DescribeRemediationExecutionStatusCommandOutput +>(ConfigServiceClient, DescribeRemediationExecutionStatusCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/DescribeRetentionConfigurationsPaginator.ts b/clients/client-config-service/src/pagination/DescribeRetentionConfigurationsPaginator.ts index 89e839def99d..071abd9c23fd 100644 --- a/clients/client-config-service/src/pagination/DescribeRetentionConfigurationsPaginator.ts +++ b/clients/client-config-service/src/pagination/DescribeRetentionConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: DescribeRetentionConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRetentionConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRetentionConfigurations( +export const paginateDescribeRetentionConfigurations: ( config: ConfigServicePaginationConfiguration, input: DescribeRetentionConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRetentionConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + DescribeRetentionConfigurationsCommandInput, + DescribeRetentionConfigurationsCommandOutput +>(ConfigServiceClient, DescribeRetentionConfigurationsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-config-service/src/pagination/GetAggregateComplianceDetailsByConfigRulePaginator.ts b/clients/client-config-service/src/pagination/GetAggregateComplianceDetailsByConfigRulePaginator.ts index 2dca27291474..ba4b6b64dc26 100644 --- a/clients/client-config-service/src/pagination/GetAggregateComplianceDetailsByConfigRulePaginator.ts +++ b/clients/client-config-service/src/pagination/GetAggregateComplianceDetailsByConfigRulePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: GetAggregateComplianceDetailsByConfigRuleCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetAggregateComplianceDetailsByConfigRuleCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetAggregateComplianceDetailsByConfigRule( +export const paginateGetAggregateComplianceDetailsByConfigRule: ( config: ConfigServicePaginationConfiguration, input: GetAggregateComplianceDetailsByConfigRuleCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetAggregateComplianceDetailsByConfigRuleCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + GetAggregateComplianceDetailsByConfigRuleCommandInput, + GetAggregateComplianceDetailsByConfigRuleCommandOutput +>(ConfigServiceClient, GetAggregateComplianceDetailsByConfigRuleCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/GetAggregateConfigRuleComplianceSummaryPaginator.ts b/clients/client-config-service/src/pagination/GetAggregateConfigRuleComplianceSummaryPaginator.ts index ef5ed38431e6..689999457278 100644 --- a/clients/client-config-service/src/pagination/GetAggregateConfigRuleComplianceSummaryPaginator.ts +++ b/clients/client-config-service/src/pagination/GetAggregateConfigRuleComplianceSummaryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: GetAggregateConfigRuleComplianceSummaryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetAggregateConfigRuleComplianceSummaryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetAggregateConfigRuleComplianceSummary( +export const paginateGetAggregateConfigRuleComplianceSummary: ( config: ConfigServicePaginationConfiguration, input: GetAggregateConfigRuleComplianceSummaryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetAggregateConfigRuleComplianceSummaryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + GetAggregateConfigRuleComplianceSummaryCommandInput, + GetAggregateConfigRuleComplianceSummaryCommandOutput +>(ConfigServiceClient, GetAggregateConfigRuleComplianceSummaryCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/GetAggregateConformancePackComplianceSummaryPaginator.ts b/clients/client-config-service/src/pagination/GetAggregateConformancePackComplianceSummaryPaginator.ts index 840642971fdd..5e9c0c707159 100644 --- a/clients/client-config-service/src/pagination/GetAggregateConformancePackComplianceSummaryPaginator.ts +++ b/clients/client-config-service/src/pagination/GetAggregateConformancePackComplianceSummaryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: GetAggregateConformancePackComplianceSummaryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetAggregateConformancePackComplianceSummaryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetAggregateConformancePackComplianceSummary( +export const paginateGetAggregateConformancePackComplianceSummary: ( config: ConfigServicePaginationConfiguration, input: GetAggregateConformancePackComplianceSummaryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetAggregateConformancePackComplianceSummaryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + GetAggregateConformancePackComplianceSummaryCommandInput, + GetAggregateConformancePackComplianceSummaryCommandOutput +>(ConfigServiceClient, GetAggregateConformancePackComplianceSummaryCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/GetAggregateDiscoveredResourceCountsPaginator.ts b/clients/client-config-service/src/pagination/GetAggregateDiscoveredResourceCountsPaginator.ts index 36560d0ee23b..e4acacfb1a8d 100644 --- a/clients/client-config-service/src/pagination/GetAggregateDiscoveredResourceCountsPaginator.ts +++ b/clients/client-config-service/src/pagination/GetAggregateDiscoveredResourceCountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: GetAggregateDiscoveredResourceCountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetAggregateDiscoveredResourceCountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetAggregateDiscoveredResourceCounts( +export const paginateGetAggregateDiscoveredResourceCounts: ( config: ConfigServicePaginationConfiguration, input: GetAggregateDiscoveredResourceCountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetAggregateDiscoveredResourceCountsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + GetAggregateDiscoveredResourceCountsCommandInput, + GetAggregateDiscoveredResourceCountsCommandOutput +>(ConfigServiceClient, GetAggregateDiscoveredResourceCountsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/GetComplianceDetailsByConfigRulePaginator.ts b/clients/client-config-service/src/pagination/GetComplianceDetailsByConfigRulePaginator.ts index 167ff13e78e8..0f2238694bca 100644 --- a/clients/client-config-service/src/pagination/GetComplianceDetailsByConfigRulePaginator.ts +++ b/clients/client-config-service/src/pagination/GetComplianceDetailsByConfigRulePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: GetComplianceDetailsByConfigRuleCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetComplianceDetailsByConfigRuleCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetComplianceDetailsByConfigRule( +export const paginateGetComplianceDetailsByConfigRule: ( config: ConfigServicePaginationConfiguration, input: GetComplianceDetailsByConfigRuleCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetComplianceDetailsByConfigRuleCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + GetComplianceDetailsByConfigRuleCommandInput, + GetComplianceDetailsByConfigRuleCommandOutput +>(ConfigServiceClient, GetComplianceDetailsByConfigRuleCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/GetComplianceDetailsByResourcePaginator.ts b/clients/client-config-service/src/pagination/GetComplianceDetailsByResourcePaginator.ts index 5492136ec002..7d7ef518d918 100644 --- a/clients/client-config-service/src/pagination/GetComplianceDetailsByResourcePaginator.ts +++ b/clients/client-config-service/src/pagination/GetComplianceDetailsByResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: GetComplianceDetailsByResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetComplianceDetailsByResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetComplianceDetailsByResource( +export const paginateGetComplianceDetailsByResource: ( config: ConfigServicePaginationConfiguration, input: GetComplianceDetailsByResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetComplianceDetailsByResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + GetComplianceDetailsByResourceCommandInput, + GetComplianceDetailsByResourceCommandOutput +>(ConfigServiceClient, GetComplianceDetailsByResourceCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-config-service/src/pagination/GetConformancePackComplianceDetailsPaginator.ts b/clients/client-config-service/src/pagination/GetConformancePackComplianceDetailsPaginator.ts index a0547295ea81..cf8100fdb0b7 100644 --- a/clients/client-config-service/src/pagination/GetConformancePackComplianceDetailsPaginator.ts +++ b/clients/client-config-service/src/pagination/GetConformancePackComplianceDetailsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: GetConformancePackComplianceDetailsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetConformancePackComplianceDetailsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetConformancePackComplianceDetails( +export const paginateGetConformancePackComplianceDetails: ( config: ConfigServicePaginationConfiguration, input: GetConformancePackComplianceDetailsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetConformancePackComplianceDetailsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + GetConformancePackComplianceDetailsCommandInput, + GetConformancePackComplianceDetailsCommandOutput +>(ConfigServiceClient, GetConformancePackComplianceDetailsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/GetConformancePackComplianceSummaryPaginator.ts b/clients/client-config-service/src/pagination/GetConformancePackComplianceSummaryPaginator.ts index 23b3023cd03d..12ffbf9f5bc3 100644 --- a/clients/client-config-service/src/pagination/GetConformancePackComplianceSummaryPaginator.ts +++ b/clients/client-config-service/src/pagination/GetConformancePackComplianceSummaryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: GetConformancePackComplianceSummaryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetConformancePackComplianceSummaryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetConformancePackComplianceSummary( +export const paginateGetConformancePackComplianceSummary: ( config: ConfigServicePaginationConfiguration, input: GetConformancePackComplianceSummaryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetConformancePackComplianceSummaryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + GetConformancePackComplianceSummaryCommandInput, + GetConformancePackComplianceSummaryCommandOutput +>(ConfigServiceClient, GetConformancePackComplianceSummaryCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/GetDiscoveredResourceCountsPaginator.ts b/clients/client-config-service/src/pagination/GetDiscoveredResourceCountsPaginator.ts index a25b7e199436..e88b5ac255ee 100644 --- a/clients/client-config-service/src/pagination/GetDiscoveredResourceCountsPaginator.ts +++ b/clients/client-config-service/src/pagination/GetDiscoveredResourceCountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: GetDiscoveredResourceCountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetDiscoveredResourceCountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetDiscoveredResourceCounts( +export const paginateGetDiscoveredResourceCounts: ( config: ConfigServicePaginationConfiguration, input: GetDiscoveredResourceCountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetDiscoveredResourceCountsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + GetDiscoveredResourceCountsCommandInput, + GetDiscoveredResourceCountsCommandOutput +>(ConfigServiceClient, GetDiscoveredResourceCountsCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-config-service/src/pagination/GetOrganizationConfigRuleDetailedStatusPaginator.ts b/clients/client-config-service/src/pagination/GetOrganizationConfigRuleDetailedStatusPaginator.ts index 8c179a126b66..fed9b55fe274 100644 --- a/clients/client-config-service/src/pagination/GetOrganizationConfigRuleDetailedStatusPaginator.ts +++ b/clients/client-config-service/src/pagination/GetOrganizationConfigRuleDetailedStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: GetOrganizationConfigRuleDetailedStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetOrganizationConfigRuleDetailedStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetOrganizationConfigRuleDetailedStatus( +export const paginateGetOrganizationConfigRuleDetailedStatus: ( config: ConfigServicePaginationConfiguration, input: GetOrganizationConfigRuleDetailedStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetOrganizationConfigRuleDetailedStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + GetOrganizationConfigRuleDetailedStatusCommandInput, + GetOrganizationConfigRuleDetailedStatusCommandOutput +>(ConfigServiceClient, GetOrganizationConfigRuleDetailedStatusCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/GetOrganizationConformancePackDetailedStatusPaginator.ts b/clients/client-config-service/src/pagination/GetOrganizationConformancePackDetailedStatusPaginator.ts index dad4a9540870..62cb7eb8aefc 100644 --- a/clients/client-config-service/src/pagination/GetOrganizationConformancePackDetailedStatusPaginator.ts +++ b/clients/client-config-service/src/pagination/GetOrganizationConformancePackDetailedStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: GetOrganizationConformancePackDetailedStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetOrganizationConformancePackDetailedStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetOrganizationConformancePackDetailedStatus( +export const paginateGetOrganizationConformancePackDetailedStatus: ( config: ConfigServicePaginationConfiguration, input: GetOrganizationConformancePackDetailedStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetOrganizationConformancePackDetailedStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + GetOrganizationConformancePackDetailedStatusCommandInput, + GetOrganizationConformancePackDetailedStatusCommandOutput +>(ConfigServiceClient, GetOrganizationConformancePackDetailedStatusCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/GetResourceConfigHistoryPaginator.ts b/clients/client-config-service/src/pagination/GetResourceConfigHistoryPaginator.ts index 86cb11ba5c03..6ab4d49658b6 100644 --- a/clients/client-config-service/src/pagination/GetResourceConfigHistoryPaginator.ts +++ b/clients/client-config-service/src/pagination/GetResourceConfigHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: GetResourceConfigHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetResourceConfigHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetResourceConfigHistory( +export const paginateGetResourceConfigHistory: ( config: ConfigServicePaginationConfiguration, input: GetResourceConfigHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetResourceConfigHistoryCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + GetResourceConfigHistoryCommandInput, + GetResourceConfigHistoryCommandOutput +>(ConfigServiceClient, GetResourceConfigHistoryCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-config-service/src/pagination/ListAggregateDiscoveredResourcesPaginator.ts b/clients/client-config-service/src/pagination/ListAggregateDiscoveredResourcesPaginator.ts index 7c362b8ad5ad..f1ecdee56f01 100644 --- a/clients/client-config-service/src/pagination/ListAggregateDiscoveredResourcesPaginator.ts +++ b/clients/client-config-service/src/pagination/ListAggregateDiscoveredResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: ListAggregateDiscoveredResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAggregateDiscoveredResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAggregateDiscoveredResources( +export const paginateListAggregateDiscoveredResources: ( config: ConfigServicePaginationConfiguration, input: ListAggregateDiscoveredResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAggregateDiscoveredResourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + ListAggregateDiscoveredResourcesCommandInput, + ListAggregateDiscoveredResourcesCommandOutput +>(ConfigServiceClient, ListAggregateDiscoveredResourcesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/ListConformancePackComplianceScoresPaginator.ts b/clients/client-config-service/src/pagination/ListConformancePackComplianceScoresPaginator.ts index 650feb3c0b4c..ae4b2b212e47 100644 --- a/clients/client-config-service/src/pagination/ListConformancePackComplianceScoresPaginator.ts +++ b/clients/client-config-service/src/pagination/ListConformancePackComplianceScoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: ListConformancePackComplianceScoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConformancePackComplianceScoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConformancePackComplianceScores( +export const paginateListConformancePackComplianceScores: ( config: ConfigServicePaginationConfiguration, input: ListConformancePackComplianceScoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConformancePackComplianceScoresCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + ListConformancePackComplianceScoresCommandInput, + ListConformancePackComplianceScoresCommandOutput +>(ConfigServiceClient, ListConformancePackComplianceScoresCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/ListDiscoveredResourcesPaginator.ts b/clients/client-config-service/src/pagination/ListDiscoveredResourcesPaginator.ts index 1dcbb99c0ce5..e4138310eccb 100644 --- a/clients/client-config-service/src/pagination/ListDiscoveredResourcesPaginator.ts +++ b/clients/client-config-service/src/pagination/ListDiscoveredResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: ListDiscoveredResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDiscoveredResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDiscoveredResources( +export const paginateListDiscoveredResources: ( config: ConfigServicePaginationConfiguration, input: ListDiscoveredResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDiscoveredResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + ListDiscoveredResourcesCommandInput, + ListDiscoveredResourcesCommandOutput +>(ConfigServiceClient, ListDiscoveredResourcesCommand, "nextToken", "nextToken", "limit"); diff --git a/clients/client-config-service/src/pagination/ListResourceEvaluationsPaginator.ts b/clients/client-config-service/src/pagination/ListResourceEvaluationsPaginator.ts index da689e574f44..dc38b18a05f7 100644 --- a/clients/client-config-service/src/pagination/ListResourceEvaluationsPaginator.ts +++ b/clients/client-config-service/src/pagination/ListResourceEvaluationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: ListResourceEvaluationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourceEvaluationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourceEvaluations( +export const paginateListResourceEvaluations: ( config: ConfigServicePaginationConfiguration, input: ListResourceEvaluationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourceEvaluationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + ListResourceEvaluationsCommandInput, + ListResourceEvaluationsCommandOutput +>(ConfigServiceClient, ListResourceEvaluationsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/ListStoredQueriesPaginator.ts b/clients/client-config-service/src/pagination/ListStoredQueriesPaginator.ts index 4babf9c089c0..4977cd845266 100644 --- a/clients/client-config-service/src/pagination/ListStoredQueriesPaginator.ts +++ b/clients/client-config-service/src/pagination/ListStoredQueriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: ListStoredQueriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStoredQueriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStoredQueries( +export const paginateListStoredQueries: ( config: ConfigServicePaginationConfiguration, input: ListStoredQueriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStoredQueriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + ListStoredQueriesCommandInput, + ListStoredQueriesCommandOutput +>(ConfigServiceClient, ListStoredQueriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-config-service/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-config-service/src/pagination/ListTagsForResourcePaginator.ts index 9656a67d6151..adca67fccde4 100644 --- a/clients/client-config-service/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-config-service/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: ConfigServicePaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(ConfigServiceClient, ListTagsForResourceCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/SelectAggregateResourceConfigPaginator.ts b/clients/client-config-service/src/pagination/SelectAggregateResourceConfigPaginator.ts index a7e65ab63a87..7fdc36c59b27 100644 --- a/clients/client-config-service/src/pagination/SelectAggregateResourceConfigPaginator.ts +++ b/clients/client-config-service/src/pagination/SelectAggregateResourceConfigPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: SelectAggregateResourceConfigCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SelectAggregateResourceConfigCommand(input), ...args); -}; /** * @public */ -export async function* paginateSelectAggregateResourceConfig( +export const paginateSelectAggregateResourceConfig: ( config: ConfigServicePaginationConfiguration, input: SelectAggregateResourceConfigCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SelectAggregateResourceConfigCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + SelectAggregateResourceConfigCommandInput, + SelectAggregateResourceConfigCommandOutput +>(ConfigServiceClient, SelectAggregateResourceConfigCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-config-service/src/pagination/SelectResourceConfigPaginator.ts b/clients/client-config-service/src/pagination/SelectResourceConfigPaginator.ts index b20677b3d1ec..56c642addc8a 100644 --- a/clients/client-config-service/src/pagination/SelectResourceConfigPaginator.ts +++ b/clients/client-config-service/src/pagination/SelectResourceConfigPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConfigServiceClient } from "../ConfigServiceClient"; import { ConfigServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConfigServiceClient, - input: SelectResourceConfigCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SelectResourceConfigCommand(input), ...args); -}; /** * @public */ -export async function* paginateSelectResourceConfig( +export const paginateSelectResourceConfig: ( config: ConfigServicePaginationConfiguration, input: SelectResourceConfigCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SelectResourceConfigCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof ConfigServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConfigService | ConfigServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConfigServicePaginationConfiguration, + SelectResourceConfigCommandInput, + SelectResourceConfigCommandOutput +>(ConfigServiceClient, SelectResourceConfigCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-connect-contact-lens/src/pagination/ListRealtimeContactAnalysisSegmentsPaginator.ts b/clients/client-connect-contact-lens/src/pagination/ListRealtimeContactAnalysisSegmentsPaginator.ts index 1589d66f5de5..f4d793c9e51c 100644 --- a/clients/client-connect-contact-lens/src/pagination/ListRealtimeContactAnalysisSegmentsPaginator.ts +++ b/clients/client-connect-contact-lens/src/pagination/ListRealtimeContactAnalysisSegmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectContactLensClient } from "../ConnectContactLensClient"; import { ConnectContactLensPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectContactLensClient, - input: ListRealtimeContactAnalysisSegmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRealtimeContactAnalysisSegmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRealtimeContactAnalysisSegments( +export const paginateListRealtimeContactAnalysisSegments: ( config: ConnectContactLensPaginationConfiguration, input: ListRealtimeContactAnalysisSegmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRealtimeContactAnalysisSegmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectContactLensClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConnectContactLens | ConnectContactLensClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectContactLensPaginationConfiguration, + ListRealtimeContactAnalysisSegmentsCommandInput, + ListRealtimeContactAnalysisSegmentsCommandOutput +>(ConnectContactLensClient, ListRealtimeContactAnalysisSegmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/GetCurrentMetricDataPaginator.ts b/clients/client-connect/src/pagination/GetCurrentMetricDataPaginator.ts index f69f968cb37c..be2db640540b 100644 --- a/clients/client-connect/src/pagination/GetCurrentMetricDataPaginator.ts +++ b/clients/client-connect/src/pagination/GetCurrentMetricDataPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: GetCurrentMetricDataCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCurrentMetricDataCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCurrentMetricData( +export const paginateGetCurrentMetricData: ( config: ConnectPaginationConfiguration, input: GetCurrentMetricDataCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCurrentMetricDataCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + GetCurrentMetricDataCommandInput, + GetCurrentMetricDataCommandOutput +>(ConnectClient, GetCurrentMetricDataCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/GetCurrentUserDataPaginator.ts b/clients/client-connect/src/pagination/GetCurrentUserDataPaginator.ts index b022495fe4e4..13a87868d8a2 100644 --- a/clients/client-connect/src/pagination/GetCurrentUserDataPaginator.ts +++ b/clients/client-connect/src/pagination/GetCurrentUserDataPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: GetCurrentUserDataCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCurrentUserDataCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCurrentUserData( +export const paginateGetCurrentUserData: ( config: ConnectPaginationConfiguration, input: GetCurrentUserDataCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCurrentUserDataCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + GetCurrentUserDataCommandInput, + GetCurrentUserDataCommandOutput +>(ConnectClient, GetCurrentUserDataCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/GetMetricDataPaginator.ts b/clients/client-connect/src/pagination/GetMetricDataPaginator.ts index 4fe49f3a626c..4f461085799b 100644 --- a/clients/client-connect/src/pagination/GetMetricDataPaginator.ts +++ b/clients/client-connect/src/pagination/GetMetricDataPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: GetMetricDataCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetMetricDataCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetMetricData( +export const paginateGetMetricData: ( config: ConnectPaginationConfiguration, input: GetMetricDataCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetMetricDataCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + GetMetricDataCommandInput, + GetMetricDataCommandOutput +>(ConnectClient, GetMetricDataCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/GetMetricDataV2Paginator.ts b/clients/client-connect/src/pagination/GetMetricDataV2Paginator.ts index 040e1a486c7e..c67ce58574aa 100644 --- a/clients/client-connect/src/pagination/GetMetricDataV2Paginator.ts +++ b/clients/client-connect/src/pagination/GetMetricDataV2Paginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: GetMetricDataV2CommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetMetricDataV2Command(input), ...args); -}; /** * @public */ -export async function* paginateGetMetricDataV2( +export const paginateGetMetricDataV2: ( config: ConnectPaginationConfiguration, input: GetMetricDataV2CommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetMetricDataV2CommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + GetMetricDataV2CommandInput, + GetMetricDataV2CommandOutput +>(ConnectClient, GetMetricDataV2Command, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListAgentStatusesPaginator.ts b/clients/client-connect/src/pagination/ListAgentStatusesPaginator.ts index 5fd2b7c1fa4b..7b0cd8b25b59 100644 --- a/clients/client-connect/src/pagination/ListAgentStatusesPaginator.ts +++ b/clients/client-connect/src/pagination/ListAgentStatusesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListAgentStatusesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAgentStatusesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAgentStatuses( +export const paginateListAgentStatuses: ( config: ConnectPaginationConfiguration, input: ListAgentStatusesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAgentStatusesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListAgentStatusesCommandInput, + ListAgentStatusesCommandOutput +>(ConnectClient, ListAgentStatusesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListApprovedOriginsPaginator.ts b/clients/client-connect/src/pagination/ListApprovedOriginsPaginator.ts index d801fad203da..3e8c806d9e01 100644 --- a/clients/client-connect/src/pagination/ListApprovedOriginsPaginator.ts +++ b/clients/client-connect/src/pagination/ListApprovedOriginsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListApprovedOriginsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApprovedOriginsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApprovedOrigins( +export const paginateListApprovedOrigins: ( config: ConnectPaginationConfiguration, input: ListApprovedOriginsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApprovedOriginsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListApprovedOriginsCommandInput, + ListApprovedOriginsCommandOutput +>(ConnectClient, ListApprovedOriginsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListBotsPaginator.ts b/clients/client-connect/src/pagination/ListBotsPaginator.ts index c207330a9450..ed8e3efabdc1 100644 --- a/clients/client-connect/src/pagination/ListBotsPaginator.ts +++ b/clients/client-connect/src/pagination/ListBotsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListBotsCommand, ListBotsCommandInput, ListBotsCommandOutput } from "../commands/ListBotsCommand"; import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListBotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBots( +export const paginateListBots: ( config: ConnectPaginationConfiguration, input: ListBotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBotsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListBotsCommandInput, + ListBotsCommandOutput +>(ConnectClient, ListBotsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListContactEvaluationsPaginator.ts b/clients/client-connect/src/pagination/ListContactEvaluationsPaginator.ts index f940c1c3bfe2..48282bac88d1 100644 --- a/clients/client-connect/src/pagination/ListContactEvaluationsPaginator.ts +++ b/clients/client-connect/src/pagination/ListContactEvaluationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListContactEvaluationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContactEvaluationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContactEvaluations( +export const paginateListContactEvaluations: ( config: ConnectPaginationConfiguration, input: ListContactEvaluationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContactEvaluationsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListContactEvaluationsCommandInput, + ListContactEvaluationsCommandOutput +>(ConnectClient, ListContactEvaluationsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-connect/src/pagination/ListContactFlowModulesPaginator.ts b/clients/client-connect/src/pagination/ListContactFlowModulesPaginator.ts index 57972495c1ac..5b7a4d28d351 100644 --- a/clients/client-connect/src/pagination/ListContactFlowModulesPaginator.ts +++ b/clients/client-connect/src/pagination/ListContactFlowModulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListContactFlowModulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContactFlowModulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContactFlowModules( +export const paginateListContactFlowModules: ( config: ConnectPaginationConfiguration, input: ListContactFlowModulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContactFlowModulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListContactFlowModulesCommandInput, + ListContactFlowModulesCommandOutput +>(ConnectClient, ListContactFlowModulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListContactFlowsPaginator.ts b/clients/client-connect/src/pagination/ListContactFlowsPaginator.ts index 18d4183e93b0..1dc786f833c9 100644 --- a/clients/client-connect/src/pagination/ListContactFlowsPaginator.ts +++ b/clients/client-connect/src/pagination/ListContactFlowsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListContactFlowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContactFlowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContactFlows( +export const paginateListContactFlows: ( config: ConnectPaginationConfiguration, input: ListContactFlowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContactFlowsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListContactFlowsCommandInput, + ListContactFlowsCommandOutput +>(ConnectClient, ListContactFlowsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListContactReferencesPaginator.ts b/clients/client-connect/src/pagination/ListContactReferencesPaginator.ts index 01a72115fd76..658c78a39f5f 100644 --- a/clients/client-connect/src/pagination/ListContactReferencesPaginator.ts +++ b/clients/client-connect/src/pagination/ListContactReferencesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListContactReferencesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContactReferencesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContactReferences( +export const paginateListContactReferences: ( config: ConnectPaginationConfiguration, input: ListContactReferencesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContactReferencesCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListContactReferencesCommandInput, + ListContactReferencesCommandOutput +>(ConnectClient, ListContactReferencesCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-connect/src/pagination/ListDefaultVocabulariesPaginator.ts b/clients/client-connect/src/pagination/ListDefaultVocabulariesPaginator.ts index 4974d45e130a..059b8ea2202e 100644 --- a/clients/client-connect/src/pagination/ListDefaultVocabulariesPaginator.ts +++ b/clients/client-connect/src/pagination/ListDefaultVocabulariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListDefaultVocabulariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDefaultVocabulariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDefaultVocabularies( +export const paginateListDefaultVocabularies: ( config: ConnectPaginationConfiguration, input: ListDefaultVocabulariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDefaultVocabulariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListDefaultVocabulariesCommandInput, + ListDefaultVocabulariesCommandOutput +>(ConnectClient, ListDefaultVocabulariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListEvaluationFormVersionsPaginator.ts b/clients/client-connect/src/pagination/ListEvaluationFormVersionsPaginator.ts index 127c3e28a672..09b3b371e648 100644 --- a/clients/client-connect/src/pagination/ListEvaluationFormVersionsPaginator.ts +++ b/clients/client-connect/src/pagination/ListEvaluationFormVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListEvaluationFormVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEvaluationFormVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEvaluationFormVersions( +export const paginateListEvaluationFormVersions: ( config: ConnectPaginationConfiguration, input: ListEvaluationFormVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEvaluationFormVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListEvaluationFormVersionsCommandInput, + ListEvaluationFormVersionsCommandOutput +>(ConnectClient, ListEvaluationFormVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListEvaluationFormsPaginator.ts b/clients/client-connect/src/pagination/ListEvaluationFormsPaginator.ts index 371245660b64..01be5231e01e 100644 --- a/clients/client-connect/src/pagination/ListEvaluationFormsPaginator.ts +++ b/clients/client-connect/src/pagination/ListEvaluationFormsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListEvaluationFormsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEvaluationFormsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEvaluationForms( +export const paginateListEvaluationForms: ( config: ConnectPaginationConfiguration, input: ListEvaluationFormsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEvaluationFormsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListEvaluationFormsCommandInput, + ListEvaluationFormsCommandOutput +>(ConnectClient, ListEvaluationFormsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListFlowAssociationsPaginator.ts b/clients/client-connect/src/pagination/ListFlowAssociationsPaginator.ts index 132b4f0ad9b5..76a7144c8d4f 100644 --- a/clients/client-connect/src/pagination/ListFlowAssociationsPaginator.ts +++ b/clients/client-connect/src/pagination/ListFlowAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListFlowAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFlowAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFlowAssociations( +export const paginateListFlowAssociations: ( config: ConnectPaginationConfiguration, input: ListFlowAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFlowAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListFlowAssociationsCommandInput, + ListFlowAssociationsCommandOutput +>(ConnectClient, ListFlowAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListHoursOfOperationsPaginator.ts b/clients/client-connect/src/pagination/ListHoursOfOperationsPaginator.ts index 65043f2bb1ad..b600e1551f36 100644 --- a/clients/client-connect/src/pagination/ListHoursOfOperationsPaginator.ts +++ b/clients/client-connect/src/pagination/ListHoursOfOperationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListHoursOfOperationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHoursOfOperationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHoursOfOperations( +export const paginateListHoursOfOperations: ( config: ConnectPaginationConfiguration, input: ListHoursOfOperationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHoursOfOperationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListHoursOfOperationsCommandInput, + ListHoursOfOperationsCommandOutput +>(ConnectClient, ListHoursOfOperationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListInstanceAttributesPaginator.ts b/clients/client-connect/src/pagination/ListInstanceAttributesPaginator.ts index 3c56b0dd085c..b601f22e4c75 100644 --- a/clients/client-connect/src/pagination/ListInstanceAttributesPaginator.ts +++ b/clients/client-connect/src/pagination/ListInstanceAttributesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListInstanceAttributesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInstanceAttributesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInstanceAttributes( +export const paginateListInstanceAttributes: ( config: ConnectPaginationConfiguration, input: ListInstanceAttributesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInstanceAttributesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListInstanceAttributesCommandInput, + ListInstanceAttributesCommandOutput +>(ConnectClient, ListInstanceAttributesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListInstanceStorageConfigsPaginator.ts b/clients/client-connect/src/pagination/ListInstanceStorageConfigsPaginator.ts index 57a17fc5f533..7243ceb5be68 100644 --- a/clients/client-connect/src/pagination/ListInstanceStorageConfigsPaginator.ts +++ b/clients/client-connect/src/pagination/ListInstanceStorageConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListInstanceStorageConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInstanceStorageConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInstanceStorageConfigs( +export const paginateListInstanceStorageConfigs: ( config: ConnectPaginationConfiguration, input: ListInstanceStorageConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInstanceStorageConfigsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListInstanceStorageConfigsCommandInput, + ListInstanceStorageConfigsCommandOutput +>(ConnectClient, ListInstanceStorageConfigsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListInstancesPaginator.ts b/clients/client-connect/src/pagination/ListInstancesPaginator.ts index 82b710d2af22..7f4f9d232f3f 100644 --- a/clients/client-connect/src/pagination/ListInstancesPaginator.ts +++ b/clients/client-connect/src/pagination/ListInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInstances( +export const paginateListInstances: ( config: ConnectPaginationConfiguration, input: ListInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListInstancesCommandInput, + ListInstancesCommandOutput +>(ConnectClient, ListInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListIntegrationAssociationsPaginator.ts b/clients/client-connect/src/pagination/ListIntegrationAssociationsPaginator.ts index 7de58675e97b..b18703cc8bfe 100644 --- a/clients/client-connect/src/pagination/ListIntegrationAssociationsPaginator.ts +++ b/clients/client-connect/src/pagination/ListIntegrationAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListIntegrationAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIntegrationAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIntegrationAssociations( +export const paginateListIntegrationAssociations: ( config: ConnectPaginationConfiguration, input: ListIntegrationAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIntegrationAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListIntegrationAssociationsCommandInput, + ListIntegrationAssociationsCommandOutput +>(ConnectClient, ListIntegrationAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListLambdaFunctionsPaginator.ts b/clients/client-connect/src/pagination/ListLambdaFunctionsPaginator.ts index 2607b5ba24aa..dc6a288bb2ad 100644 --- a/clients/client-connect/src/pagination/ListLambdaFunctionsPaginator.ts +++ b/clients/client-connect/src/pagination/ListLambdaFunctionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListLambdaFunctionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLambdaFunctionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLambdaFunctions( +export const paginateListLambdaFunctions: ( config: ConnectPaginationConfiguration, input: ListLambdaFunctionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLambdaFunctionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListLambdaFunctionsCommandInput, + ListLambdaFunctionsCommandOutput +>(ConnectClient, ListLambdaFunctionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListLexBotsPaginator.ts b/clients/client-connect/src/pagination/ListLexBotsPaginator.ts index f68a15789a1c..c5715d9bec34 100644 --- a/clients/client-connect/src/pagination/ListLexBotsPaginator.ts +++ b/clients/client-connect/src/pagination/ListLexBotsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListLexBotsCommand, ListLexBotsCommandInput, ListLexBotsCommandOutput } from "../commands/ListLexBotsCommand"; import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListLexBotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLexBotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLexBots( +export const paginateListLexBots: ( config: ConnectPaginationConfiguration, input: ListLexBotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLexBotsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListLexBotsCommandInput, + ListLexBotsCommandOutput +>(ConnectClient, ListLexBotsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListPhoneNumbersPaginator.ts b/clients/client-connect/src/pagination/ListPhoneNumbersPaginator.ts index f6f3bf15b963..01514242d137 100644 --- a/clients/client-connect/src/pagination/ListPhoneNumbersPaginator.ts +++ b/clients/client-connect/src/pagination/ListPhoneNumbersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListPhoneNumbersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPhoneNumbersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPhoneNumbers( +export const paginateListPhoneNumbers: ( config: ConnectPaginationConfiguration, input: ListPhoneNumbersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPhoneNumbersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListPhoneNumbersCommandInput, + ListPhoneNumbersCommandOutput +>(ConnectClient, ListPhoneNumbersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListPhoneNumbersV2Paginator.ts b/clients/client-connect/src/pagination/ListPhoneNumbersV2Paginator.ts index 8623d8a60660..ffbdb1b27ada 100644 --- a/clients/client-connect/src/pagination/ListPhoneNumbersV2Paginator.ts +++ b/clients/client-connect/src/pagination/ListPhoneNumbersV2Paginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListPhoneNumbersV2CommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPhoneNumbersV2Command(input), ...args); -}; /** * @public */ -export async function* paginateListPhoneNumbersV2( +export const paginateListPhoneNumbersV2: ( config: ConnectPaginationConfiguration, input: ListPhoneNumbersV2CommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPhoneNumbersV2CommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListPhoneNumbersV2CommandInput, + ListPhoneNumbersV2CommandOutput +>(ConnectClient, ListPhoneNumbersV2Command, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListPromptsPaginator.ts b/clients/client-connect/src/pagination/ListPromptsPaginator.ts index e6398ddf5078..4d984a965193 100644 --- a/clients/client-connect/src/pagination/ListPromptsPaginator.ts +++ b/clients/client-connect/src/pagination/ListPromptsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListPromptsCommand, ListPromptsCommandInput, ListPromptsCommandOutput } from "../commands/ListPromptsCommand"; import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListPromptsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPromptsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPrompts( +export const paginateListPrompts: ( config: ConnectPaginationConfiguration, input: ListPromptsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPromptsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListPromptsCommandInput, + ListPromptsCommandOutput +>(ConnectClient, ListPromptsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListQueueQuickConnectsPaginator.ts b/clients/client-connect/src/pagination/ListQueueQuickConnectsPaginator.ts index b5e8f5a9bff4..59b1ae570037 100644 --- a/clients/client-connect/src/pagination/ListQueueQuickConnectsPaginator.ts +++ b/clients/client-connect/src/pagination/ListQueueQuickConnectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListQueueQuickConnectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListQueueQuickConnectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListQueueQuickConnects( +export const paginateListQueueQuickConnects: ( config: ConnectPaginationConfiguration, input: ListQueueQuickConnectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListQueueQuickConnectsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListQueueQuickConnectsCommandInput, + ListQueueQuickConnectsCommandOutput +>(ConnectClient, ListQueueQuickConnectsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListQueuesPaginator.ts b/clients/client-connect/src/pagination/ListQueuesPaginator.ts index 573144daab4e..dc79ad9bc239 100644 --- a/clients/client-connect/src/pagination/ListQueuesPaginator.ts +++ b/clients/client-connect/src/pagination/ListQueuesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListQueuesCommand, ListQueuesCommandInput, ListQueuesCommandOutput } from "../commands/ListQueuesCommand"; import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListQueuesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListQueuesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListQueues( +export const paginateListQueues: ( config: ConnectPaginationConfiguration, input: ListQueuesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListQueuesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListQueuesCommandInput, + ListQueuesCommandOutput +>(ConnectClient, ListQueuesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListQuickConnectsPaginator.ts b/clients/client-connect/src/pagination/ListQuickConnectsPaginator.ts index ba2bb0605cec..5d7102d7b670 100644 --- a/clients/client-connect/src/pagination/ListQuickConnectsPaginator.ts +++ b/clients/client-connect/src/pagination/ListQuickConnectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListQuickConnectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListQuickConnectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListQuickConnects( +export const paginateListQuickConnects: ( config: ConnectPaginationConfiguration, input: ListQuickConnectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListQuickConnectsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListQuickConnectsCommandInput, + ListQuickConnectsCommandOutput +>(ConnectClient, ListQuickConnectsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListRealtimeContactAnalysisSegmentsV2Paginator.ts b/clients/client-connect/src/pagination/ListRealtimeContactAnalysisSegmentsV2Paginator.ts index e10547c10e36..7c8897bfac47 100644 --- a/clients/client-connect/src/pagination/ListRealtimeContactAnalysisSegmentsV2Paginator.ts +++ b/clients/client-connect/src/pagination/ListRealtimeContactAnalysisSegmentsV2Paginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListRealtimeContactAnalysisSegmentsV2CommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRealtimeContactAnalysisSegmentsV2Command(input), ...args); -}; /** * @public */ -export async function* paginateListRealtimeContactAnalysisSegmentsV2( +export const paginateListRealtimeContactAnalysisSegmentsV2: ( config: ConnectPaginationConfiguration, input: ListRealtimeContactAnalysisSegmentsV2CommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRealtimeContactAnalysisSegmentsV2CommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListRealtimeContactAnalysisSegmentsV2CommandInput, + ListRealtimeContactAnalysisSegmentsV2CommandOutput +>(ConnectClient, ListRealtimeContactAnalysisSegmentsV2Command, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListRoutingProfileQueuesPaginator.ts b/clients/client-connect/src/pagination/ListRoutingProfileQueuesPaginator.ts index 9f184a398c34..e5f39c2412e2 100644 --- a/clients/client-connect/src/pagination/ListRoutingProfileQueuesPaginator.ts +++ b/clients/client-connect/src/pagination/ListRoutingProfileQueuesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListRoutingProfileQueuesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRoutingProfileQueuesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRoutingProfileQueues( +export const paginateListRoutingProfileQueues: ( config: ConnectPaginationConfiguration, input: ListRoutingProfileQueuesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRoutingProfileQueuesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListRoutingProfileQueuesCommandInput, + ListRoutingProfileQueuesCommandOutput +>(ConnectClient, ListRoutingProfileQueuesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListRoutingProfilesPaginator.ts b/clients/client-connect/src/pagination/ListRoutingProfilesPaginator.ts index 70efbac3c235..31861caa17a5 100644 --- a/clients/client-connect/src/pagination/ListRoutingProfilesPaginator.ts +++ b/clients/client-connect/src/pagination/ListRoutingProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListRoutingProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRoutingProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRoutingProfiles( +export const paginateListRoutingProfiles: ( config: ConnectPaginationConfiguration, input: ListRoutingProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRoutingProfilesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListRoutingProfilesCommandInput, + ListRoutingProfilesCommandOutput +>(ConnectClient, ListRoutingProfilesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListRulesPaginator.ts b/clients/client-connect/src/pagination/ListRulesPaginator.ts index 84db2c9865e0..aa7955d973ba 100644 --- a/clients/client-connect/src/pagination/ListRulesPaginator.ts +++ b/clients/client-connect/src/pagination/ListRulesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListRulesCommand, ListRulesCommandInput, ListRulesCommandOutput } from "../commands/ListRulesCommand"; import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRules( +export const paginateListRules: ( config: ConnectPaginationConfiguration, input: ListRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListRulesCommandInput, + ListRulesCommandOutput +>(ConnectClient, ListRulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListSecurityKeysPaginator.ts b/clients/client-connect/src/pagination/ListSecurityKeysPaginator.ts index ffd9da3d603b..d4e5c7f463ee 100644 --- a/clients/client-connect/src/pagination/ListSecurityKeysPaginator.ts +++ b/clients/client-connect/src/pagination/ListSecurityKeysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListSecurityKeysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSecurityKeysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSecurityKeys( +export const paginateListSecurityKeys: ( config: ConnectPaginationConfiguration, input: ListSecurityKeysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSecurityKeysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListSecurityKeysCommandInput, + ListSecurityKeysCommandOutput +>(ConnectClient, ListSecurityKeysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListSecurityProfileApplicationsPaginator.ts b/clients/client-connect/src/pagination/ListSecurityProfileApplicationsPaginator.ts index e994acc14d0f..52716191a78d 100644 --- a/clients/client-connect/src/pagination/ListSecurityProfileApplicationsPaginator.ts +++ b/clients/client-connect/src/pagination/ListSecurityProfileApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListSecurityProfileApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSecurityProfileApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSecurityProfileApplications( +export const paginateListSecurityProfileApplications: ( config: ConnectPaginationConfiguration, input: ListSecurityProfileApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSecurityProfileApplicationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListSecurityProfileApplicationsCommandInput, + ListSecurityProfileApplicationsCommandOutput +>(ConnectClient, ListSecurityProfileApplicationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListSecurityProfilePermissionsPaginator.ts b/clients/client-connect/src/pagination/ListSecurityProfilePermissionsPaginator.ts index 281bef354793..2986c606f93b 100644 --- a/clients/client-connect/src/pagination/ListSecurityProfilePermissionsPaginator.ts +++ b/clients/client-connect/src/pagination/ListSecurityProfilePermissionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListSecurityProfilePermissionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSecurityProfilePermissionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSecurityProfilePermissions( +export const paginateListSecurityProfilePermissions: ( config: ConnectPaginationConfiguration, input: ListSecurityProfilePermissionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSecurityProfilePermissionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListSecurityProfilePermissionsCommandInput, + ListSecurityProfilePermissionsCommandOutput +>(ConnectClient, ListSecurityProfilePermissionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListSecurityProfilesPaginator.ts b/clients/client-connect/src/pagination/ListSecurityProfilesPaginator.ts index 5069a425a0d7..46931f020f4b 100644 --- a/clients/client-connect/src/pagination/ListSecurityProfilesPaginator.ts +++ b/clients/client-connect/src/pagination/ListSecurityProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListSecurityProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSecurityProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSecurityProfiles( +export const paginateListSecurityProfiles: ( config: ConnectPaginationConfiguration, input: ListSecurityProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSecurityProfilesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListSecurityProfilesCommandInput, + ListSecurityProfilesCommandOutput +>(ConnectClient, ListSecurityProfilesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListTaskTemplatesPaginator.ts b/clients/client-connect/src/pagination/ListTaskTemplatesPaginator.ts index 07654f6b911e..d2e1a53f3cb0 100644 --- a/clients/client-connect/src/pagination/ListTaskTemplatesPaginator.ts +++ b/clients/client-connect/src/pagination/ListTaskTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListTaskTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTaskTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTaskTemplates( +export const paginateListTaskTemplates: ( config: ConnectPaginationConfiguration, input: ListTaskTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTaskTemplatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListTaskTemplatesCommandInput, + ListTaskTemplatesCommandOutput +>(ConnectClient, ListTaskTemplatesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListTrafficDistributionGroupUsersPaginator.ts b/clients/client-connect/src/pagination/ListTrafficDistributionGroupUsersPaginator.ts index cf38440329b4..6026bec8a8e3 100644 --- a/clients/client-connect/src/pagination/ListTrafficDistributionGroupUsersPaginator.ts +++ b/clients/client-connect/src/pagination/ListTrafficDistributionGroupUsersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListTrafficDistributionGroupUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTrafficDistributionGroupUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTrafficDistributionGroupUsers( +export const paginateListTrafficDistributionGroupUsers: ( config: ConnectPaginationConfiguration, input: ListTrafficDistributionGroupUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTrafficDistributionGroupUsersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListTrafficDistributionGroupUsersCommandInput, + ListTrafficDistributionGroupUsersCommandOutput +>(ConnectClient, ListTrafficDistributionGroupUsersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListTrafficDistributionGroupsPaginator.ts b/clients/client-connect/src/pagination/ListTrafficDistributionGroupsPaginator.ts index b0a1d479112e..4f47486acb49 100644 --- a/clients/client-connect/src/pagination/ListTrafficDistributionGroupsPaginator.ts +++ b/clients/client-connect/src/pagination/ListTrafficDistributionGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListTrafficDistributionGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTrafficDistributionGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTrafficDistributionGroups( +export const paginateListTrafficDistributionGroups: ( config: ConnectPaginationConfiguration, input: ListTrafficDistributionGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTrafficDistributionGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListTrafficDistributionGroupsCommandInput, + ListTrafficDistributionGroupsCommandOutput +>(ConnectClient, ListTrafficDistributionGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListUseCasesPaginator.ts b/clients/client-connect/src/pagination/ListUseCasesPaginator.ts index 7137aa65c2cf..8b1bb4303145 100644 --- a/clients/client-connect/src/pagination/ListUseCasesPaginator.ts +++ b/clients/client-connect/src/pagination/ListUseCasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListUseCasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUseCasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUseCases( +export const paginateListUseCases: ( config: ConnectPaginationConfiguration, input: ListUseCasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUseCasesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListUseCasesCommandInput, + ListUseCasesCommandOutput +>(ConnectClient, ListUseCasesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListUserHierarchyGroupsPaginator.ts b/clients/client-connect/src/pagination/ListUserHierarchyGroupsPaginator.ts index 4d4a009fa9ba..139df139fd92 100644 --- a/clients/client-connect/src/pagination/ListUserHierarchyGroupsPaginator.ts +++ b/clients/client-connect/src/pagination/ListUserHierarchyGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListUserHierarchyGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUserHierarchyGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUserHierarchyGroups( +export const paginateListUserHierarchyGroups: ( config: ConnectPaginationConfiguration, input: ListUserHierarchyGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUserHierarchyGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListUserHierarchyGroupsCommandInput, + ListUserHierarchyGroupsCommandOutput +>(ConnectClient, ListUserHierarchyGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListUsersPaginator.ts b/clients/client-connect/src/pagination/ListUsersPaginator.ts index 50900677c3bf..8c533265e743 100644 --- a/clients/client-connect/src/pagination/ListUsersPaginator.ts +++ b/clients/client-connect/src/pagination/ListUsersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListUsersCommand, ListUsersCommandInput, ListUsersCommandOutput } from "../commands/ListUsersCommand"; import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUsers( +export const paginateListUsers: ( config: ConnectPaginationConfiguration, input: ListUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUsersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListUsersCommandInput, + ListUsersCommandOutput +>(ConnectClient, ListUsersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListViewVersionsPaginator.ts b/clients/client-connect/src/pagination/ListViewVersionsPaginator.ts index 804fdc0fb836..c04a7306665b 100644 --- a/clients/client-connect/src/pagination/ListViewVersionsPaginator.ts +++ b/clients/client-connect/src/pagination/ListViewVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListViewVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListViewVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListViewVersions( +export const paginateListViewVersions: ( config: ConnectPaginationConfiguration, input: ListViewVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListViewVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListViewVersionsCommandInput, + ListViewVersionsCommandOutput +>(ConnectClient, ListViewVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/ListViewsPaginator.ts b/clients/client-connect/src/pagination/ListViewsPaginator.ts index e9809310d6e7..4b97a6940f6f 100644 --- a/clients/client-connect/src/pagination/ListViewsPaginator.ts +++ b/clients/client-connect/src/pagination/ListViewsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListViewsCommand, ListViewsCommandInput, ListViewsCommandOutput } from "../commands/ListViewsCommand"; import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: ListViewsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListViewsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListViews( +export const paginateListViews: ( config: ConnectPaginationConfiguration, input: ListViewsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListViewsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + ListViewsCommandInput, + ListViewsCommandOutput +>(ConnectClient, ListViewsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/SearchAvailablePhoneNumbersPaginator.ts b/clients/client-connect/src/pagination/SearchAvailablePhoneNumbersPaginator.ts index e7483c06b9ea..600e1e66ce9b 100644 --- a/clients/client-connect/src/pagination/SearchAvailablePhoneNumbersPaginator.ts +++ b/clients/client-connect/src/pagination/SearchAvailablePhoneNumbersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: SearchAvailablePhoneNumbersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchAvailablePhoneNumbersCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchAvailablePhoneNumbers( +export const paginateSearchAvailablePhoneNumbers: ( config: ConnectPaginationConfiguration, input: SearchAvailablePhoneNumbersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchAvailablePhoneNumbersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + SearchAvailablePhoneNumbersCommandInput, + SearchAvailablePhoneNumbersCommandOutput +>(ConnectClient, SearchAvailablePhoneNumbersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/SearchHoursOfOperationsPaginator.ts b/clients/client-connect/src/pagination/SearchHoursOfOperationsPaginator.ts index 3b8c83caf267..38b07466b752 100644 --- a/clients/client-connect/src/pagination/SearchHoursOfOperationsPaginator.ts +++ b/clients/client-connect/src/pagination/SearchHoursOfOperationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: SearchHoursOfOperationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchHoursOfOperationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchHoursOfOperations( +export const paginateSearchHoursOfOperations: ( config: ConnectPaginationConfiguration, input: SearchHoursOfOperationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchHoursOfOperationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + SearchHoursOfOperationsCommandInput, + SearchHoursOfOperationsCommandOutput +>(ConnectClient, SearchHoursOfOperationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/SearchPromptsPaginator.ts b/clients/client-connect/src/pagination/SearchPromptsPaginator.ts index 56ba55381502..8d00f1c79e00 100644 --- a/clients/client-connect/src/pagination/SearchPromptsPaginator.ts +++ b/clients/client-connect/src/pagination/SearchPromptsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: SearchPromptsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchPromptsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchPrompts( +export const paginateSearchPrompts: ( config: ConnectPaginationConfiguration, input: SearchPromptsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchPromptsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + SearchPromptsCommandInput, + SearchPromptsCommandOutput +>(ConnectClient, SearchPromptsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/SearchQueuesPaginator.ts b/clients/client-connect/src/pagination/SearchQueuesPaginator.ts index d741ae894540..804499929c3a 100644 --- a/clients/client-connect/src/pagination/SearchQueuesPaginator.ts +++ b/clients/client-connect/src/pagination/SearchQueuesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: SearchQueuesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchQueuesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchQueues( +export const paginateSearchQueues: ( config: ConnectPaginationConfiguration, input: SearchQueuesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchQueuesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + SearchQueuesCommandInput, + SearchQueuesCommandOutput +>(ConnectClient, SearchQueuesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/SearchQuickConnectsPaginator.ts b/clients/client-connect/src/pagination/SearchQuickConnectsPaginator.ts index 29b57de5d8c2..12611bf21358 100644 --- a/clients/client-connect/src/pagination/SearchQuickConnectsPaginator.ts +++ b/clients/client-connect/src/pagination/SearchQuickConnectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: SearchQuickConnectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchQuickConnectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchQuickConnects( +export const paginateSearchQuickConnects: ( config: ConnectPaginationConfiguration, input: SearchQuickConnectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchQuickConnectsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + SearchQuickConnectsCommandInput, + SearchQuickConnectsCommandOutput +>(ConnectClient, SearchQuickConnectsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/SearchResourceTagsPaginator.ts b/clients/client-connect/src/pagination/SearchResourceTagsPaginator.ts index 24998f0c5f13..3671a0cd3987 100644 --- a/clients/client-connect/src/pagination/SearchResourceTagsPaginator.ts +++ b/clients/client-connect/src/pagination/SearchResourceTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: SearchResourceTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchResourceTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchResourceTags( +export const paginateSearchResourceTags: ( config: ConnectPaginationConfiguration, input: SearchResourceTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchResourceTagsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + SearchResourceTagsCommandInput, + SearchResourceTagsCommandOutput +>(ConnectClient, SearchResourceTagsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/SearchRoutingProfilesPaginator.ts b/clients/client-connect/src/pagination/SearchRoutingProfilesPaginator.ts index 0360881be717..a115d39c10e0 100644 --- a/clients/client-connect/src/pagination/SearchRoutingProfilesPaginator.ts +++ b/clients/client-connect/src/pagination/SearchRoutingProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: SearchRoutingProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchRoutingProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchRoutingProfiles( +export const paginateSearchRoutingProfiles: ( config: ConnectPaginationConfiguration, input: SearchRoutingProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchRoutingProfilesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + SearchRoutingProfilesCommandInput, + SearchRoutingProfilesCommandOutput +>(ConnectClient, SearchRoutingProfilesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/SearchSecurityProfilesPaginator.ts b/clients/client-connect/src/pagination/SearchSecurityProfilesPaginator.ts index 05eea5fbee72..6a28440aa2d3 100644 --- a/clients/client-connect/src/pagination/SearchSecurityProfilesPaginator.ts +++ b/clients/client-connect/src/pagination/SearchSecurityProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: SearchSecurityProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchSecurityProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchSecurityProfiles( +export const paginateSearchSecurityProfiles: ( config: ConnectPaginationConfiguration, input: SearchSecurityProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchSecurityProfilesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + SearchSecurityProfilesCommandInput, + SearchSecurityProfilesCommandOutput +>(ConnectClient, SearchSecurityProfilesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/SearchUsersPaginator.ts b/clients/client-connect/src/pagination/SearchUsersPaginator.ts index 119c4d9167e6..cec81d8df4a4 100644 --- a/clients/client-connect/src/pagination/SearchUsersPaginator.ts +++ b/clients/client-connect/src/pagination/SearchUsersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { SearchUsersCommand, SearchUsersCommandInput, SearchUsersCommandOutput } from "../commands/SearchUsersCommand"; import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: SearchUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchUsers( +export const paginateSearchUsers: ( config: ConnectPaginationConfiguration, input: SearchUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchUsersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + SearchUsersCommandInput, + SearchUsersCommandOutput +>(ConnectClient, SearchUsersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connect/src/pagination/SearchVocabulariesPaginator.ts b/clients/client-connect/src/pagination/SearchVocabulariesPaginator.ts index e15a05e4674f..c9022792a301 100644 --- a/clients/client-connect/src/pagination/SearchVocabulariesPaginator.ts +++ b/clients/client-connect/src/pagination/SearchVocabulariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectClient } from "../ConnectClient"; import { ConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectClient, - input: SearchVocabulariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchVocabulariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchVocabularies( +export const paginateSearchVocabularies: ( config: ConnectPaginationConfiguration, input: SearchVocabulariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchVocabulariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Connect | ConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectPaginationConfiguration, + SearchVocabulariesCommandInput, + SearchVocabulariesCommandOutput +>(ConnectClient, SearchVocabulariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-connectcampaigns/src/pagination/ListCampaignsPaginator.ts b/clients/client-connectcampaigns/src/pagination/ListCampaignsPaginator.ts index cd541bb7cfb8..cf00dbcc3bae 100644 --- a/clients/client-connectcampaigns/src/pagination/ListCampaignsPaginator.ts +++ b/clients/client-connectcampaigns/src/pagination/ListCampaignsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectCampaignsClient } from "../ConnectCampaignsClient"; import { ConnectCampaignsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectCampaignsClient, - input: ListCampaignsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCampaignsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCampaigns( +export const paginateListCampaigns: ( config: ConnectCampaignsPaginationConfiguration, input: ListCampaignsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCampaignsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ConnectCampaignsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConnectCampaigns | ConnectCampaignsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectCampaignsPaginationConfiguration, + ListCampaignsCommandInput, + ListCampaignsCommandOutput +>(ConnectCampaignsClient, ListCampaignsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-connectcases/src/pagination/GetCasePaginator.ts b/clients/client-connectcases/src/pagination/GetCasePaginator.ts index 697e5509d68a..78cda203d055 100644 --- a/clients/client-connectcases/src/pagination/GetCasePaginator.ts +++ b/clients/client-connectcases/src/pagination/GetCasePaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetCaseCommand, GetCaseCommandInput, GetCaseCommandOutput } from "../commands/GetCaseCommand"; import { ConnectCasesClient } from "../ConnectCasesClient"; import { ConnectCasesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectCasesClient, - input: GetCaseCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCaseCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCase( +export const paginateGetCase: ( config: ConnectCasesPaginationConfiguration, input: GetCaseCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCaseCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof ConnectCasesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConnectCases | ConnectCasesClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectCasesPaginationConfiguration, + GetCaseCommandInput, + GetCaseCommandOutput +>(ConnectCasesClient, GetCaseCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-connectcases/src/pagination/ListCasesForContactPaginator.ts b/clients/client-connectcases/src/pagination/ListCasesForContactPaginator.ts index b059a5d785a6..a7fcf056fb8b 100644 --- a/clients/client-connectcases/src/pagination/ListCasesForContactPaginator.ts +++ b/clients/client-connectcases/src/pagination/ListCasesForContactPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectCasesClient } from "../ConnectCasesClient"; import { ConnectCasesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectCasesClient, - input: ListCasesForContactCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCasesForContactCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCasesForContact( +export const paginateListCasesForContact: ( config: ConnectCasesPaginationConfiguration, input: ListCasesForContactCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCasesForContactCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ConnectCasesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConnectCases | ConnectCasesClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectCasesPaginationConfiguration, + ListCasesForContactCommandInput, + ListCasesForContactCommandOutput +>(ConnectCasesClient, ListCasesForContactCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-connectcases/src/pagination/ListDomainsPaginator.ts b/clients/client-connectcases/src/pagination/ListDomainsPaginator.ts index 79e64fdaa1b4..b80c31f43e5c 100644 --- a/clients/client-connectcases/src/pagination/ListDomainsPaginator.ts +++ b/clients/client-connectcases/src/pagination/ListDomainsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListDomainsCommand, ListDomainsCommandInput, ListDomainsCommandOutput } from "../commands/ListDomainsCommand"; import { ConnectCasesClient } from "../ConnectCasesClient"; import { ConnectCasesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectCasesClient, - input: ListDomainsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomains( +export const paginateListDomains: ( config: ConnectCasesPaginationConfiguration, input: ListDomainsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ConnectCasesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConnectCases | ConnectCasesClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectCasesPaginationConfiguration, + ListDomainsCommandInput, + ListDomainsCommandOutput +>(ConnectCasesClient, ListDomainsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-connectcases/src/pagination/ListFieldOptionsPaginator.ts b/clients/client-connectcases/src/pagination/ListFieldOptionsPaginator.ts index 0aca5326b894..5fe571315976 100644 --- a/clients/client-connectcases/src/pagination/ListFieldOptionsPaginator.ts +++ b/clients/client-connectcases/src/pagination/ListFieldOptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectCasesClient } from "../ConnectCasesClient"; import { ConnectCasesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectCasesClient, - input: ListFieldOptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFieldOptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFieldOptions( +export const paginateListFieldOptions: ( config: ConnectCasesPaginationConfiguration, input: ListFieldOptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFieldOptionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ConnectCasesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConnectCases | ConnectCasesClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectCasesPaginationConfiguration, + ListFieldOptionsCommandInput, + ListFieldOptionsCommandOutput +>(ConnectCasesClient, ListFieldOptionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-connectcases/src/pagination/ListFieldsPaginator.ts b/clients/client-connectcases/src/pagination/ListFieldsPaginator.ts index 1da105239aab..1930eb7c202a 100644 --- a/clients/client-connectcases/src/pagination/ListFieldsPaginator.ts +++ b/clients/client-connectcases/src/pagination/ListFieldsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListFieldsCommand, ListFieldsCommandInput, ListFieldsCommandOutput } from "../commands/ListFieldsCommand"; import { ConnectCasesClient } from "../ConnectCasesClient"; import { ConnectCasesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectCasesClient, - input: ListFieldsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFieldsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFields( +export const paginateListFields: ( config: ConnectCasesPaginationConfiguration, input: ListFieldsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFieldsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ConnectCasesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConnectCases | ConnectCasesClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectCasesPaginationConfiguration, + ListFieldsCommandInput, + ListFieldsCommandOutput +>(ConnectCasesClient, ListFieldsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-connectcases/src/pagination/ListLayoutsPaginator.ts b/clients/client-connectcases/src/pagination/ListLayoutsPaginator.ts index dbd19315d783..0ebb07b59a88 100644 --- a/clients/client-connectcases/src/pagination/ListLayoutsPaginator.ts +++ b/clients/client-connectcases/src/pagination/ListLayoutsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListLayoutsCommand, ListLayoutsCommandInput, ListLayoutsCommandOutput } from "../commands/ListLayoutsCommand"; import { ConnectCasesClient } from "../ConnectCasesClient"; import { ConnectCasesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectCasesClient, - input: ListLayoutsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLayoutsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLayouts( +export const paginateListLayouts: ( config: ConnectCasesPaginationConfiguration, input: ListLayoutsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLayoutsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ConnectCasesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConnectCases | ConnectCasesClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectCasesPaginationConfiguration, + ListLayoutsCommandInput, + ListLayoutsCommandOutput +>(ConnectCasesClient, ListLayoutsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-connectcases/src/pagination/ListTemplatesPaginator.ts b/clients/client-connectcases/src/pagination/ListTemplatesPaginator.ts index 17752b307854..35c6a36b5d9a 100644 --- a/clients/client-connectcases/src/pagination/ListTemplatesPaginator.ts +++ b/clients/client-connectcases/src/pagination/ListTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectCasesClient } from "../ConnectCasesClient"; import { ConnectCasesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectCasesClient, - input: ListTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTemplates( +export const paginateListTemplates: ( config: ConnectCasesPaginationConfiguration, input: ListTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ConnectCasesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConnectCases | ConnectCasesClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectCasesPaginationConfiguration, + ListTemplatesCommandInput, + ListTemplatesCommandOutput +>(ConnectCasesClient, ListTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-connectcases/src/pagination/SearchCasesPaginator.ts b/clients/client-connectcases/src/pagination/SearchCasesPaginator.ts index 66607ac6fb1b..4f3ae0eeebf5 100644 --- a/clients/client-connectcases/src/pagination/SearchCasesPaginator.ts +++ b/clients/client-connectcases/src/pagination/SearchCasesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { SearchCasesCommand, SearchCasesCommandInput, SearchCasesCommandOutput } from "../commands/SearchCasesCommand"; import { ConnectCasesClient } from "../ConnectCasesClient"; import { ConnectCasesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectCasesClient, - input: SearchCasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchCasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchCases( +export const paginateSearchCases: ( config: ConnectCasesPaginationConfiguration, input: SearchCasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchCasesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ConnectCasesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConnectCases | ConnectCasesClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectCasesPaginationConfiguration, + SearchCasesCommandInput, + SearchCasesCommandOutput +>(ConnectCasesClient, SearchCasesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-connectcases/src/pagination/SearchRelatedItemsPaginator.ts b/clients/client-connectcases/src/pagination/SearchRelatedItemsPaginator.ts index af55b9f0443b..6a8a02553def 100644 --- a/clients/client-connectcases/src/pagination/SearchRelatedItemsPaginator.ts +++ b/clients/client-connectcases/src/pagination/SearchRelatedItemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectCasesClient } from "../ConnectCasesClient"; import { ConnectCasesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectCasesClient, - input: SearchRelatedItemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchRelatedItemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchRelatedItems( +export const paginateSearchRelatedItems: ( config: ConnectCasesPaginationConfiguration, input: SearchRelatedItemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchRelatedItemsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ConnectCasesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConnectCases | ConnectCasesClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectCasesPaginationConfiguration, + SearchRelatedItemsCommandInput, + SearchRelatedItemsCommandOutput +>(ConnectCasesClient, SearchRelatedItemsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-connectparticipant/src/pagination/GetTranscriptPaginator.ts b/clients/client-connectparticipant/src/pagination/GetTranscriptPaginator.ts index 3d3b0050847d..ec7e9ed7b984 100644 --- a/clients/client-connectparticipant/src/pagination/GetTranscriptPaginator.ts +++ b/clients/client-connectparticipant/src/pagination/GetTranscriptPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ConnectParticipantClient } from "../ConnectParticipantClient"; import { ConnectParticipantPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ConnectParticipantClient, - input: GetTranscriptCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTranscriptCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTranscript( +export const paginateGetTranscript: ( config: ConnectParticipantPaginationConfiguration, input: GetTranscriptCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTranscriptCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ConnectParticipantClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ConnectParticipant | ConnectParticipantClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ConnectParticipantPaginationConfiguration, + GetTranscriptCommandInput, + GetTranscriptCommandOutput +>(ConnectParticipantClient, GetTranscriptCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-controltower/src/pagination/ListEnabledControlsPaginator.ts b/clients/client-controltower/src/pagination/ListEnabledControlsPaginator.ts index 638159f4e289..b39beab2c158 100644 --- a/clients/client-controltower/src/pagination/ListEnabledControlsPaginator.ts +++ b/clients/client-controltower/src/pagination/ListEnabledControlsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ControlTowerClient } from "../ControlTowerClient"; import { ControlTowerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ControlTowerClient, - input: ListEnabledControlsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnabledControlsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnabledControls( +export const paginateListEnabledControls: ( config: ControlTowerPaginationConfiguration, input: ListEnabledControlsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnabledControlsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ControlTowerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ControlTower | ControlTowerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ControlTowerPaginationConfiguration, + ListEnabledControlsCommandInput, + ListEnabledControlsCommandOutput +>(ControlTowerClient, ListEnabledControlsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-controltower/src/pagination/ListLandingZonesPaginator.ts b/clients/client-controltower/src/pagination/ListLandingZonesPaginator.ts index 33db77c2c29d..56235dff1e77 100644 --- a/clients/client-controltower/src/pagination/ListLandingZonesPaginator.ts +++ b/clients/client-controltower/src/pagination/ListLandingZonesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ControlTowerClient } from "../ControlTowerClient"; import { ControlTowerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ControlTowerClient, - input: ListLandingZonesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLandingZonesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLandingZones( +export const paginateListLandingZones: ( config: ControlTowerPaginationConfiguration, input: ListLandingZonesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLandingZonesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ControlTowerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ControlTower | ControlTowerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ControlTowerPaginationConfiguration, + ListLandingZonesCommandInput, + ListLandingZonesCommandOutput +>(ControlTowerClient, ListLandingZonesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cost-and-usage-report-service/package.json b/clients/client-cost-and-usage-report-service/package.json index 6e42b2dd6785..a2aea04f2d04 100644 --- a/clients/client-cost-and-usage-report-service/package.json +++ b/clients/client-cost-and-usage-report-service/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-cost-and-usage-report-service/src/pagination/DescribeReportDefinitionsPaginator.ts b/clients/client-cost-and-usage-report-service/src/pagination/DescribeReportDefinitionsPaginator.ts index f0638af48918..377d350b7adc 100644 --- a/clients/client-cost-and-usage-report-service/src/pagination/DescribeReportDefinitionsPaginator.ts +++ b/clients/client-cost-and-usage-report-service/src/pagination/DescribeReportDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { CostAndUsageReportServiceClient } from "../CostAndUsageReportServiceClient"; import { CostAndUsageReportServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CostAndUsageReportServiceClient, - input: DescribeReportDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReportDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReportDefinitions( +export const paginateDescribeReportDefinitions: ( config: CostAndUsageReportServicePaginationConfiguration, input: DescribeReportDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReportDefinitionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CostAndUsageReportServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CostAndUsageReportService | CostAndUsageReportServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CostAndUsageReportServicePaginationConfiguration, + DescribeReportDefinitionsCommandInput, + DescribeReportDefinitionsCommandOutput +>(CostAndUsageReportServiceClient, DescribeReportDefinitionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cost-explorer/package.json b/clients/client-cost-explorer/package.json index 8cf1b9937db8..2a9b0864f7ad 100644 --- a/clients/client-cost-explorer/package.json +++ b/clients/client-cost-explorer/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-cost-explorer/src/pagination/GetSavingsPlansCoveragePaginator.ts b/clients/client-cost-explorer/src/pagination/GetSavingsPlansCoveragePaginator.ts index 85d649f7ec8e..b2853e3bfb1f 100644 --- a/clients/client-cost-explorer/src/pagination/GetSavingsPlansCoveragePaginator.ts +++ b/clients/client-cost-explorer/src/pagination/GetSavingsPlansCoveragePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { CostExplorerClient } from "../CostExplorerClient"; import { CostExplorerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CostExplorerClient, - input: GetSavingsPlansCoverageCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetSavingsPlansCoverageCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetSavingsPlansCoverage( +export const paginateGetSavingsPlansCoverage: ( config: CostExplorerPaginationConfiguration, input: GetSavingsPlansCoverageCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetSavingsPlansCoverageCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CostExplorerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CostExplorer | CostExplorerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CostExplorerPaginationConfiguration, + GetSavingsPlansCoverageCommandInput, + GetSavingsPlansCoverageCommandOutput +>(CostExplorerClient, GetSavingsPlansCoverageCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cost-explorer/src/pagination/GetSavingsPlansUtilizationDetailsPaginator.ts b/clients/client-cost-explorer/src/pagination/GetSavingsPlansUtilizationDetailsPaginator.ts index d46ab892b3e8..e7ff5e3eeebb 100644 --- a/clients/client-cost-explorer/src/pagination/GetSavingsPlansUtilizationDetailsPaginator.ts +++ b/clients/client-cost-explorer/src/pagination/GetSavingsPlansUtilizationDetailsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { CostExplorerClient } from "../CostExplorerClient"; import { CostExplorerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CostExplorerClient, - input: GetSavingsPlansUtilizationDetailsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetSavingsPlansUtilizationDetailsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetSavingsPlansUtilizationDetails( +export const paginateGetSavingsPlansUtilizationDetails: ( config: CostExplorerPaginationConfiguration, input: GetSavingsPlansUtilizationDetailsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetSavingsPlansUtilizationDetailsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CostExplorerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CostExplorer | CostExplorerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CostExplorerPaginationConfiguration, + GetSavingsPlansUtilizationDetailsCommandInput, + GetSavingsPlansUtilizationDetailsCommandOutput +>(CostExplorerClient, GetSavingsPlansUtilizationDetailsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cost-explorer/src/pagination/ListCostAllocationTagsPaginator.ts b/clients/client-cost-explorer/src/pagination/ListCostAllocationTagsPaginator.ts index 2f634880a9d2..4ab6e7e014b5 100644 --- a/clients/client-cost-explorer/src/pagination/ListCostAllocationTagsPaginator.ts +++ b/clients/client-cost-explorer/src/pagination/ListCostAllocationTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { CostExplorerClient } from "../CostExplorerClient"; import { CostExplorerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CostExplorerClient, - input: ListCostAllocationTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCostAllocationTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCostAllocationTags( +export const paginateListCostAllocationTags: ( config: CostExplorerPaginationConfiguration, input: ListCostAllocationTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCostAllocationTagsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CostExplorerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CostExplorer | CostExplorerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CostExplorerPaginationConfiguration, + ListCostAllocationTagsCommandInput, + ListCostAllocationTagsCommandOutput +>(CostExplorerClient, ListCostAllocationTagsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cost-explorer/src/pagination/ListCostCategoryDefinitionsPaginator.ts b/clients/client-cost-explorer/src/pagination/ListCostCategoryDefinitionsPaginator.ts index 92700e911648..a528c93e8143 100644 --- a/clients/client-cost-explorer/src/pagination/ListCostCategoryDefinitionsPaginator.ts +++ b/clients/client-cost-explorer/src/pagination/ListCostCategoryDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { CostExplorerClient } from "../CostExplorerClient"; import { CostExplorerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CostExplorerClient, - input: ListCostCategoryDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCostCategoryDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCostCategoryDefinitions( +export const paginateListCostCategoryDefinitions: ( config: CostExplorerPaginationConfiguration, input: ListCostCategoryDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCostCategoryDefinitionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CostExplorerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CostExplorer | CostExplorerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CostExplorerPaginationConfiguration, + ListCostCategoryDefinitionsCommandInput, + ListCostCategoryDefinitionsCommandOutput +>(CostExplorerClient, ListCostCategoryDefinitionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-cost-optimization-hub/package.json b/clients/client-cost-optimization-hub/package.json index 922f96289d1e..d2456d4904a1 100644 --- a/clients/client-cost-optimization-hub/package.json +++ b/clients/client-cost-optimization-hub/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-cost-optimization-hub/src/pagination/ListEnrollmentStatusesPaginator.ts b/clients/client-cost-optimization-hub/src/pagination/ListEnrollmentStatusesPaginator.ts index 0d420ca72a8a..288487f2469b 100644 --- a/clients/client-cost-optimization-hub/src/pagination/ListEnrollmentStatusesPaginator.ts +++ b/clients/client-cost-optimization-hub/src/pagination/ListEnrollmentStatusesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { CostOptimizationHubClient } from "../CostOptimizationHubClient"; import { CostOptimizationHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CostOptimizationHubClient, - input: ListEnrollmentStatusesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnrollmentStatusesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnrollmentStatuses( +export const paginateListEnrollmentStatuses: ( config: CostOptimizationHubPaginationConfiguration, input: ListEnrollmentStatusesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnrollmentStatusesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CostOptimizationHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CostOptimizationHub | CostOptimizationHubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CostOptimizationHubPaginationConfiguration, + ListEnrollmentStatusesCommandInput, + ListEnrollmentStatusesCommandOutput +>(CostOptimizationHubClient, ListEnrollmentStatusesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cost-optimization-hub/src/pagination/ListRecommendationSummariesPaginator.ts b/clients/client-cost-optimization-hub/src/pagination/ListRecommendationSummariesPaginator.ts index 0ee079aecfc0..6b8632ea7943 100644 --- a/clients/client-cost-optimization-hub/src/pagination/ListRecommendationSummariesPaginator.ts +++ b/clients/client-cost-optimization-hub/src/pagination/ListRecommendationSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { CostOptimizationHubClient } from "../CostOptimizationHubClient"; import { CostOptimizationHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CostOptimizationHubClient, - input: ListRecommendationSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecommendationSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecommendationSummaries( +export const paginateListRecommendationSummaries: ( config: CostOptimizationHubPaginationConfiguration, input: ListRecommendationSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecommendationSummariesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CostOptimizationHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CostOptimizationHub | CostOptimizationHubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CostOptimizationHubPaginationConfiguration, + ListRecommendationSummariesCommandInput, + ListRecommendationSummariesCommandOutput +>(CostOptimizationHubClient, ListRecommendationSummariesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-cost-optimization-hub/src/pagination/ListRecommendationsPaginator.ts b/clients/client-cost-optimization-hub/src/pagination/ListRecommendationsPaginator.ts index 3c0d7558275b..5582f3d8eab2 100644 --- a/clients/client-cost-optimization-hub/src/pagination/ListRecommendationsPaginator.ts +++ b/clients/client-cost-optimization-hub/src/pagination/ListRecommendationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { CostOptimizationHubClient } from "../CostOptimizationHubClient"; import { CostOptimizationHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CostOptimizationHubClient, - input: ListRecommendationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecommendationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecommendations( +export const paginateListRecommendations: ( config: CostOptimizationHubPaginationConfiguration, input: ListRecommendationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecommendationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof CostOptimizationHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CostOptimizationHub | CostOptimizationHubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CostOptimizationHubPaginationConfiguration, + ListRecommendationsCommandInput, + ListRecommendationsCommandOutput +>(CostOptimizationHubClient, ListRecommendationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-customer-profiles/src/pagination/ListEventStreamsPaginator.ts b/clients/client-customer-profiles/src/pagination/ListEventStreamsPaginator.ts index a6a35b9c580c..8f8811468ed5 100644 --- a/clients/client-customer-profiles/src/pagination/ListEventStreamsPaginator.ts +++ b/clients/client-customer-profiles/src/pagination/ListEventStreamsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { CustomerProfilesClient } from "../CustomerProfilesClient"; import { CustomerProfilesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: CustomerProfilesClient, - input: ListEventStreamsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEventStreamsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEventStreams( +export const paginateListEventStreams: ( config: CustomerProfilesPaginationConfiguration, input: ListEventStreamsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEventStreamsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof CustomerProfilesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected CustomerProfiles | CustomerProfilesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + CustomerProfilesPaginationConfiguration, + ListEventStreamsCommandInput, + ListEventStreamsCommandOutput +>(CustomerProfilesClient, ListEventStreamsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-data-pipeline/package.json b/clients/client-data-pipeline/package.json index 5f01f8fda049..154ff320d7bb 100644 --- a/clients/client-data-pipeline/package.json +++ b/clients/client-data-pipeline/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-data-pipeline/src/pagination/DescribeObjectsPaginator.ts b/clients/client-data-pipeline/src/pagination/DescribeObjectsPaginator.ts index 86c4d090ff75..0c5f8a7d8127 100644 --- a/clients/client-data-pipeline/src/pagination/DescribeObjectsPaginator.ts +++ b/clients/client-data-pipeline/src/pagination/DescribeObjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DataPipelineClient } from "../DataPipelineClient"; import { DataPipelinePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataPipelineClient, - input: DescribeObjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeObjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeObjects( +export const paginateDescribeObjects: ( config: DataPipelinePaginationConfiguration, input: DescribeObjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeObjectsCommandOutput; - while (hasNext) { - input.marker = token; - if (config.client instanceof DataPipelineClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataPipeline | DataPipelineClient"); - } - yield page; - const prevToken = token; - token = page.marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataPipelinePaginationConfiguration, + DescribeObjectsCommandInput, + DescribeObjectsCommandOutput +>(DataPipelineClient, DescribeObjectsCommand, "marker", "marker", ""); diff --git a/clients/client-data-pipeline/src/pagination/ListPipelinesPaginator.ts b/clients/client-data-pipeline/src/pagination/ListPipelinesPaginator.ts index 98c60f8f56fc..df178d47b28c 100644 --- a/clients/client-data-pipeline/src/pagination/ListPipelinesPaginator.ts +++ b/clients/client-data-pipeline/src/pagination/ListPipelinesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DataPipelineClient } from "../DataPipelineClient"; import { DataPipelinePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataPipelineClient, - input: ListPipelinesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPipelinesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPipelines( +export const paginateListPipelines: ( config: DataPipelinePaginationConfiguration, input: ListPipelinesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPipelinesCommandOutput; - while (hasNext) { - input.marker = token; - if (config.client instanceof DataPipelineClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataPipeline | DataPipelineClient"); - } - yield page; - const prevToken = token; - token = page.marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataPipelinePaginationConfiguration, + ListPipelinesCommandInput, + ListPipelinesCommandOutput +>(DataPipelineClient, ListPipelinesCommand, "marker", "marker", ""); diff --git a/clients/client-data-pipeline/src/pagination/QueryObjectsPaginator.ts b/clients/client-data-pipeline/src/pagination/QueryObjectsPaginator.ts index 5e3f8a32de5e..98d8629f5c5f 100644 --- a/clients/client-data-pipeline/src/pagination/QueryObjectsPaginator.ts +++ b/clients/client-data-pipeline/src/pagination/QueryObjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataPipelineClient } from "../DataPipelineClient"; import { DataPipelinePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataPipelineClient, - input: QueryObjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new QueryObjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateQueryObjects( +export const paginateQueryObjects: ( config: DataPipelinePaginationConfiguration, input: QueryObjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: QueryObjectsCommandOutput; - while (hasNext) { - input.marker = token; - input["limit"] = config.pageSize; - if (config.client instanceof DataPipelineClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataPipeline | DataPipelineClient"); - } - yield page; - const prevToken = token; - token = page.marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataPipelinePaginationConfiguration, + QueryObjectsCommandInput, + QueryObjectsCommandOutput +>(DataPipelineClient, QueryObjectsCommand, "marker", "marker", "limit"); diff --git a/clients/client-database-migration-service/package.json b/clients/client-database-migration-service/package.json index c55f9cfd2c59..f6640c2e0174 100644 --- a/clients/client-database-migration-service/package.json +++ b/clients/client-database-migration-service/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-database-migration-service/src/pagination/DescribeApplicableIndividualAssessmentsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeApplicableIndividualAssessmentsPaginator.ts index 10a7ea34f585..730eec9ae093 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeApplicableIndividualAssessmentsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeApplicableIndividualAssessmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeApplicableIndividualAssessmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeApplicableIndividualAssessmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeApplicableIndividualAssessments( +export const paginateDescribeApplicableIndividualAssessments: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeApplicableIndividualAssessmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeApplicableIndividualAssessmentsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeApplicableIndividualAssessmentsCommandInput, + DescribeApplicableIndividualAssessmentsCommandOutput +>(DatabaseMigrationServiceClient, DescribeApplicableIndividualAssessmentsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeCertificatesPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeCertificatesPaginator.ts index 90f20a960c47..b41f75b2ea68 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeCertificatesPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeCertificatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeCertificatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCertificatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCertificates( +export const paginateDescribeCertificates: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeCertificatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCertificatesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeCertificatesCommandInput, + DescribeCertificatesCommandOutput +>(DatabaseMigrationServiceClient, DescribeCertificatesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeConnectionsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeConnectionsPaginator.ts index 699a62d269f4..1131146d33c7 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeConnectionsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeConnections( +export const paginateDescribeConnections: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeConnectionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeConnectionsCommandInput, + DescribeConnectionsCommandOutput +>(DatabaseMigrationServiceClient, DescribeConnectionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeDataProvidersPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeDataProvidersPaginator.ts index af5617e973ff..a24802027f78 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeDataProvidersPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeDataProvidersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeDataProvidersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDataProvidersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDataProviders( +export const paginateDescribeDataProviders: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeDataProvidersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDataProvidersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeDataProvidersCommandInput, + DescribeDataProvidersCommandOutput +>(DatabaseMigrationServiceClient, DescribeDataProvidersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeEndpointSettingsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeEndpointSettingsPaginator.ts index 889e9e1b9968..488cabc16fd1 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeEndpointSettingsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeEndpointSettingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeEndpointSettingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEndpointSettingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEndpointSettings( +export const paginateDescribeEndpointSettings: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeEndpointSettingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEndpointSettingsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeEndpointSettingsCommandInput, + DescribeEndpointSettingsCommandOutput +>(DatabaseMigrationServiceClient, DescribeEndpointSettingsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeEndpointTypesPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeEndpointTypesPaginator.ts index 65d7b800bd98..52dbbb2df216 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeEndpointTypesPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeEndpointTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeEndpointTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEndpointTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEndpointTypes( +export const paginateDescribeEndpointTypes: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeEndpointTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEndpointTypesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeEndpointTypesCommandInput, + DescribeEndpointTypesCommandOutput +>(DatabaseMigrationServiceClient, DescribeEndpointTypesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeEndpointsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeEndpointsPaginator.ts index be4fbc02e603..5f3b347a20fd 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeEndpointsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEndpoints( +export const paginateDescribeEndpoints: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEndpointsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeEndpointsCommandInput, + DescribeEndpointsCommandOutput +>(DatabaseMigrationServiceClient, DescribeEndpointsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeEngineVersionsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeEngineVersionsPaginator.ts index 5a5cd2eb0d0c..ddff4faf5c7d 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeEngineVersionsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeEngineVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeEngineVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEngineVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEngineVersions( +export const paginateDescribeEngineVersions: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeEngineVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEngineVersionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeEngineVersionsCommandInput, + DescribeEngineVersionsCommandOutput +>(DatabaseMigrationServiceClient, DescribeEngineVersionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeEventSubscriptionsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeEventSubscriptionsPaginator.ts index 6d56bcac1df3..9e3104b9c54d 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeEventSubscriptionsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeEventSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeEventSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEventSubscriptions( +export const paginateDescribeEventSubscriptions: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeEventSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventSubscriptionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeEventSubscriptionsCommandInput, + DescribeEventSubscriptionsCommandOutput +>(DatabaseMigrationServiceClient, DescribeEventSubscriptionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeEventsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeEventsPaginator.ts index 3acf55aa4ddd..36b87895f9bd 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeEventsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEvents( +export const paginateDescribeEvents: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeEventsCommandInput, + DescribeEventsCommandOutput +>(DatabaseMigrationServiceClient, DescribeEventsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeExtensionPackAssociationsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeExtensionPackAssociationsPaginator.ts index 6bde9d42956e..6ddae12aca7f 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeExtensionPackAssociationsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeExtensionPackAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeExtensionPackAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeExtensionPackAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeExtensionPackAssociations( +export const paginateDescribeExtensionPackAssociations: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeExtensionPackAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeExtensionPackAssociationsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeExtensionPackAssociationsCommandInput, + DescribeExtensionPackAssociationsCommandOutput +>(DatabaseMigrationServiceClient, DescribeExtensionPackAssociationsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorCollectorsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorCollectorsPaginator.ts index 6d02b98c2eba..83b2a067d244 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorCollectorsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorCollectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeFleetAdvisorCollectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFleetAdvisorCollectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFleetAdvisorCollectors( +export const paginateDescribeFleetAdvisorCollectors: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeFleetAdvisorCollectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFleetAdvisorCollectorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeFleetAdvisorCollectorsCommandInput, + DescribeFleetAdvisorCollectorsCommandOutput +>(DatabaseMigrationServiceClient, DescribeFleetAdvisorCollectorsCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorDatabasesPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorDatabasesPaginator.ts index fe21bd68f527..ce53d8d9d4b7 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorDatabasesPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorDatabasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeFleetAdvisorDatabasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFleetAdvisorDatabasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFleetAdvisorDatabases( +export const paginateDescribeFleetAdvisorDatabases: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeFleetAdvisorDatabasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFleetAdvisorDatabasesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeFleetAdvisorDatabasesCommandInput, + DescribeFleetAdvisorDatabasesCommandOutput +>(DatabaseMigrationServiceClient, DescribeFleetAdvisorDatabasesCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorLsaAnalysisPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorLsaAnalysisPaginator.ts index 168930ad3b47..7c4c2ccf6232 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorLsaAnalysisPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorLsaAnalysisPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeFleetAdvisorLsaAnalysisCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFleetAdvisorLsaAnalysisCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFleetAdvisorLsaAnalysis( +export const paginateDescribeFleetAdvisorLsaAnalysis: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeFleetAdvisorLsaAnalysisCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFleetAdvisorLsaAnalysisCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeFleetAdvisorLsaAnalysisCommandInput, + DescribeFleetAdvisorLsaAnalysisCommandOutput +>(DatabaseMigrationServiceClient, DescribeFleetAdvisorLsaAnalysisCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorSchemaObjectSummaryPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorSchemaObjectSummaryPaginator.ts index fec0c69f9c04..d0c2723e6c99 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorSchemaObjectSummaryPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorSchemaObjectSummaryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,21 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeFleetAdvisorSchemaObjectSummaryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFleetAdvisorSchemaObjectSummaryCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFleetAdvisorSchemaObjectSummary( +export const paginateDescribeFleetAdvisorSchemaObjectSummary: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeFleetAdvisorSchemaObjectSummaryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFleetAdvisorSchemaObjectSummaryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeFleetAdvisorSchemaObjectSummaryCommandInput, + DescribeFleetAdvisorSchemaObjectSummaryCommandOutput +>( + DatabaseMigrationServiceClient, + DescribeFleetAdvisorSchemaObjectSummaryCommand, + "NextToken", + "NextToken", + "MaxRecords" +); diff --git a/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorSchemasPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorSchemasPaginator.ts index 45c42edb8e8b..ea899cd97bd8 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorSchemasPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeFleetAdvisorSchemasPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeFleetAdvisorSchemasCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFleetAdvisorSchemasCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFleetAdvisorSchemas( +export const paginateDescribeFleetAdvisorSchemas: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeFleetAdvisorSchemasCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFleetAdvisorSchemasCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeFleetAdvisorSchemasCommandInput, + DescribeFleetAdvisorSchemasCommandOutput +>(DatabaseMigrationServiceClient, DescribeFleetAdvisorSchemasCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeInstanceProfilesPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeInstanceProfilesPaginator.ts index 777e7b994235..78265b46c96d 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeInstanceProfilesPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeInstanceProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeInstanceProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstanceProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstanceProfiles( +export const paginateDescribeInstanceProfiles: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeInstanceProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstanceProfilesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeInstanceProfilesCommandInput, + DescribeInstanceProfilesCommandOutput +>(DatabaseMigrationServiceClient, DescribeInstanceProfilesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeMetadataModelAssessmentsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeMetadataModelAssessmentsPaginator.ts index e6e049dedeb3..37f433c9b03f 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeMetadataModelAssessmentsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeMetadataModelAssessmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeMetadataModelAssessmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMetadataModelAssessmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMetadataModelAssessments( +export const paginateDescribeMetadataModelAssessments: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeMetadataModelAssessmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMetadataModelAssessmentsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeMetadataModelAssessmentsCommandInput, + DescribeMetadataModelAssessmentsCommandOutput +>(DatabaseMigrationServiceClient, DescribeMetadataModelAssessmentsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeMetadataModelConversionsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeMetadataModelConversionsPaginator.ts index ef02d8ee8898..358729166642 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeMetadataModelConversionsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeMetadataModelConversionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeMetadataModelConversionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMetadataModelConversionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMetadataModelConversions( +export const paginateDescribeMetadataModelConversions: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeMetadataModelConversionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMetadataModelConversionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeMetadataModelConversionsCommandInput, + DescribeMetadataModelConversionsCommandOutput +>(DatabaseMigrationServiceClient, DescribeMetadataModelConversionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeMetadataModelExportsAsScriptPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeMetadataModelExportsAsScriptPaginator.ts index 4875982b997e..3f5278ee2eeb 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeMetadataModelExportsAsScriptPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeMetadataModelExportsAsScriptPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeMetadataModelExportsAsScriptCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMetadataModelExportsAsScriptCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMetadataModelExportsAsScript( +export const paginateDescribeMetadataModelExportsAsScript: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeMetadataModelExportsAsScriptCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMetadataModelExportsAsScriptCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeMetadataModelExportsAsScriptCommandInput, + DescribeMetadataModelExportsAsScriptCommandOutput +>(DatabaseMigrationServiceClient, DescribeMetadataModelExportsAsScriptCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeMetadataModelExportsToTargetPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeMetadataModelExportsToTargetPaginator.ts index 9a6bb18f7daa..de31a91336b6 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeMetadataModelExportsToTargetPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeMetadataModelExportsToTargetPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeMetadataModelExportsToTargetCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMetadataModelExportsToTargetCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMetadataModelExportsToTarget( +export const paginateDescribeMetadataModelExportsToTarget: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeMetadataModelExportsToTargetCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMetadataModelExportsToTargetCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeMetadataModelExportsToTargetCommandInput, + DescribeMetadataModelExportsToTargetCommandOutput +>(DatabaseMigrationServiceClient, DescribeMetadataModelExportsToTargetCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeMetadataModelImportsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeMetadataModelImportsPaginator.ts index cf85336a4873..70a84040c21f 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeMetadataModelImportsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeMetadataModelImportsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeMetadataModelImportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMetadataModelImportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMetadataModelImports( +export const paginateDescribeMetadataModelImports: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeMetadataModelImportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMetadataModelImportsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeMetadataModelImportsCommandInput, + DescribeMetadataModelImportsCommandOutput +>(DatabaseMigrationServiceClient, DescribeMetadataModelImportsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeMigrationProjectsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeMigrationProjectsPaginator.ts index 7553597f5d61..929b5b98301b 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeMigrationProjectsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeMigrationProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeMigrationProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMigrationProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMigrationProjects( +export const paginateDescribeMigrationProjects: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeMigrationProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMigrationProjectsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeMigrationProjectsCommandInput, + DescribeMigrationProjectsCommandOutput +>(DatabaseMigrationServiceClient, DescribeMigrationProjectsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeOrderableReplicationInstancesPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeOrderableReplicationInstancesPaginator.ts index ebac6bf0823f..353c263a4091 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeOrderableReplicationInstancesPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeOrderableReplicationInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeOrderableReplicationInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOrderableReplicationInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOrderableReplicationInstances( +export const paginateDescribeOrderableReplicationInstances: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeOrderableReplicationInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOrderableReplicationInstancesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeOrderableReplicationInstancesCommandInput, + DescribeOrderableReplicationInstancesCommandOutput +>(DatabaseMigrationServiceClient, DescribeOrderableReplicationInstancesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribePendingMaintenanceActionsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribePendingMaintenanceActionsPaginator.ts index eaa51249ab83..06144a2fcf73 100644 --- a/clients/client-database-migration-service/src/pagination/DescribePendingMaintenanceActionsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribePendingMaintenanceActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribePendingMaintenanceActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePendingMaintenanceActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePendingMaintenanceActions( +export const paginateDescribePendingMaintenanceActions: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribePendingMaintenanceActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePendingMaintenanceActionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribePendingMaintenanceActionsCommandInput, + DescribePendingMaintenanceActionsCommandOutput +>(DatabaseMigrationServiceClient, DescribePendingMaintenanceActionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeRecommendationLimitationsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeRecommendationLimitationsPaginator.ts index 98ba879a08a3..32699e5da3d5 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeRecommendationLimitationsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeRecommendationLimitationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeRecommendationLimitationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRecommendationLimitationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRecommendationLimitations( +export const paginateDescribeRecommendationLimitations: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeRecommendationLimitationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRecommendationLimitationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeRecommendationLimitationsCommandInput, + DescribeRecommendationLimitationsCommandOutput +>(DatabaseMigrationServiceClient, DescribeRecommendationLimitationsCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeRecommendationsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeRecommendationsPaginator.ts index b56319d26faf..3bb1d216449a 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeRecommendationsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeRecommendationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeRecommendationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRecommendationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRecommendations( +export const paginateDescribeRecommendations: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeRecommendationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRecommendationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeRecommendationsCommandInput, + DescribeRecommendationsCommandOutput +>(DatabaseMigrationServiceClient, DescribeRecommendationsCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeReplicationConfigsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeReplicationConfigsPaginator.ts index e75672095619..0c1d3f5607d7 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeReplicationConfigsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeReplicationConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeReplicationConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplicationConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplicationConfigs( +export const paginateDescribeReplicationConfigs: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeReplicationConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplicationConfigsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeReplicationConfigsCommandInput, + DescribeReplicationConfigsCommandOutput +>(DatabaseMigrationServiceClient, DescribeReplicationConfigsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeReplicationInstanceTaskLogsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeReplicationInstanceTaskLogsPaginator.ts index 0c2957d9e7e6..c598743e90f6 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeReplicationInstanceTaskLogsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeReplicationInstanceTaskLogsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeReplicationInstanceTaskLogsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplicationInstanceTaskLogsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplicationInstanceTaskLogs( +export const paginateDescribeReplicationInstanceTaskLogs: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeReplicationInstanceTaskLogsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplicationInstanceTaskLogsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeReplicationInstanceTaskLogsCommandInput, + DescribeReplicationInstanceTaskLogsCommandOutput +>(DatabaseMigrationServiceClient, DescribeReplicationInstanceTaskLogsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeReplicationInstancesPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeReplicationInstancesPaginator.ts index 3dc4ff5b3cfe..532e7deef16c 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeReplicationInstancesPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeReplicationInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeReplicationInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplicationInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplicationInstances( +export const paginateDescribeReplicationInstances: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeReplicationInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplicationInstancesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeReplicationInstancesCommandInput, + DescribeReplicationInstancesCommandOutput +>(DatabaseMigrationServiceClient, DescribeReplicationInstancesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeReplicationSubnetGroupsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeReplicationSubnetGroupsPaginator.ts index 173f0abacd63..948657908907 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeReplicationSubnetGroupsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeReplicationSubnetGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeReplicationSubnetGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplicationSubnetGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplicationSubnetGroups( +export const paginateDescribeReplicationSubnetGroups: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeReplicationSubnetGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplicationSubnetGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeReplicationSubnetGroupsCommandInput, + DescribeReplicationSubnetGroupsCommandOutput +>(DatabaseMigrationServiceClient, DescribeReplicationSubnetGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeReplicationTableStatisticsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeReplicationTableStatisticsPaginator.ts index e8e2f37a40c3..0628cd5d062f 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeReplicationTableStatisticsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeReplicationTableStatisticsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeReplicationTableStatisticsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplicationTableStatisticsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplicationTableStatistics( +export const paginateDescribeReplicationTableStatistics: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeReplicationTableStatisticsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplicationTableStatisticsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeReplicationTableStatisticsCommandInput, + DescribeReplicationTableStatisticsCommandOutput +>(DatabaseMigrationServiceClient, DescribeReplicationTableStatisticsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeReplicationTaskAssessmentResultsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeReplicationTaskAssessmentResultsPaginator.ts index 97c627e09193..825d4534fb9a 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeReplicationTaskAssessmentResultsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeReplicationTaskAssessmentResultsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeReplicationTaskAssessmentResultsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplicationTaskAssessmentResultsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplicationTaskAssessmentResults( +export const paginateDescribeReplicationTaskAssessmentResults: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeReplicationTaskAssessmentResultsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplicationTaskAssessmentResultsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeReplicationTaskAssessmentResultsCommandInput, + DescribeReplicationTaskAssessmentResultsCommandOutput +>(DatabaseMigrationServiceClient, DescribeReplicationTaskAssessmentResultsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeReplicationTaskAssessmentRunsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeReplicationTaskAssessmentRunsPaginator.ts index 4883998a3a3f..23772c219894 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeReplicationTaskAssessmentRunsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeReplicationTaskAssessmentRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeReplicationTaskAssessmentRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplicationTaskAssessmentRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplicationTaskAssessmentRuns( +export const paginateDescribeReplicationTaskAssessmentRuns: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeReplicationTaskAssessmentRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplicationTaskAssessmentRunsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeReplicationTaskAssessmentRunsCommandInput, + DescribeReplicationTaskAssessmentRunsCommandOutput +>(DatabaseMigrationServiceClient, DescribeReplicationTaskAssessmentRunsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeReplicationTaskIndividualAssessmentsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeReplicationTaskIndividualAssessmentsPaginator.ts index fd1272870200..258dadc60124 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeReplicationTaskIndividualAssessmentsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeReplicationTaskIndividualAssessmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,21 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeReplicationTaskIndividualAssessmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplicationTaskIndividualAssessmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplicationTaskIndividualAssessments( +export const paginateDescribeReplicationTaskIndividualAssessments: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeReplicationTaskIndividualAssessmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplicationTaskIndividualAssessmentsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeReplicationTaskIndividualAssessmentsCommandInput, + DescribeReplicationTaskIndividualAssessmentsCommandOutput +>( + DatabaseMigrationServiceClient, + DescribeReplicationTaskIndividualAssessmentsCommand, + "Marker", + "Marker", + "MaxRecords" +); diff --git a/clients/client-database-migration-service/src/pagination/DescribeReplicationTasksPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeReplicationTasksPaginator.ts index 90206bcad908..91d76870c86e 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeReplicationTasksPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeReplicationTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeReplicationTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplicationTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplicationTasks( +export const paginateDescribeReplicationTasks: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeReplicationTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplicationTasksCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeReplicationTasksCommandInput, + DescribeReplicationTasksCommandOutput +>(DatabaseMigrationServiceClient, DescribeReplicationTasksCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeReplicationsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeReplicationsPaginator.ts index 7e6b8693e0f6..7215faeec72d 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeReplicationsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeReplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeReplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplications( +export const paginateDescribeReplications: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeReplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplicationsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeReplicationsCommandInput, + DescribeReplicationsCommandOutput +>(DatabaseMigrationServiceClient, DescribeReplicationsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeSchemasPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeSchemasPaginator.ts index 44f39a8b9f05..29356eb8e09f 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeSchemasPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeSchemasPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeSchemasCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSchemasCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSchemas( +export const paginateDescribeSchemas: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeSchemasCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSchemasCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeSchemasCommandInput, + DescribeSchemasCommandOutput +>(DatabaseMigrationServiceClient, DescribeSchemasCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-database-migration-service/src/pagination/DescribeTableStatisticsPaginator.ts b/clients/client-database-migration-service/src/pagination/DescribeTableStatisticsPaginator.ts index 5d7465a365ed..03c03d73dd7a 100644 --- a/clients/client-database-migration-service/src/pagination/DescribeTableStatisticsPaginator.ts +++ b/clients/client-database-migration-service/src/pagination/DescribeTableStatisticsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DatabaseMigrationServiceClient } from "../DatabaseMigrationServiceClient"; import { DatabaseMigrationServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DatabaseMigrationServiceClient, - input: DescribeTableStatisticsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTableStatisticsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTableStatistics( +export const paginateDescribeTableStatistics: ( config: DatabaseMigrationServicePaginationConfiguration, input: DescribeTableStatisticsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTableStatisticsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DatabaseMigrationServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DatabaseMigrationService | DatabaseMigrationServiceClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DatabaseMigrationServicePaginationConfiguration, + DescribeTableStatisticsCommandInput, + DescribeTableStatisticsCommandOutput +>(DatabaseMigrationServiceClient, DescribeTableStatisticsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-databrew/src/pagination/ListDatasetsPaginator.ts b/clients/client-databrew/src/pagination/ListDatasetsPaginator.ts index f8e4b92eb491..8316c68c1eea 100644 --- a/clients/client-databrew/src/pagination/ListDatasetsPaginator.ts +++ b/clients/client-databrew/src/pagination/ListDatasetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataBrewClient } from "../DataBrewClient"; import { DataBrewPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataBrewClient, - input: ListDatasetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasets( +export const paginateListDatasets: ( config: DataBrewPaginationConfiguration, input: ListDatasetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataBrewClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataBrew | DataBrewClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataBrewPaginationConfiguration, + ListDatasetsCommandInput, + ListDatasetsCommandOutput +>(DataBrewClient, ListDatasetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-databrew/src/pagination/ListJobRunsPaginator.ts b/clients/client-databrew/src/pagination/ListJobRunsPaginator.ts index e5bae45c99f8..a7bca39b56ad 100644 --- a/clients/client-databrew/src/pagination/ListJobRunsPaginator.ts +++ b/clients/client-databrew/src/pagination/ListJobRunsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListJobRunsCommand, ListJobRunsCommandInput, ListJobRunsCommandOutput } from "../commands/ListJobRunsCommand"; import { DataBrewClient } from "../DataBrewClient"; import { DataBrewPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataBrewClient, - input: ListJobRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobRuns( +export const paginateListJobRuns: ( config: DataBrewPaginationConfiguration, input: ListJobRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobRunsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataBrewClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataBrew | DataBrewClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataBrewPaginationConfiguration, + ListJobRunsCommandInput, + ListJobRunsCommandOutput +>(DataBrewClient, ListJobRunsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-databrew/src/pagination/ListJobsPaginator.ts b/clients/client-databrew/src/pagination/ListJobsPaginator.ts index 7608600f3dd2..199517baec29 100644 --- a/clients/client-databrew/src/pagination/ListJobsPaginator.ts +++ b/clients/client-databrew/src/pagination/ListJobsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListJobsCommand, ListJobsCommandInput, ListJobsCommandOutput } from "../commands/ListJobsCommand"; import { DataBrewClient } from "../DataBrewClient"; import { DataBrewPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataBrewClient, - input: ListJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobs( +export const paginateListJobs: ( config: DataBrewPaginationConfiguration, input: ListJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataBrewClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataBrew | DataBrewClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataBrewPaginationConfiguration, + ListJobsCommandInput, + ListJobsCommandOutput +>(DataBrewClient, ListJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-databrew/src/pagination/ListProjectsPaginator.ts b/clients/client-databrew/src/pagination/ListProjectsPaginator.ts index a0c0ac2d775a..78c9ece56e05 100644 --- a/clients/client-databrew/src/pagination/ListProjectsPaginator.ts +++ b/clients/client-databrew/src/pagination/ListProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataBrewClient } from "../DataBrewClient"; import { DataBrewPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataBrewClient, - input: ListProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProjects( +export const paginateListProjects: ( config: DataBrewPaginationConfiguration, input: ListProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProjectsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataBrewClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataBrew | DataBrewClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataBrewPaginationConfiguration, + ListProjectsCommandInput, + ListProjectsCommandOutput +>(DataBrewClient, ListProjectsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-databrew/src/pagination/ListRecipeVersionsPaginator.ts b/clients/client-databrew/src/pagination/ListRecipeVersionsPaginator.ts index 9990ca18f70b..94903b50a2de 100644 --- a/clients/client-databrew/src/pagination/ListRecipeVersionsPaginator.ts +++ b/clients/client-databrew/src/pagination/ListRecipeVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataBrewClient } from "../DataBrewClient"; import { DataBrewPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataBrewClient, - input: ListRecipeVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecipeVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecipeVersions( +export const paginateListRecipeVersions: ( config: DataBrewPaginationConfiguration, input: ListRecipeVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecipeVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataBrewClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataBrew | DataBrewClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataBrewPaginationConfiguration, + ListRecipeVersionsCommandInput, + ListRecipeVersionsCommandOutput +>(DataBrewClient, ListRecipeVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-databrew/src/pagination/ListRecipesPaginator.ts b/clients/client-databrew/src/pagination/ListRecipesPaginator.ts index 2d724a994965..eab5614d9722 100644 --- a/clients/client-databrew/src/pagination/ListRecipesPaginator.ts +++ b/clients/client-databrew/src/pagination/ListRecipesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListRecipesCommand, ListRecipesCommandInput, ListRecipesCommandOutput } from "../commands/ListRecipesCommand"; import { DataBrewClient } from "../DataBrewClient"; import { DataBrewPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataBrewClient, - input: ListRecipesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecipesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecipes( +export const paginateListRecipes: ( config: DataBrewPaginationConfiguration, input: ListRecipesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecipesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataBrewClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataBrew | DataBrewClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataBrewPaginationConfiguration, + ListRecipesCommandInput, + ListRecipesCommandOutput +>(DataBrewClient, ListRecipesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-databrew/src/pagination/ListRulesetsPaginator.ts b/clients/client-databrew/src/pagination/ListRulesetsPaginator.ts index fc758ec1e1cd..5469e7a9de79 100644 --- a/clients/client-databrew/src/pagination/ListRulesetsPaginator.ts +++ b/clients/client-databrew/src/pagination/ListRulesetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataBrewClient } from "../DataBrewClient"; import { DataBrewPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataBrewClient, - input: ListRulesetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRulesetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRulesets( +export const paginateListRulesets: ( config: DataBrewPaginationConfiguration, input: ListRulesetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRulesetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataBrewClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataBrew | DataBrewClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataBrewPaginationConfiguration, + ListRulesetsCommandInput, + ListRulesetsCommandOutput +>(DataBrewClient, ListRulesetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-databrew/src/pagination/ListSchedulesPaginator.ts b/clients/client-databrew/src/pagination/ListSchedulesPaginator.ts index 35a74604131b..c52689a0a4e1 100644 --- a/clients/client-databrew/src/pagination/ListSchedulesPaginator.ts +++ b/clients/client-databrew/src/pagination/ListSchedulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataBrewClient } from "../DataBrewClient"; import { DataBrewPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataBrewClient, - input: ListSchedulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSchedulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSchedules( +export const paginateListSchedules: ( config: DataBrewPaginationConfiguration, input: ListSchedulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSchedulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataBrewClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataBrew | DataBrewClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataBrewPaginationConfiguration, + ListSchedulesCommandInput, + ListSchedulesCommandOutput +>(DataBrewClient, ListSchedulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-dataexchange/src/pagination/ListDataSetRevisionsPaginator.ts b/clients/client-dataexchange/src/pagination/ListDataSetRevisionsPaginator.ts index 8ac539348c67..100f1d7c562d 100644 --- a/clients/client-dataexchange/src/pagination/ListDataSetRevisionsPaginator.ts +++ b/clients/client-dataexchange/src/pagination/ListDataSetRevisionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataExchangeClient } from "../DataExchangeClient"; import { DataExchangePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataExchangeClient, - input: ListDataSetRevisionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataSetRevisionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataSetRevisions( +export const paginateListDataSetRevisions: ( config: DataExchangePaginationConfiguration, input: ListDataSetRevisionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataSetRevisionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataExchangeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataExchange | DataExchangeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataExchangePaginationConfiguration, + ListDataSetRevisionsCommandInput, + ListDataSetRevisionsCommandOutput +>(DataExchangeClient, ListDataSetRevisionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-dataexchange/src/pagination/ListDataSetsPaginator.ts b/clients/client-dataexchange/src/pagination/ListDataSetsPaginator.ts index 18ee53973b62..f1a9333771e1 100644 --- a/clients/client-dataexchange/src/pagination/ListDataSetsPaginator.ts +++ b/clients/client-dataexchange/src/pagination/ListDataSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataExchangeClient } from "../DataExchangeClient"; import { DataExchangePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataExchangeClient, - input: ListDataSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataSets( +export const paginateListDataSets: ( config: DataExchangePaginationConfiguration, input: ListDataSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataExchangeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataExchange | DataExchangeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataExchangePaginationConfiguration, + ListDataSetsCommandInput, + ListDataSetsCommandOutput +>(DataExchangeClient, ListDataSetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-dataexchange/src/pagination/ListEventActionsPaginator.ts b/clients/client-dataexchange/src/pagination/ListEventActionsPaginator.ts index 1befced915f8..fe76e181e76b 100644 --- a/clients/client-dataexchange/src/pagination/ListEventActionsPaginator.ts +++ b/clients/client-dataexchange/src/pagination/ListEventActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataExchangeClient } from "../DataExchangeClient"; import { DataExchangePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataExchangeClient, - input: ListEventActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEventActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEventActions( +export const paginateListEventActions: ( config: DataExchangePaginationConfiguration, input: ListEventActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEventActionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataExchangeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataExchange | DataExchangeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataExchangePaginationConfiguration, + ListEventActionsCommandInput, + ListEventActionsCommandOutput +>(DataExchangeClient, ListEventActionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-dataexchange/src/pagination/ListJobsPaginator.ts b/clients/client-dataexchange/src/pagination/ListJobsPaginator.ts index 067b5f51e893..9ce1744f6470 100644 --- a/clients/client-dataexchange/src/pagination/ListJobsPaginator.ts +++ b/clients/client-dataexchange/src/pagination/ListJobsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListJobsCommand, ListJobsCommandInput, ListJobsCommandOutput } from "../commands/ListJobsCommand"; import { DataExchangeClient } from "../DataExchangeClient"; import { DataExchangePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataExchangeClient, - input: ListJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobs( +export const paginateListJobs: ( config: DataExchangePaginationConfiguration, input: ListJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataExchangeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataExchange | DataExchangeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataExchangePaginationConfiguration, + ListJobsCommandInput, + ListJobsCommandOutput +>(DataExchangeClient, ListJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-dataexchange/src/pagination/ListRevisionAssetsPaginator.ts b/clients/client-dataexchange/src/pagination/ListRevisionAssetsPaginator.ts index d4f2f8e4619f..33197590e041 100644 --- a/clients/client-dataexchange/src/pagination/ListRevisionAssetsPaginator.ts +++ b/clients/client-dataexchange/src/pagination/ListRevisionAssetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataExchangeClient } from "../DataExchangeClient"; import { DataExchangePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataExchangeClient, - input: ListRevisionAssetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRevisionAssetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRevisionAssets( +export const paginateListRevisionAssets: ( config: DataExchangePaginationConfiguration, input: ListRevisionAssetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRevisionAssetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataExchangeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataExchange | DataExchangeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataExchangePaginationConfiguration, + ListRevisionAssetsCommandInput, + ListRevisionAssetsCommandOutput +>(DataExchangeClient, ListRevisionAssetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-datasync/package.json b/clients/client-datasync/package.json index d8d4a8427ac0..2b6cb562b6cf 100644 --- a/clients/client-datasync/package.json +++ b/clients/client-datasync/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-datasync/src/pagination/DescribeStorageSystemResourceMetricsPaginator.ts b/clients/client-datasync/src/pagination/DescribeStorageSystemResourceMetricsPaginator.ts index 921ce57ca543..9fe9549d7c09 100644 --- a/clients/client-datasync/src/pagination/DescribeStorageSystemResourceMetricsPaginator.ts +++ b/clients/client-datasync/src/pagination/DescribeStorageSystemResourceMetricsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataSyncClient } from "../DataSyncClient"; import { DataSyncPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataSyncClient, - input: DescribeStorageSystemResourceMetricsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeStorageSystemResourceMetricsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeStorageSystemResourceMetrics( +export const paginateDescribeStorageSystemResourceMetrics: ( config: DataSyncPaginationConfiguration, input: DescribeStorageSystemResourceMetricsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeStorageSystemResourceMetricsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataSyncClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataSync | DataSyncClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataSyncPaginationConfiguration, + DescribeStorageSystemResourceMetricsCommandInput, + DescribeStorageSystemResourceMetricsCommandOutput +>(DataSyncClient, DescribeStorageSystemResourceMetricsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-datasync/src/pagination/DescribeStorageSystemResourcesPaginator.ts b/clients/client-datasync/src/pagination/DescribeStorageSystemResourcesPaginator.ts index 430ff8fdc6cb..fd191549c379 100644 --- a/clients/client-datasync/src/pagination/DescribeStorageSystemResourcesPaginator.ts +++ b/clients/client-datasync/src/pagination/DescribeStorageSystemResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataSyncClient } from "../DataSyncClient"; import { DataSyncPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataSyncClient, - input: DescribeStorageSystemResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeStorageSystemResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeStorageSystemResources( +export const paginateDescribeStorageSystemResources: ( config: DataSyncPaginationConfiguration, input: DescribeStorageSystemResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeStorageSystemResourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataSyncClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataSync | DataSyncClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataSyncPaginationConfiguration, + DescribeStorageSystemResourcesCommandInput, + DescribeStorageSystemResourcesCommandOutput +>(DataSyncClient, DescribeStorageSystemResourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-datasync/src/pagination/ListAgentsPaginator.ts b/clients/client-datasync/src/pagination/ListAgentsPaginator.ts index d6b904ebf9c1..2347fa8f6af2 100644 --- a/clients/client-datasync/src/pagination/ListAgentsPaginator.ts +++ b/clients/client-datasync/src/pagination/ListAgentsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAgentsCommand, ListAgentsCommandInput, ListAgentsCommandOutput } from "../commands/ListAgentsCommand"; import { DataSyncClient } from "../DataSyncClient"; import { DataSyncPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataSyncClient, - input: ListAgentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAgentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAgents( +export const paginateListAgents: ( config: DataSyncPaginationConfiguration, input: ListAgentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAgentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataSyncClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataSync | DataSyncClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataSyncPaginationConfiguration, + ListAgentsCommandInput, + ListAgentsCommandOutput +>(DataSyncClient, ListAgentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-datasync/src/pagination/ListDiscoveryJobsPaginator.ts b/clients/client-datasync/src/pagination/ListDiscoveryJobsPaginator.ts index f7a1c6ef2b70..bd618bedd749 100644 --- a/clients/client-datasync/src/pagination/ListDiscoveryJobsPaginator.ts +++ b/clients/client-datasync/src/pagination/ListDiscoveryJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataSyncClient } from "../DataSyncClient"; import { DataSyncPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataSyncClient, - input: ListDiscoveryJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDiscoveryJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDiscoveryJobs( +export const paginateListDiscoveryJobs: ( config: DataSyncPaginationConfiguration, input: ListDiscoveryJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDiscoveryJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataSyncClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataSync | DataSyncClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataSyncPaginationConfiguration, + ListDiscoveryJobsCommandInput, + ListDiscoveryJobsCommandOutput +>(DataSyncClient, ListDiscoveryJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-datasync/src/pagination/ListLocationsPaginator.ts b/clients/client-datasync/src/pagination/ListLocationsPaginator.ts index 87d36e26b05e..f5d95cb3cfe5 100644 --- a/clients/client-datasync/src/pagination/ListLocationsPaginator.ts +++ b/clients/client-datasync/src/pagination/ListLocationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataSyncClient } from "../DataSyncClient"; import { DataSyncPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataSyncClient, - input: ListLocationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLocationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLocations( +export const paginateListLocations: ( config: DataSyncPaginationConfiguration, input: ListLocationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLocationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataSyncClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataSync | DataSyncClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataSyncPaginationConfiguration, + ListLocationsCommandInput, + ListLocationsCommandOutput +>(DataSyncClient, ListLocationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-datasync/src/pagination/ListStorageSystemsPaginator.ts b/clients/client-datasync/src/pagination/ListStorageSystemsPaginator.ts index 0d1f7c6327d7..27190e9d2915 100644 --- a/clients/client-datasync/src/pagination/ListStorageSystemsPaginator.ts +++ b/clients/client-datasync/src/pagination/ListStorageSystemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataSyncClient } from "../DataSyncClient"; import { DataSyncPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataSyncClient, - input: ListStorageSystemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStorageSystemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStorageSystems( +export const paginateListStorageSystems: ( config: DataSyncPaginationConfiguration, input: ListStorageSystemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStorageSystemsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataSyncClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataSync | DataSyncClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataSyncPaginationConfiguration, + ListStorageSystemsCommandInput, + ListStorageSystemsCommandOutput +>(DataSyncClient, ListStorageSystemsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-datasync/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-datasync/src/pagination/ListTagsForResourcePaginator.ts index b3937501fa20..fb2174a45110 100644 --- a/clients/client-datasync/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-datasync/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataSyncClient } from "../DataSyncClient"; import { DataSyncPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataSyncClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: DataSyncPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataSyncClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataSync | DataSyncClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataSyncPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(DataSyncClient, ListTagsForResourceCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-datasync/src/pagination/ListTaskExecutionsPaginator.ts b/clients/client-datasync/src/pagination/ListTaskExecutionsPaginator.ts index b1650d132bb0..c91adaaedc5e 100644 --- a/clients/client-datasync/src/pagination/ListTaskExecutionsPaginator.ts +++ b/clients/client-datasync/src/pagination/ListTaskExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataSyncClient } from "../DataSyncClient"; import { DataSyncPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataSyncClient, - input: ListTaskExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTaskExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTaskExecutions( +export const paginateListTaskExecutions: ( config: DataSyncPaginationConfiguration, input: ListTaskExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTaskExecutionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataSyncClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataSync | DataSyncClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataSyncPaginationConfiguration, + ListTaskExecutionsCommandInput, + ListTaskExecutionsCommandOutput +>(DataSyncClient, ListTaskExecutionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-datasync/src/pagination/ListTasksPaginator.ts b/clients/client-datasync/src/pagination/ListTasksPaginator.ts index 3c40d9d74437..74138e292bf6 100644 --- a/clients/client-datasync/src/pagination/ListTasksPaginator.ts +++ b/clients/client-datasync/src/pagination/ListTasksPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTasksCommand, ListTasksCommandInput, ListTasksCommandOutput } from "../commands/ListTasksCommand"; import { DataSyncClient } from "../DataSyncClient"; import { DataSyncPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataSyncClient, - input: ListTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTasks( +export const paginateListTasks: ( config: DataSyncPaginationConfiguration, input: ListTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTasksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DataSyncClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataSync | DataSyncClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataSyncPaginationConfiguration, + ListTasksCommandInput, + ListTasksCommandOutput +>(DataSyncClient, ListTasksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-datazone/src/pagination/ListAssetRevisionsPaginator.ts b/clients/client-datazone/src/pagination/ListAssetRevisionsPaginator.ts index b828618398be..b0ae30fac052 100644 --- a/clients/client-datazone/src/pagination/ListAssetRevisionsPaginator.ts +++ b/clients/client-datazone/src/pagination/ListAssetRevisionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListAssetRevisionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssetRevisionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssetRevisions( +export const paginateListAssetRevisions: ( config: DataZonePaginationConfiguration, input: ListAssetRevisionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssetRevisionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListAssetRevisionsCommandInput, + ListAssetRevisionsCommandOutput +>(DataZoneClient, ListAssetRevisionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListDataSourceRunActivitiesPaginator.ts b/clients/client-datazone/src/pagination/ListDataSourceRunActivitiesPaginator.ts index 66a14bb6c006..c8469b418b4c 100644 --- a/clients/client-datazone/src/pagination/ListDataSourceRunActivitiesPaginator.ts +++ b/clients/client-datazone/src/pagination/ListDataSourceRunActivitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListDataSourceRunActivitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataSourceRunActivitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataSourceRunActivities( +export const paginateListDataSourceRunActivities: ( config: DataZonePaginationConfiguration, input: ListDataSourceRunActivitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataSourceRunActivitiesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListDataSourceRunActivitiesCommandInput, + ListDataSourceRunActivitiesCommandOutput +>(DataZoneClient, ListDataSourceRunActivitiesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListDataSourceRunsPaginator.ts b/clients/client-datazone/src/pagination/ListDataSourceRunsPaginator.ts index 2e51a6a99a75..354084aa3876 100644 --- a/clients/client-datazone/src/pagination/ListDataSourceRunsPaginator.ts +++ b/clients/client-datazone/src/pagination/ListDataSourceRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListDataSourceRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataSourceRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataSourceRuns( +export const paginateListDataSourceRuns: ( config: DataZonePaginationConfiguration, input: ListDataSourceRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataSourceRunsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListDataSourceRunsCommandInput, + ListDataSourceRunsCommandOutput +>(DataZoneClient, ListDataSourceRunsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListDataSourcesPaginator.ts b/clients/client-datazone/src/pagination/ListDataSourcesPaginator.ts index 685b1d0bde04..071777b25d61 100644 --- a/clients/client-datazone/src/pagination/ListDataSourcesPaginator.ts +++ b/clients/client-datazone/src/pagination/ListDataSourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListDataSourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataSourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataSources( +export const paginateListDataSources: ( config: DataZonePaginationConfiguration, input: ListDataSourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataSourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListDataSourcesCommandInput, + ListDataSourcesCommandOutput +>(DataZoneClient, ListDataSourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListDomainsPaginator.ts b/clients/client-datazone/src/pagination/ListDomainsPaginator.ts index 181fcebaba70..ffc973bf2b70 100644 --- a/clients/client-datazone/src/pagination/ListDomainsPaginator.ts +++ b/clients/client-datazone/src/pagination/ListDomainsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListDomainsCommand, ListDomainsCommandInput, ListDomainsCommandOutput } from "../commands/ListDomainsCommand"; import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListDomainsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomains( +export const paginateListDomains: ( config: DataZonePaginationConfiguration, input: ListDomainsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListDomainsCommandInput, + ListDomainsCommandOutput +>(DataZoneClient, ListDomainsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListEnvironmentBlueprintConfigurationsPaginator.ts b/clients/client-datazone/src/pagination/ListEnvironmentBlueprintConfigurationsPaginator.ts index adcf8253b727..56062938d6ee 100644 --- a/clients/client-datazone/src/pagination/ListEnvironmentBlueprintConfigurationsPaginator.ts +++ b/clients/client-datazone/src/pagination/ListEnvironmentBlueprintConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListEnvironmentBlueprintConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentBlueprintConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironmentBlueprintConfigurations( +export const paginateListEnvironmentBlueprintConfigurations: ( config: DataZonePaginationConfiguration, input: ListEnvironmentBlueprintConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentBlueprintConfigurationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListEnvironmentBlueprintConfigurationsCommandInput, + ListEnvironmentBlueprintConfigurationsCommandOutput +>(DataZoneClient, ListEnvironmentBlueprintConfigurationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListEnvironmentBlueprintsPaginator.ts b/clients/client-datazone/src/pagination/ListEnvironmentBlueprintsPaginator.ts index a0395de02f5c..487b7399fba7 100644 --- a/clients/client-datazone/src/pagination/ListEnvironmentBlueprintsPaginator.ts +++ b/clients/client-datazone/src/pagination/ListEnvironmentBlueprintsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListEnvironmentBlueprintsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentBlueprintsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironmentBlueprints( +export const paginateListEnvironmentBlueprints: ( config: DataZonePaginationConfiguration, input: ListEnvironmentBlueprintsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentBlueprintsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListEnvironmentBlueprintsCommandInput, + ListEnvironmentBlueprintsCommandOutput +>(DataZoneClient, ListEnvironmentBlueprintsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListEnvironmentProfilesPaginator.ts b/clients/client-datazone/src/pagination/ListEnvironmentProfilesPaginator.ts index a9a1f3212f3d..df17696ce799 100644 --- a/clients/client-datazone/src/pagination/ListEnvironmentProfilesPaginator.ts +++ b/clients/client-datazone/src/pagination/ListEnvironmentProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListEnvironmentProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironmentProfiles( +export const paginateListEnvironmentProfiles: ( config: DataZonePaginationConfiguration, input: ListEnvironmentProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentProfilesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListEnvironmentProfilesCommandInput, + ListEnvironmentProfilesCommandOutput +>(DataZoneClient, ListEnvironmentProfilesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListEnvironmentsPaginator.ts b/clients/client-datazone/src/pagination/ListEnvironmentsPaginator.ts index 5e4176a19275..6fa4944b7dde 100644 --- a/clients/client-datazone/src/pagination/ListEnvironmentsPaginator.ts +++ b/clients/client-datazone/src/pagination/ListEnvironmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListEnvironmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironments( +export const paginateListEnvironments: ( config: DataZonePaginationConfiguration, input: ListEnvironmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListEnvironmentsCommandInput, + ListEnvironmentsCommandOutput +>(DataZoneClient, ListEnvironmentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListNotificationsPaginator.ts b/clients/client-datazone/src/pagination/ListNotificationsPaginator.ts index 105851ea148a..6e8aafcbb3d1 100644 --- a/clients/client-datazone/src/pagination/ListNotificationsPaginator.ts +++ b/clients/client-datazone/src/pagination/ListNotificationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListNotificationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNotificationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNotifications( +export const paginateListNotifications: ( config: DataZonePaginationConfiguration, input: ListNotificationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNotificationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListNotificationsCommandInput, + ListNotificationsCommandOutput +>(DataZoneClient, ListNotificationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListProjectMembershipsPaginator.ts b/clients/client-datazone/src/pagination/ListProjectMembershipsPaginator.ts index 8238a696e63d..6fd56930cbb9 100644 --- a/clients/client-datazone/src/pagination/ListProjectMembershipsPaginator.ts +++ b/clients/client-datazone/src/pagination/ListProjectMembershipsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListProjectMembershipsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProjectMembershipsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProjectMemberships( +export const paginateListProjectMemberships: ( config: DataZonePaginationConfiguration, input: ListProjectMembershipsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProjectMembershipsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListProjectMembershipsCommandInput, + ListProjectMembershipsCommandOutput +>(DataZoneClient, ListProjectMembershipsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListProjectsPaginator.ts b/clients/client-datazone/src/pagination/ListProjectsPaginator.ts index a0cdb611ffdf..f8dab2cfe9cd 100644 --- a/clients/client-datazone/src/pagination/ListProjectsPaginator.ts +++ b/clients/client-datazone/src/pagination/ListProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProjects( +export const paginateListProjects: ( config: DataZonePaginationConfiguration, input: ListProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProjectsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListProjectsCommandInput, + ListProjectsCommandOutput +>(DataZoneClient, ListProjectsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListSubscriptionGrantsPaginator.ts b/clients/client-datazone/src/pagination/ListSubscriptionGrantsPaginator.ts index aebd0fd26dd2..dfc050c2d45e 100644 --- a/clients/client-datazone/src/pagination/ListSubscriptionGrantsPaginator.ts +++ b/clients/client-datazone/src/pagination/ListSubscriptionGrantsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListSubscriptionGrantsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSubscriptionGrantsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSubscriptionGrants( +export const paginateListSubscriptionGrants: ( config: DataZonePaginationConfiguration, input: ListSubscriptionGrantsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSubscriptionGrantsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListSubscriptionGrantsCommandInput, + ListSubscriptionGrantsCommandOutput +>(DataZoneClient, ListSubscriptionGrantsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListSubscriptionRequestsPaginator.ts b/clients/client-datazone/src/pagination/ListSubscriptionRequestsPaginator.ts index c7cb9991b80a..2646ebd01b1b 100644 --- a/clients/client-datazone/src/pagination/ListSubscriptionRequestsPaginator.ts +++ b/clients/client-datazone/src/pagination/ListSubscriptionRequestsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListSubscriptionRequestsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSubscriptionRequestsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSubscriptionRequests( +export const paginateListSubscriptionRequests: ( config: DataZonePaginationConfiguration, input: ListSubscriptionRequestsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSubscriptionRequestsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListSubscriptionRequestsCommandInput, + ListSubscriptionRequestsCommandOutput +>(DataZoneClient, ListSubscriptionRequestsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListSubscriptionTargetsPaginator.ts b/clients/client-datazone/src/pagination/ListSubscriptionTargetsPaginator.ts index 7025836be3b5..b671c2e5e9ae 100644 --- a/clients/client-datazone/src/pagination/ListSubscriptionTargetsPaginator.ts +++ b/clients/client-datazone/src/pagination/ListSubscriptionTargetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListSubscriptionTargetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSubscriptionTargetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSubscriptionTargets( +export const paginateListSubscriptionTargets: ( config: DataZonePaginationConfiguration, input: ListSubscriptionTargetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSubscriptionTargetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListSubscriptionTargetsCommandInput, + ListSubscriptionTargetsCommandOutput +>(DataZoneClient, ListSubscriptionTargetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/ListSubscriptionsPaginator.ts b/clients/client-datazone/src/pagination/ListSubscriptionsPaginator.ts index e5825fd1bc90..d44eb2e8e18a 100644 --- a/clients/client-datazone/src/pagination/ListSubscriptionsPaginator.ts +++ b/clients/client-datazone/src/pagination/ListSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: ListSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSubscriptions( +export const paginateListSubscriptions: ( config: DataZonePaginationConfiguration, input: ListSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSubscriptionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + ListSubscriptionsCommandInput, + ListSubscriptionsCommandOutput +>(DataZoneClient, ListSubscriptionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/SearchGroupProfilesPaginator.ts b/clients/client-datazone/src/pagination/SearchGroupProfilesPaginator.ts index 83f01aa76797..b402dac6a269 100644 --- a/clients/client-datazone/src/pagination/SearchGroupProfilesPaginator.ts +++ b/clients/client-datazone/src/pagination/SearchGroupProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: SearchGroupProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchGroupProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchGroupProfiles( +export const paginateSearchGroupProfiles: ( config: DataZonePaginationConfiguration, input: SearchGroupProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchGroupProfilesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + SearchGroupProfilesCommandInput, + SearchGroupProfilesCommandOutput +>(DataZoneClient, SearchGroupProfilesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/SearchListingsPaginator.ts b/clients/client-datazone/src/pagination/SearchListingsPaginator.ts index 7993053ff1d6..e2b5b4d31b4b 100644 --- a/clients/client-datazone/src/pagination/SearchListingsPaginator.ts +++ b/clients/client-datazone/src/pagination/SearchListingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: SearchListingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchListingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchListings( +export const paginateSearchListings: ( config: DataZonePaginationConfiguration, input: SearchListingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchListingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + SearchListingsCommandInput, + SearchListingsCommandOutput +>(DataZoneClient, SearchListingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/SearchPaginator.ts b/clients/client-datazone/src/pagination/SearchPaginator.ts index a23e8e388d1c..dba98c7dd707 100644 --- a/clients/client-datazone/src/pagination/SearchPaginator.ts +++ b/clients/client-datazone/src/pagination/SearchPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { SearchCommand, SearchCommandInput, SearchCommandOutput } from "../commands/SearchCommand"; import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: SearchCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearch( +export const paginateSearch: ( config: DataZonePaginationConfiguration, input: SearchCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + SearchCommandInput, + SearchCommandOutput +>(DataZoneClient, SearchCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/SearchTypesPaginator.ts b/clients/client-datazone/src/pagination/SearchTypesPaginator.ts index 72ba3cf17747..8568a8622bbe 100644 --- a/clients/client-datazone/src/pagination/SearchTypesPaginator.ts +++ b/clients/client-datazone/src/pagination/SearchTypesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { SearchTypesCommand, SearchTypesCommandInput, SearchTypesCommandOutput } from "../commands/SearchTypesCommand"; import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: SearchTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchTypes( +export const paginateSearchTypes: ( config: DataZonePaginationConfiguration, input: SearchTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchTypesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + SearchTypesCommandInput, + SearchTypesCommandOutput +>(DataZoneClient, SearchTypesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-datazone/src/pagination/SearchUserProfilesPaginator.ts b/clients/client-datazone/src/pagination/SearchUserProfilesPaginator.ts index d101ea09504c..9e207298ccd7 100644 --- a/clients/client-datazone/src/pagination/SearchUserProfilesPaginator.ts +++ b/clients/client-datazone/src/pagination/SearchUserProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DataZoneClient } from "../DataZoneClient"; import { DataZonePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DataZoneClient, - input: SearchUserProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchUserProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchUserProfiles( +export const paginateSearchUserProfiles: ( config: DataZonePaginationConfiguration, input: SearchUserProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchUserProfilesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DataZoneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DataZone | DataZoneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DataZonePaginationConfiguration, + SearchUserProfilesCommandInput, + SearchUserProfilesCommandOutput +>(DataZoneClient, SearchUserProfilesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-detective/src/pagination/ListDatasourcePackagesPaginator.ts b/clients/client-detective/src/pagination/ListDatasourcePackagesPaginator.ts index e0edd7225554..b09da4312e08 100644 --- a/clients/client-detective/src/pagination/ListDatasourcePackagesPaginator.ts +++ b/clients/client-detective/src/pagination/ListDatasourcePackagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DetectiveClient } from "../DetectiveClient"; import { DetectivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DetectiveClient, - input: ListDatasourcePackagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasourcePackagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasourcePackages( +export const paginateListDatasourcePackages: ( config: DetectivePaginationConfiguration, input: ListDatasourcePackagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasourcePackagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DetectiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Detective | DetectiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DetectivePaginationConfiguration, + ListDatasourcePackagesCommandInput, + ListDatasourcePackagesCommandOutput +>(DetectiveClient, ListDatasourcePackagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-detective/src/pagination/ListGraphsPaginator.ts b/clients/client-detective/src/pagination/ListGraphsPaginator.ts index ed38e6b6c8c1..648a76de7d19 100644 --- a/clients/client-detective/src/pagination/ListGraphsPaginator.ts +++ b/clients/client-detective/src/pagination/ListGraphsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListGraphsCommand, ListGraphsCommandInput, ListGraphsCommandOutput } from "../commands/ListGraphsCommand"; import { DetectiveClient } from "../DetectiveClient"; import { DetectivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DetectiveClient, - input: ListGraphsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGraphsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGraphs( +export const paginateListGraphs: ( config: DetectivePaginationConfiguration, input: ListGraphsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGraphsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DetectiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Detective | DetectiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DetectivePaginationConfiguration, + ListGraphsCommandInput, + ListGraphsCommandOutput +>(DetectiveClient, ListGraphsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-detective/src/pagination/ListInvitationsPaginator.ts b/clients/client-detective/src/pagination/ListInvitationsPaginator.ts index 6a9230d8be08..0baf675bf80f 100644 --- a/clients/client-detective/src/pagination/ListInvitationsPaginator.ts +++ b/clients/client-detective/src/pagination/ListInvitationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DetectiveClient } from "../DetectiveClient"; import { DetectivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DetectiveClient, - input: ListInvitationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInvitationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInvitations( +export const paginateListInvitations: ( config: DetectivePaginationConfiguration, input: ListInvitationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInvitationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DetectiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Detective | DetectiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DetectivePaginationConfiguration, + ListInvitationsCommandInput, + ListInvitationsCommandOutput +>(DetectiveClient, ListInvitationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-detective/src/pagination/ListMembersPaginator.ts b/clients/client-detective/src/pagination/ListMembersPaginator.ts index 5fd06d44aff7..f576228dd9f7 100644 --- a/clients/client-detective/src/pagination/ListMembersPaginator.ts +++ b/clients/client-detective/src/pagination/ListMembersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListMembersCommand, ListMembersCommandInput, ListMembersCommandOutput } from "../commands/ListMembersCommand"; import { DetectiveClient } from "../DetectiveClient"; import { DetectivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DetectiveClient, - input: ListMembersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMembersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMembers( +export const paginateListMembers: ( config: DetectivePaginationConfiguration, input: ListMembersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMembersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DetectiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Detective | DetectiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DetectivePaginationConfiguration, + ListMembersCommandInput, + ListMembersCommandOutput +>(DetectiveClient, ListMembersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-detective/src/pagination/ListOrganizationAdminAccountsPaginator.ts b/clients/client-detective/src/pagination/ListOrganizationAdminAccountsPaginator.ts index 313bd4b9e808..eeab6da94b18 100644 --- a/clients/client-detective/src/pagination/ListOrganizationAdminAccountsPaginator.ts +++ b/clients/client-detective/src/pagination/ListOrganizationAdminAccountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DetectiveClient } from "../DetectiveClient"; import { DetectivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DetectiveClient, - input: ListOrganizationAdminAccountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOrganizationAdminAccountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOrganizationAdminAccounts( +export const paginateListOrganizationAdminAccounts: ( config: DetectivePaginationConfiguration, input: ListOrganizationAdminAccountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOrganizationAdminAccountsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DetectiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Detective | DetectiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DetectivePaginationConfiguration, + ListOrganizationAdminAccountsCommandInput, + ListOrganizationAdminAccountsCommandOutput +>(DetectiveClient, ListOrganizationAdminAccountsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-device-farm/package.json b/clients/client-device-farm/package.json index 1d2255e0bc15..c738211190ee 100644 --- a/clients/client-device-farm/package.json +++ b/clients/client-device-farm/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-device-farm/src/pagination/GetOfferingStatusPaginator.ts b/clients/client-device-farm/src/pagination/GetOfferingStatusPaginator.ts index 754a36525367..24bd642cf426 100644 --- a/clients/client-device-farm/src/pagination/GetOfferingStatusPaginator.ts +++ b/clients/client-device-farm/src/pagination/GetOfferingStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: GetOfferingStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetOfferingStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetOfferingStatus( +export const paginateGetOfferingStatus: ( config: DeviceFarmPaginationConfiguration, input: GetOfferingStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetOfferingStatusCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + GetOfferingStatusCommandInput, + GetOfferingStatusCommandOutput +>(DeviceFarmClient, GetOfferingStatusCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-device-farm/src/pagination/ListArtifactsPaginator.ts b/clients/client-device-farm/src/pagination/ListArtifactsPaginator.ts index 8128938844b8..550ae317b5a9 100644 --- a/clients/client-device-farm/src/pagination/ListArtifactsPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListArtifactsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListArtifactsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListArtifactsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListArtifacts( +export const paginateListArtifacts: ( config: DeviceFarmPaginationConfiguration, input: ListArtifactsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListArtifactsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListArtifactsCommandInput, + ListArtifactsCommandOutput +>(DeviceFarmClient, ListArtifactsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-device-farm/src/pagination/ListDevicePoolsPaginator.ts b/clients/client-device-farm/src/pagination/ListDevicePoolsPaginator.ts index adc1f9028686..a359b29bf881 100644 --- a/clients/client-device-farm/src/pagination/ListDevicePoolsPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListDevicePoolsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListDevicePoolsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDevicePoolsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDevicePools( +export const paginateListDevicePools: ( config: DeviceFarmPaginationConfiguration, input: ListDevicePoolsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDevicePoolsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListDevicePoolsCommandInput, + ListDevicePoolsCommandOutput +>(DeviceFarmClient, ListDevicePoolsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-device-farm/src/pagination/ListDevicesPaginator.ts b/clients/client-device-farm/src/pagination/ListDevicesPaginator.ts index 85497a4a8de9..fddf65805210 100644 --- a/clients/client-device-farm/src/pagination/ListDevicesPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListDevicesPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListDevicesCommand, ListDevicesCommandInput, ListDevicesCommandOutput } from "../commands/ListDevicesCommand"; import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListDevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDevices( +export const paginateListDevices: ( config: DeviceFarmPaginationConfiguration, input: ListDevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDevicesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListDevicesCommandInput, + ListDevicesCommandOutput +>(DeviceFarmClient, ListDevicesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-device-farm/src/pagination/ListJobsPaginator.ts b/clients/client-device-farm/src/pagination/ListJobsPaginator.ts index 099f1ece9899..b406dbdd7ddb 100644 --- a/clients/client-device-farm/src/pagination/ListJobsPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListJobsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListJobsCommand, ListJobsCommandInput, ListJobsCommandOutput } from "../commands/ListJobsCommand"; import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobs( +export const paginateListJobs: ( config: DeviceFarmPaginationConfiguration, input: ListJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListJobsCommandInput, + ListJobsCommandOutput +>(DeviceFarmClient, ListJobsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-device-farm/src/pagination/ListOfferingTransactionsPaginator.ts b/clients/client-device-farm/src/pagination/ListOfferingTransactionsPaginator.ts index 4c9419f32da5..1914e7a52986 100644 --- a/clients/client-device-farm/src/pagination/ListOfferingTransactionsPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListOfferingTransactionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListOfferingTransactionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOfferingTransactionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOfferingTransactions( +export const paginateListOfferingTransactions: ( config: DeviceFarmPaginationConfiguration, input: ListOfferingTransactionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOfferingTransactionsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListOfferingTransactionsCommandInput, + ListOfferingTransactionsCommandOutput +>(DeviceFarmClient, ListOfferingTransactionsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-device-farm/src/pagination/ListOfferingsPaginator.ts b/clients/client-device-farm/src/pagination/ListOfferingsPaginator.ts index 2ba0f6b3b50d..d0c1b2dff448 100644 --- a/clients/client-device-farm/src/pagination/ListOfferingsPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListOfferingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListOfferingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOfferingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOfferings( +export const paginateListOfferings: ( config: DeviceFarmPaginationConfiguration, input: ListOfferingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOfferingsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListOfferingsCommandInput, + ListOfferingsCommandOutput +>(DeviceFarmClient, ListOfferingsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-device-farm/src/pagination/ListProjectsPaginator.ts b/clients/client-device-farm/src/pagination/ListProjectsPaginator.ts index bf2f4b5e2bda..f904ffd997ef 100644 --- a/clients/client-device-farm/src/pagination/ListProjectsPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProjects( +export const paginateListProjects: ( config: DeviceFarmPaginationConfiguration, input: ListProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProjectsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListProjectsCommandInput, + ListProjectsCommandOutput +>(DeviceFarmClient, ListProjectsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-device-farm/src/pagination/ListRunsPaginator.ts b/clients/client-device-farm/src/pagination/ListRunsPaginator.ts index 87019237c5b0..750cb823b0b6 100644 --- a/clients/client-device-farm/src/pagination/ListRunsPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListRunsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListRunsCommand, ListRunsCommandInput, ListRunsCommandOutput } from "../commands/ListRunsCommand"; import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRuns( +export const paginateListRuns: ( config: DeviceFarmPaginationConfiguration, input: ListRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRunsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListRunsCommandInput, + ListRunsCommandOutput +>(DeviceFarmClient, ListRunsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-device-farm/src/pagination/ListSamplesPaginator.ts b/clients/client-device-farm/src/pagination/ListSamplesPaginator.ts index 1a9adc7a63ab..e9562fc5a72b 100644 --- a/clients/client-device-farm/src/pagination/ListSamplesPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListSamplesPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListSamplesCommand, ListSamplesCommandInput, ListSamplesCommandOutput } from "../commands/ListSamplesCommand"; import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListSamplesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSamplesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSamples( +export const paginateListSamples: ( config: DeviceFarmPaginationConfiguration, input: ListSamplesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSamplesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListSamplesCommandInput, + ListSamplesCommandOutput +>(DeviceFarmClient, ListSamplesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-device-farm/src/pagination/ListSuitesPaginator.ts b/clients/client-device-farm/src/pagination/ListSuitesPaginator.ts index 6d7be4e8d2e8..9d3e7cd85f15 100644 --- a/clients/client-device-farm/src/pagination/ListSuitesPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListSuitesPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListSuitesCommand, ListSuitesCommandInput, ListSuitesCommandOutput } from "../commands/ListSuitesCommand"; import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListSuitesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSuitesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSuites( +export const paginateListSuites: ( config: DeviceFarmPaginationConfiguration, input: ListSuitesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSuitesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListSuitesCommandInput, + ListSuitesCommandOutput +>(DeviceFarmClient, ListSuitesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-device-farm/src/pagination/ListTestGridProjectsPaginator.ts b/clients/client-device-farm/src/pagination/ListTestGridProjectsPaginator.ts index 1fa8cd8dea15..d8a91f420004 100644 --- a/clients/client-device-farm/src/pagination/ListTestGridProjectsPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListTestGridProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListTestGridProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTestGridProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTestGridProjects( +export const paginateListTestGridProjects: ( config: DeviceFarmPaginationConfiguration, input: ListTestGridProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTestGridProjectsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResult"] = config.pageSize; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListTestGridProjectsCommandInput, + ListTestGridProjectsCommandOutput +>(DeviceFarmClient, ListTestGridProjectsCommand, "nextToken", "nextToken", "maxResult"); diff --git a/clients/client-device-farm/src/pagination/ListTestGridSessionActionsPaginator.ts b/clients/client-device-farm/src/pagination/ListTestGridSessionActionsPaginator.ts index 0ca8b2d2e2ba..6876a65c365b 100644 --- a/clients/client-device-farm/src/pagination/ListTestGridSessionActionsPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListTestGridSessionActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListTestGridSessionActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTestGridSessionActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTestGridSessionActions( +export const paginateListTestGridSessionActions: ( config: DeviceFarmPaginationConfiguration, input: ListTestGridSessionActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTestGridSessionActionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResult"] = config.pageSize; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListTestGridSessionActionsCommandInput, + ListTestGridSessionActionsCommandOutput +>(DeviceFarmClient, ListTestGridSessionActionsCommand, "nextToken", "nextToken", "maxResult"); diff --git a/clients/client-device-farm/src/pagination/ListTestGridSessionArtifactsPaginator.ts b/clients/client-device-farm/src/pagination/ListTestGridSessionArtifactsPaginator.ts index 124a7f563af9..a58e3f3cafa4 100644 --- a/clients/client-device-farm/src/pagination/ListTestGridSessionArtifactsPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListTestGridSessionArtifactsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListTestGridSessionArtifactsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTestGridSessionArtifactsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTestGridSessionArtifacts( +export const paginateListTestGridSessionArtifacts: ( config: DeviceFarmPaginationConfiguration, input: ListTestGridSessionArtifactsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTestGridSessionArtifactsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResult"] = config.pageSize; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListTestGridSessionArtifactsCommandInput, + ListTestGridSessionArtifactsCommandOutput +>(DeviceFarmClient, ListTestGridSessionArtifactsCommand, "nextToken", "nextToken", "maxResult"); diff --git a/clients/client-device-farm/src/pagination/ListTestGridSessionsPaginator.ts b/clients/client-device-farm/src/pagination/ListTestGridSessionsPaginator.ts index ea55734a9e24..96fd775428a7 100644 --- a/clients/client-device-farm/src/pagination/ListTestGridSessionsPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListTestGridSessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListTestGridSessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTestGridSessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTestGridSessions( +export const paginateListTestGridSessions: ( config: DeviceFarmPaginationConfiguration, input: ListTestGridSessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTestGridSessionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResult"] = config.pageSize; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListTestGridSessionsCommandInput, + ListTestGridSessionsCommandOutput +>(DeviceFarmClient, ListTestGridSessionsCommand, "nextToken", "nextToken", "maxResult"); diff --git a/clients/client-device-farm/src/pagination/ListTestsPaginator.ts b/clients/client-device-farm/src/pagination/ListTestsPaginator.ts index 981b8df97606..e4e8720c7ab9 100644 --- a/clients/client-device-farm/src/pagination/ListTestsPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListTestsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTestsCommand, ListTestsCommandInput, ListTestsCommandOutput } from "../commands/ListTestsCommand"; import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListTestsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTestsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTests( +export const paginateListTests: ( config: DeviceFarmPaginationConfiguration, input: ListTestsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTestsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListTestsCommandInput, + ListTestsCommandOutput +>(DeviceFarmClient, ListTestsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-device-farm/src/pagination/ListUniqueProblemsPaginator.ts b/clients/client-device-farm/src/pagination/ListUniqueProblemsPaginator.ts index 76432999e876..7ae0d24e536c 100644 --- a/clients/client-device-farm/src/pagination/ListUniqueProblemsPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListUniqueProblemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListUniqueProblemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUniqueProblemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUniqueProblems( +export const paginateListUniqueProblems: ( config: DeviceFarmPaginationConfiguration, input: ListUniqueProblemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUniqueProblemsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListUniqueProblemsCommandInput, + ListUniqueProblemsCommandOutput +>(DeviceFarmClient, ListUniqueProblemsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-device-farm/src/pagination/ListUploadsPaginator.ts b/clients/client-device-farm/src/pagination/ListUploadsPaginator.ts index 375c95da395c..87478ac636f8 100644 --- a/clients/client-device-farm/src/pagination/ListUploadsPaginator.ts +++ b/clients/client-device-farm/src/pagination/ListUploadsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListUploadsCommand, ListUploadsCommandInput, ListUploadsCommandOutput } from "../commands/ListUploadsCommand"; import { DeviceFarmClient } from "../DeviceFarmClient"; import { DeviceFarmPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DeviceFarmClient, - input: ListUploadsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUploadsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUploads( +export const paginateListUploads: ( config: DeviceFarmPaginationConfiguration, input: ListUploadsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUploadsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof DeviceFarmClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DeviceFarm | DeviceFarmClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DeviceFarmPaginationConfiguration, + ListUploadsCommandInput, + ListUploadsCommandOutput +>(DeviceFarmClient, ListUploadsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-devops-guru/src/pagination/DescribeOrganizationResourceCollectionHealthPaginator.ts b/clients/client-devops-guru/src/pagination/DescribeOrganizationResourceCollectionHealthPaginator.ts index a2492ae5989e..8fb5323f0836 100644 --- a/clients/client-devops-guru/src/pagination/DescribeOrganizationResourceCollectionHealthPaginator.ts +++ b/clients/client-devops-guru/src/pagination/DescribeOrganizationResourceCollectionHealthPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DevOpsGuruClient } from "../DevOpsGuruClient"; import { DevOpsGuruPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DevOpsGuruClient, - input: DescribeOrganizationResourceCollectionHealthCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOrganizationResourceCollectionHealthCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOrganizationResourceCollectionHealth( +export const paginateDescribeOrganizationResourceCollectionHealth: ( config: DevOpsGuruPaginationConfiguration, input: DescribeOrganizationResourceCollectionHealthCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOrganizationResourceCollectionHealthCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof DevOpsGuruClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DevOpsGuru | DevOpsGuruClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DevOpsGuruPaginationConfiguration, + DescribeOrganizationResourceCollectionHealthCommandInput, + DescribeOrganizationResourceCollectionHealthCommandOutput +>(DevOpsGuruClient, DescribeOrganizationResourceCollectionHealthCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-devops-guru/src/pagination/DescribeResourceCollectionHealthPaginator.ts b/clients/client-devops-guru/src/pagination/DescribeResourceCollectionHealthPaginator.ts index e993f358cc9c..334e473220bd 100644 --- a/clients/client-devops-guru/src/pagination/DescribeResourceCollectionHealthPaginator.ts +++ b/clients/client-devops-guru/src/pagination/DescribeResourceCollectionHealthPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DevOpsGuruClient } from "../DevOpsGuruClient"; import { DevOpsGuruPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DevOpsGuruClient, - input: DescribeResourceCollectionHealthCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeResourceCollectionHealthCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeResourceCollectionHealth( +export const paginateDescribeResourceCollectionHealth: ( config: DevOpsGuruPaginationConfiguration, input: DescribeResourceCollectionHealthCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeResourceCollectionHealthCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof DevOpsGuruClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DevOpsGuru | DevOpsGuruClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DevOpsGuruPaginationConfiguration, + DescribeResourceCollectionHealthCommandInput, + DescribeResourceCollectionHealthCommandOutput +>(DevOpsGuruClient, DescribeResourceCollectionHealthCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-devops-guru/src/pagination/GetCostEstimationPaginator.ts b/clients/client-devops-guru/src/pagination/GetCostEstimationPaginator.ts index bded0eb27d45..3b464ea2e0cb 100644 --- a/clients/client-devops-guru/src/pagination/GetCostEstimationPaginator.ts +++ b/clients/client-devops-guru/src/pagination/GetCostEstimationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DevOpsGuruClient } from "../DevOpsGuruClient"; import { DevOpsGuruPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DevOpsGuruClient, - input: GetCostEstimationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCostEstimationCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCostEstimation( +export const paginateGetCostEstimation: ( config: DevOpsGuruPaginationConfiguration, input: GetCostEstimationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCostEstimationCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof DevOpsGuruClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DevOpsGuru | DevOpsGuruClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DevOpsGuruPaginationConfiguration, + GetCostEstimationCommandInput, + GetCostEstimationCommandOutput +>(DevOpsGuruClient, GetCostEstimationCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-devops-guru/src/pagination/GetResourceCollectionPaginator.ts b/clients/client-devops-guru/src/pagination/GetResourceCollectionPaginator.ts index 6508aa03cd5a..4cd2563c557f 100644 --- a/clients/client-devops-guru/src/pagination/GetResourceCollectionPaginator.ts +++ b/clients/client-devops-guru/src/pagination/GetResourceCollectionPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DevOpsGuruClient } from "../DevOpsGuruClient"; import { DevOpsGuruPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DevOpsGuruClient, - input: GetResourceCollectionCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetResourceCollectionCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetResourceCollection( +export const paginateGetResourceCollection: ( config: DevOpsGuruPaginationConfiguration, input: GetResourceCollectionCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetResourceCollectionCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof DevOpsGuruClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DevOpsGuru | DevOpsGuruClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DevOpsGuruPaginationConfiguration, + GetResourceCollectionCommandInput, + GetResourceCollectionCommandOutput +>(DevOpsGuruClient, GetResourceCollectionCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-devops-guru/src/pagination/ListAnomaliesForInsightPaginator.ts b/clients/client-devops-guru/src/pagination/ListAnomaliesForInsightPaginator.ts index 51e3212ca6ef..82e1f908f443 100644 --- a/clients/client-devops-guru/src/pagination/ListAnomaliesForInsightPaginator.ts +++ b/clients/client-devops-guru/src/pagination/ListAnomaliesForInsightPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DevOpsGuruClient } from "../DevOpsGuruClient"; import { DevOpsGuruPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DevOpsGuruClient, - input: ListAnomaliesForInsightCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnomaliesForInsightCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnomaliesForInsight( +export const paginateListAnomaliesForInsight: ( config: DevOpsGuruPaginationConfiguration, input: ListAnomaliesForInsightCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnomaliesForInsightCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DevOpsGuruClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DevOpsGuru | DevOpsGuruClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DevOpsGuruPaginationConfiguration, + ListAnomaliesForInsightCommandInput, + ListAnomaliesForInsightCommandOutput +>(DevOpsGuruClient, ListAnomaliesForInsightCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-devops-guru/src/pagination/ListAnomalousLogGroupsPaginator.ts b/clients/client-devops-guru/src/pagination/ListAnomalousLogGroupsPaginator.ts index 019bf621461a..277891a5abc4 100644 --- a/clients/client-devops-guru/src/pagination/ListAnomalousLogGroupsPaginator.ts +++ b/clients/client-devops-guru/src/pagination/ListAnomalousLogGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DevOpsGuruClient } from "../DevOpsGuruClient"; import { DevOpsGuruPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DevOpsGuruClient, - input: ListAnomalousLogGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnomalousLogGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnomalousLogGroups( +export const paginateListAnomalousLogGroups: ( config: DevOpsGuruPaginationConfiguration, input: ListAnomalousLogGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnomalousLogGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DevOpsGuruClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DevOpsGuru | DevOpsGuruClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DevOpsGuruPaginationConfiguration, + ListAnomalousLogGroupsCommandInput, + ListAnomalousLogGroupsCommandOutput +>(DevOpsGuruClient, ListAnomalousLogGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-devops-guru/src/pagination/ListEventsPaginator.ts b/clients/client-devops-guru/src/pagination/ListEventsPaginator.ts index 79ad621d0708..73449ebca75f 100644 --- a/clients/client-devops-guru/src/pagination/ListEventsPaginator.ts +++ b/clients/client-devops-guru/src/pagination/ListEventsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListEventsCommand, ListEventsCommandInput, ListEventsCommandOutput } from "../commands/ListEventsCommand"; import { DevOpsGuruClient } from "../DevOpsGuruClient"; import { DevOpsGuruPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DevOpsGuruClient, - input: ListEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEvents( +export const paginateListEvents: ( config: DevOpsGuruPaginationConfiguration, input: ListEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEventsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DevOpsGuruClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DevOpsGuru | DevOpsGuruClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DevOpsGuruPaginationConfiguration, + ListEventsCommandInput, + ListEventsCommandOutput +>(DevOpsGuruClient, ListEventsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-devops-guru/src/pagination/ListInsightsPaginator.ts b/clients/client-devops-guru/src/pagination/ListInsightsPaginator.ts index 470e69c16281..f9c25627d035 100644 --- a/clients/client-devops-guru/src/pagination/ListInsightsPaginator.ts +++ b/clients/client-devops-guru/src/pagination/ListInsightsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DevOpsGuruClient } from "../DevOpsGuruClient"; import { DevOpsGuruPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DevOpsGuruClient, - input: ListInsightsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInsightsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInsights( +export const paginateListInsights: ( config: DevOpsGuruPaginationConfiguration, input: ListInsightsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInsightsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DevOpsGuruClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DevOpsGuru | DevOpsGuruClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DevOpsGuruPaginationConfiguration, + ListInsightsCommandInput, + ListInsightsCommandOutput +>(DevOpsGuruClient, ListInsightsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-devops-guru/src/pagination/ListMonitoredResourcesPaginator.ts b/clients/client-devops-guru/src/pagination/ListMonitoredResourcesPaginator.ts index 09ead9d76047..ccaa512d3ff1 100644 --- a/clients/client-devops-guru/src/pagination/ListMonitoredResourcesPaginator.ts +++ b/clients/client-devops-guru/src/pagination/ListMonitoredResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DevOpsGuruClient } from "../DevOpsGuruClient"; import { DevOpsGuruPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DevOpsGuruClient, - input: ListMonitoredResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMonitoredResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMonitoredResources( +export const paginateListMonitoredResources: ( config: DevOpsGuruPaginationConfiguration, input: ListMonitoredResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMonitoredResourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DevOpsGuruClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DevOpsGuru | DevOpsGuruClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DevOpsGuruPaginationConfiguration, + ListMonitoredResourcesCommandInput, + ListMonitoredResourcesCommandOutput +>(DevOpsGuruClient, ListMonitoredResourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-devops-guru/src/pagination/ListNotificationChannelsPaginator.ts b/clients/client-devops-guru/src/pagination/ListNotificationChannelsPaginator.ts index 28d0c796c715..785309294c92 100644 --- a/clients/client-devops-guru/src/pagination/ListNotificationChannelsPaginator.ts +++ b/clients/client-devops-guru/src/pagination/ListNotificationChannelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DevOpsGuruClient } from "../DevOpsGuruClient"; import { DevOpsGuruPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DevOpsGuruClient, - input: ListNotificationChannelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNotificationChannelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNotificationChannels( +export const paginateListNotificationChannels: ( config: DevOpsGuruPaginationConfiguration, input: ListNotificationChannelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNotificationChannelsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof DevOpsGuruClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DevOpsGuru | DevOpsGuruClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DevOpsGuruPaginationConfiguration, + ListNotificationChannelsCommandInput, + ListNotificationChannelsCommandOutput +>(DevOpsGuruClient, ListNotificationChannelsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-devops-guru/src/pagination/ListOrganizationInsightsPaginator.ts b/clients/client-devops-guru/src/pagination/ListOrganizationInsightsPaginator.ts index fcec4bd3cb35..1d626e365518 100644 --- a/clients/client-devops-guru/src/pagination/ListOrganizationInsightsPaginator.ts +++ b/clients/client-devops-guru/src/pagination/ListOrganizationInsightsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DevOpsGuruClient } from "../DevOpsGuruClient"; import { DevOpsGuruPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DevOpsGuruClient, - input: ListOrganizationInsightsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOrganizationInsightsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOrganizationInsights( +export const paginateListOrganizationInsights: ( config: DevOpsGuruPaginationConfiguration, input: ListOrganizationInsightsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOrganizationInsightsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DevOpsGuruClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DevOpsGuru | DevOpsGuruClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DevOpsGuruPaginationConfiguration, + ListOrganizationInsightsCommandInput, + ListOrganizationInsightsCommandOutput +>(DevOpsGuruClient, ListOrganizationInsightsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-devops-guru/src/pagination/ListRecommendationsPaginator.ts b/clients/client-devops-guru/src/pagination/ListRecommendationsPaginator.ts index c4184a827966..b8d0fa50369f 100644 --- a/clients/client-devops-guru/src/pagination/ListRecommendationsPaginator.ts +++ b/clients/client-devops-guru/src/pagination/ListRecommendationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DevOpsGuruClient } from "../DevOpsGuruClient"; import { DevOpsGuruPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DevOpsGuruClient, - input: ListRecommendationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecommendationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecommendations( +export const paginateListRecommendations: ( config: DevOpsGuruPaginationConfiguration, input: ListRecommendationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecommendationsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof DevOpsGuruClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DevOpsGuru | DevOpsGuruClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DevOpsGuruPaginationConfiguration, + ListRecommendationsCommandInput, + ListRecommendationsCommandOutput +>(DevOpsGuruClient, ListRecommendationsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-devops-guru/src/pagination/SearchInsightsPaginator.ts b/clients/client-devops-guru/src/pagination/SearchInsightsPaginator.ts index aa9bfee49181..ef4ef7c7dd97 100644 --- a/clients/client-devops-guru/src/pagination/SearchInsightsPaginator.ts +++ b/clients/client-devops-guru/src/pagination/SearchInsightsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DevOpsGuruClient } from "../DevOpsGuruClient"; import { DevOpsGuruPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DevOpsGuruClient, - input: SearchInsightsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchInsightsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchInsights( +export const paginateSearchInsights: ( config: DevOpsGuruPaginationConfiguration, input: SearchInsightsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchInsightsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DevOpsGuruClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DevOpsGuru | DevOpsGuruClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DevOpsGuruPaginationConfiguration, + SearchInsightsCommandInput, + SearchInsightsCommandOutput +>(DevOpsGuruClient, SearchInsightsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-devops-guru/src/pagination/SearchOrganizationInsightsPaginator.ts b/clients/client-devops-guru/src/pagination/SearchOrganizationInsightsPaginator.ts index 4a99c610f441..8f059e75423b 100644 --- a/clients/client-devops-guru/src/pagination/SearchOrganizationInsightsPaginator.ts +++ b/clients/client-devops-guru/src/pagination/SearchOrganizationInsightsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DevOpsGuruClient } from "../DevOpsGuruClient"; import { DevOpsGuruPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DevOpsGuruClient, - input: SearchOrganizationInsightsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchOrganizationInsightsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchOrganizationInsights( +export const paginateSearchOrganizationInsights: ( config: DevOpsGuruPaginationConfiguration, input: SearchOrganizationInsightsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchOrganizationInsightsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DevOpsGuruClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DevOpsGuru | DevOpsGuruClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DevOpsGuruPaginationConfiguration, + SearchOrganizationInsightsCommandInput, + SearchOrganizationInsightsCommandOutput +>(DevOpsGuruClient, SearchOrganizationInsightsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-directory-service/package.json b/clients/client-directory-service/package.json index 4c31adc71cd8..da947e123746 100644 --- a/clients/client-directory-service/package.json +++ b/clients/client-directory-service/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-directory-service/src/pagination/DescribeClientAuthenticationSettingsPaginator.ts b/clients/client-directory-service/src/pagination/DescribeClientAuthenticationSettingsPaginator.ts index a21af4e80bd3..5b4343daa7f8 100644 --- a/clients/client-directory-service/src/pagination/DescribeClientAuthenticationSettingsPaginator.ts +++ b/clients/client-directory-service/src/pagination/DescribeClientAuthenticationSettingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DirectoryServiceClient } from "../DirectoryServiceClient"; import { DirectoryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DirectoryServiceClient, - input: DescribeClientAuthenticationSettingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClientAuthenticationSettingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClientAuthenticationSettings( +export const paginateDescribeClientAuthenticationSettings: ( config: DirectoryServicePaginationConfiguration, input: DescribeClientAuthenticationSettingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClientAuthenticationSettingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DirectoryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DirectoryService | DirectoryServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DirectoryServicePaginationConfiguration, + DescribeClientAuthenticationSettingsCommandInput, + DescribeClientAuthenticationSettingsCommandOutput +>(DirectoryServiceClient, DescribeClientAuthenticationSettingsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-directory-service/src/pagination/DescribeDirectoriesPaginator.ts b/clients/client-directory-service/src/pagination/DescribeDirectoriesPaginator.ts index 004682cc4e05..2ef14975c15f 100644 --- a/clients/client-directory-service/src/pagination/DescribeDirectoriesPaginator.ts +++ b/clients/client-directory-service/src/pagination/DescribeDirectoriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DirectoryServiceClient } from "../DirectoryServiceClient"; import { DirectoryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DirectoryServiceClient, - input: DescribeDirectoriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDirectoriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDirectories( +export const paginateDescribeDirectories: ( config: DirectoryServicePaginationConfiguration, input: DescribeDirectoriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDirectoriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DirectoryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DirectoryService | DirectoryServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DirectoryServicePaginationConfiguration, + DescribeDirectoriesCommandInput, + DescribeDirectoriesCommandOutput +>(DirectoryServiceClient, DescribeDirectoriesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-directory-service/src/pagination/DescribeDomainControllersPaginator.ts b/clients/client-directory-service/src/pagination/DescribeDomainControllersPaginator.ts index befb008c7afc..870c4d3bafd5 100644 --- a/clients/client-directory-service/src/pagination/DescribeDomainControllersPaginator.ts +++ b/clients/client-directory-service/src/pagination/DescribeDomainControllersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DirectoryServiceClient } from "../DirectoryServiceClient"; import { DirectoryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DirectoryServiceClient, - input: DescribeDomainControllersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDomainControllersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDomainControllers( +export const paginateDescribeDomainControllers: ( config: DirectoryServicePaginationConfiguration, input: DescribeDomainControllersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDomainControllersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DirectoryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DirectoryService | DirectoryServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DirectoryServicePaginationConfiguration, + DescribeDomainControllersCommandInput, + DescribeDomainControllersCommandOutput +>(DirectoryServiceClient, DescribeDomainControllersCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-directory-service/src/pagination/DescribeLDAPSSettingsPaginator.ts b/clients/client-directory-service/src/pagination/DescribeLDAPSSettingsPaginator.ts index ca5eeb005f27..fb8c6143daea 100644 --- a/clients/client-directory-service/src/pagination/DescribeLDAPSSettingsPaginator.ts +++ b/clients/client-directory-service/src/pagination/DescribeLDAPSSettingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DirectoryServiceClient } from "../DirectoryServiceClient"; import { DirectoryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DirectoryServiceClient, - input: DescribeLDAPSSettingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLDAPSSettingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLDAPSSettings( +export const paginateDescribeLDAPSSettings: ( config: DirectoryServicePaginationConfiguration, input: DescribeLDAPSSettingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLDAPSSettingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DirectoryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DirectoryService | DirectoryServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DirectoryServicePaginationConfiguration, + DescribeLDAPSSettingsCommandInput, + DescribeLDAPSSettingsCommandOutput +>(DirectoryServiceClient, DescribeLDAPSSettingsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-directory-service/src/pagination/DescribeRegionsPaginator.ts b/clients/client-directory-service/src/pagination/DescribeRegionsPaginator.ts index 560f247dceb5..4198d3e030d5 100644 --- a/clients/client-directory-service/src/pagination/DescribeRegionsPaginator.ts +++ b/clients/client-directory-service/src/pagination/DescribeRegionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DirectoryServiceClient } from "../DirectoryServiceClient"; import { DirectoryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DirectoryServiceClient, - input: DescribeRegionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRegionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRegions( +export const paginateDescribeRegions: ( config: DirectoryServicePaginationConfiguration, input: DescribeRegionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRegionsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof DirectoryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DirectoryService | DirectoryServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DirectoryServicePaginationConfiguration, + DescribeRegionsCommandInput, + DescribeRegionsCommandOutput +>(DirectoryServiceClient, DescribeRegionsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-directory-service/src/pagination/DescribeSharedDirectoriesPaginator.ts b/clients/client-directory-service/src/pagination/DescribeSharedDirectoriesPaginator.ts index 4e9cebc1ed0b..aa870d892109 100644 --- a/clients/client-directory-service/src/pagination/DescribeSharedDirectoriesPaginator.ts +++ b/clients/client-directory-service/src/pagination/DescribeSharedDirectoriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DirectoryServiceClient } from "../DirectoryServiceClient"; import { DirectoryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DirectoryServiceClient, - input: DescribeSharedDirectoriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSharedDirectoriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSharedDirectories( +export const paginateDescribeSharedDirectories: ( config: DirectoryServicePaginationConfiguration, input: DescribeSharedDirectoriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSharedDirectoriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DirectoryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DirectoryService | DirectoryServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DirectoryServicePaginationConfiguration, + DescribeSharedDirectoriesCommandInput, + DescribeSharedDirectoriesCommandOutput +>(DirectoryServiceClient, DescribeSharedDirectoriesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-directory-service/src/pagination/DescribeSnapshotsPaginator.ts b/clients/client-directory-service/src/pagination/DescribeSnapshotsPaginator.ts index 6ad83b3aeddd..87347858394b 100644 --- a/clients/client-directory-service/src/pagination/DescribeSnapshotsPaginator.ts +++ b/clients/client-directory-service/src/pagination/DescribeSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DirectoryServiceClient } from "../DirectoryServiceClient"; import { DirectoryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DirectoryServiceClient, - input: DescribeSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSnapshots( +export const paginateDescribeSnapshots: ( config: DirectoryServicePaginationConfiguration, input: DescribeSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSnapshotsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DirectoryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DirectoryService | DirectoryServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DirectoryServicePaginationConfiguration, + DescribeSnapshotsCommandInput, + DescribeSnapshotsCommandOutput +>(DirectoryServiceClient, DescribeSnapshotsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-directory-service/src/pagination/DescribeTrustsPaginator.ts b/clients/client-directory-service/src/pagination/DescribeTrustsPaginator.ts index 5dc24d39163e..e7c0a34397e4 100644 --- a/clients/client-directory-service/src/pagination/DescribeTrustsPaginator.ts +++ b/clients/client-directory-service/src/pagination/DescribeTrustsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DirectoryServiceClient } from "../DirectoryServiceClient"; import { DirectoryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DirectoryServiceClient, - input: DescribeTrustsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTrustsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTrusts( +export const paginateDescribeTrusts: ( config: DirectoryServicePaginationConfiguration, input: DescribeTrustsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTrustsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DirectoryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DirectoryService | DirectoryServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DirectoryServicePaginationConfiguration, + DescribeTrustsCommandInput, + DescribeTrustsCommandOutput +>(DirectoryServiceClient, DescribeTrustsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-directory-service/src/pagination/DescribeUpdateDirectoryPaginator.ts b/clients/client-directory-service/src/pagination/DescribeUpdateDirectoryPaginator.ts index c157be8d4429..eea32b9a53b2 100644 --- a/clients/client-directory-service/src/pagination/DescribeUpdateDirectoryPaginator.ts +++ b/clients/client-directory-service/src/pagination/DescribeUpdateDirectoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { DirectoryServiceClient } from "../DirectoryServiceClient"; import { DirectoryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DirectoryServiceClient, - input: DescribeUpdateDirectoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeUpdateDirectoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeUpdateDirectory( +export const paginateDescribeUpdateDirectory: ( config: DirectoryServicePaginationConfiguration, input: DescribeUpdateDirectoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeUpdateDirectoryCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof DirectoryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DirectoryService | DirectoryServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DirectoryServicePaginationConfiguration, + DescribeUpdateDirectoryCommandInput, + DescribeUpdateDirectoryCommandOutput +>(DirectoryServiceClient, DescribeUpdateDirectoryCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-directory-service/src/pagination/ListCertificatesPaginator.ts b/clients/client-directory-service/src/pagination/ListCertificatesPaginator.ts index 85886af26824..55d7a6c285e9 100644 --- a/clients/client-directory-service/src/pagination/ListCertificatesPaginator.ts +++ b/clients/client-directory-service/src/pagination/ListCertificatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DirectoryServiceClient } from "../DirectoryServiceClient"; import { DirectoryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DirectoryServiceClient, - input: ListCertificatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCertificatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCertificates( +export const paginateListCertificates: ( config: DirectoryServicePaginationConfiguration, input: ListCertificatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCertificatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DirectoryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DirectoryService | DirectoryServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DirectoryServicePaginationConfiguration, + ListCertificatesCommandInput, + ListCertificatesCommandOutput +>(DirectoryServiceClient, ListCertificatesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-directory-service/src/pagination/ListIpRoutesPaginator.ts b/clients/client-directory-service/src/pagination/ListIpRoutesPaginator.ts index fa2dba7de159..b6bdd6404a83 100644 --- a/clients/client-directory-service/src/pagination/ListIpRoutesPaginator.ts +++ b/clients/client-directory-service/src/pagination/ListIpRoutesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DirectoryServiceClient } from "../DirectoryServiceClient"; import { DirectoryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DirectoryServiceClient, - input: ListIpRoutesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIpRoutesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIpRoutes( +export const paginateListIpRoutes: ( config: DirectoryServicePaginationConfiguration, input: ListIpRoutesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIpRoutesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DirectoryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DirectoryService | DirectoryServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DirectoryServicePaginationConfiguration, + ListIpRoutesCommandInput, + ListIpRoutesCommandOutput +>(DirectoryServiceClient, ListIpRoutesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-directory-service/src/pagination/ListLogSubscriptionsPaginator.ts b/clients/client-directory-service/src/pagination/ListLogSubscriptionsPaginator.ts index 77fa8b6e9706..7c7b492cd8f3 100644 --- a/clients/client-directory-service/src/pagination/ListLogSubscriptionsPaginator.ts +++ b/clients/client-directory-service/src/pagination/ListLogSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DirectoryServiceClient } from "../DirectoryServiceClient"; import { DirectoryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DirectoryServiceClient, - input: ListLogSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLogSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLogSubscriptions( +export const paginateListLogSubscriptions: ( config: DirectoryServicePaginationConfiguration, input: ListLogSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLogSubscriptionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DirectoryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DirectoryService | DirectoryServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DirectoryServicePaginationConfiguration, + ListLogSubscriptionsCommandInput, + ListLogSubscriptionsCommandOutput +>(DirectoryServiceClient, ListLogSubscriptionsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-directory-service/src/pagination/ListSchemaExtensionsPaginator.ts b/clients/client-directory-service/src/pagination/ListSchemaExtensionsPaginator.ts index 7e94de068500..ef739fa5265a 100644 --- a/clients/client-directory-service/src/pagination/ListSchemaExtensionsPaginator.ts +++ b/clients/client-directory-service/src/pagination/ListSchemaExtensionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DirectoryServiceClient } from "../DirectoryServiceClient"; import { DirectoryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DirectoryServiceClient, - input: ListSchemaExtensionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSchemaExtensionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSchemaExtensions( +export const paginateListSchemaExtensions: ( config: DirectoryServicePaginationConfiguration, input: ListSchemaExtensionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSchemaExtensionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DirectoryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DirectoryService | DirectoryServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DirectoryServicePaginationConfiguration, + ListSchemaExtensionsCommandInput, + ListSchemaExtensionsCommandOutput +>(DirectoryServiceClient, ListSchemaExtensionsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-directory-service/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-directory-service/src/pagination/ListTagsForResourcePaginator.ts index 88b34239bd85..05ca2ebd2ff6 100644 --- a/clients/client-directory-service/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-directory-service/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DirectoryServiceClient } from "../DirectoryServiceClient"; import { DirectoryServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DirectoryServiceClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: DirectoryServicePaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DirectoryServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DirectoryService | DirectoryServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DirectoryServicePaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(DirectoryServiceClient, ListTagsForResourceCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-docdb-elastic/src/pagination/ListClusterSnapshotsPaginator.ts b/clients/client-docdb-elastic/src/pagination/ListClusterSnapshotsPaginator.ts index 6dfe31fc7c86..ad28ce48fa46 100644 --- a/clients/client-docdb-elastic/src/pagination/ListClusterSnapshotsPaginator.ts +++ b/clients/client-docdb-elastic/src/pagination/ListClusterSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBElasticClient } from "../DocDBElasticClient"; import { DocDBElasticPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBElasticClient, - input: ListClusterSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClusterSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClusterSnapshots( +export const paginateListClusterSnapshots: ( config: DocDBElasticPaginationConfiguration, input: ListClusterSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClusterSnapshotsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DocDBElasticClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDBElastic | DocDBElasticClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBElasticPaginationConfiguration, + ListClusterSnapshotsCommandInput, + ListClusterSnapshotsCommandOutput +>(DocDBElasticClient, ListClusterSnapshotsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-docdb-elastic/src/pagination/ListClustersPaginator.ts b/clients/client-docdb-elastic/src/pagination/ListClustersPaginator.ts index 469d5a078bfc..b9575dd30641 100644 --- a/clients/client-docdb-elastic/src/pagination/ListClustersPaginator.ts +++ b/clients/client-docdb-elastic/src/pagination/ListClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBElasticClient } from "../DocDBElasticClient"; import { DocDBElasticPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBElasticClient, - input: ListClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClusters( +export const paginateListClusters: ( config: DocDBElasticPaginationConfiguration, input: ListClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClustersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DocDBElasticClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDBElastic | DocDBElasticClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBElasticPaginationConfiguration, + ListClustersCommandInput, + ListClustersCommandOutput +>(DocDBElasticClient, ListClustersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-docdb/package.json b/clients/client-docdb/package.json index 4a6fdc1f1ba7..e39ece3c09dc 100644 --- a/clients/client-docdb/package.json +++ b/clients/client-docdb/package.json @@ -35,6 +35,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-docdb/src/pagination/DescribeCertificatesPaginator.ts b/clients/client-docdb/src/pagination/DescribeCertificatesPaginator.ts index 9e685d26eab5..db27584eb887 100644 --- a/clients/client-docdb/src/pagination/DescribeCertificatesPaginator.ts +++ b/clients/client-docdb/src/pagination/DescribeCertificatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBClient } from "../DocDBClient"; import { DocDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBClient, - input: DescribeCertificatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCertificatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCertificates( +export const paginateDescribeCertificates: ( config: DocDBPaginationConfiguration, input: DescribeCertificatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCertificatesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DocDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDB | DocDBClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBPaginationConfiguration, + DescribeCertificatesCommandInput, + DescribeCertificatesCommandOutput +>(DocDBClient, DescribeCertificatesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-docdb/src/pagination/DescribeDBClusterParameterGroupsPaginator.ts b/clients/client-docdb/src/pagination/DescribeDBClusterParameterGroupsPaginator.ts index 24412d98a207..82eabf7e9037 100644 --- a/clients/client-docdb/src/pagination/DescribeDBClusterParameterGroupsPaginator.ts +++ b/clients/client-docdb/src/pagination/DescribeDBClusterParameterGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBClient } from "../DocDBClient"; import { DocDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBClient, - input: DescribeDBClusterParameterGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClusterParameterGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusterParameterGroups( +export const paginateDescribeDBClusterParameterGroups: ( config: DocDBPaginationConfiguration, input: DescribeDBClusterParameterGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClusterParameterGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DocDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDB | DocDBClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBPaginationConfiguration, + DescribeDBClusterParameterGroupsCommandInput, + DescribeDBClusterParameterGroupsCommandOutput +>(DocDBClient, DescribeDBClusterParameterGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-docdb/src/pagination/DescribeDBClusterParametersPaginator.ts b/clients/client-docdb/src/pagination/DescribeDBClusterParametersPaginator.ts index 77b74c942d2c..5f0712c242da 100644 --- a/clients/client-docdb/src/pagination/DescribeDBClusterParametersPaginator.ts +++ b/clients/client-docdb/src/pagination/DescribeDBClusterParametersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBClient } from "../DocDBClient"; import { DocDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBClient, - input: DescribeDBClusterParametersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClusterParametersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusterParameters( +export const paginateDescribeDBClusterParameters: ( config: DocDBPaginationConfiguration, input: DescribeDBClusterParametersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClusterParametersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DocDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDB | DocDBClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBPaginationConfiguration, + DescribeDBClusterParametersCommandInput, + DescribeDBClusterParametersCommandOutput +>(DocDBClient, DescribeDBClusterParametersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-docdb/src/pagination/DescribeDBClusterSnapshotsPaginator.ts b/clients/client-docdb/src/pagination/DescribeDBClusterSnapshotsPaginator.ts index 260328da4b70..7741ccbc2bb9 100644 --- a/clients/client-docdb/src/pagination/DescribeDBClusterSnapshotsPaginator.ts +++ b/clients/client-docdb/src/pagination/DescribeDBClusterSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBClient } from "../DocDBClient"; import { DocDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBClient, - input: DescribeDBClusterSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClusterSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusterSnapshots( +export const paginateDescribeDBClusterSnapshots: ( config: DocDBPaginationConfiguration, input: DescribeDBClusterSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClusterSnapshotsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DocDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDB | DocDBClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBPaginationConfiguration, + DescribeDBClusterSnapshotsCommandInput, + DescribeDBClusterSnapshotsCommandOutput +>(DocDBClient, DescribeDBClusterSnapshotsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-docdb/src/pagination/DescribeDBClustersPaginator.ts b/clients/client-docdb/src/pagination/DescribeDBClustersPaginator.ts index a698f9db34b3..df3fa09cfc73 100644 --- a/clients/client-docdb/src/pagination/DescribeDBClustersPaginator.ts +++ b/clients/client-docdb/src/pagination/DescribeDBClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBClient } from "../DocDBClient"; import { DocDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBClient, - input: DescribeDBClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusters( +export const paginateDescribeDBClusters: ( config: DocDBPaginationConfiguration, input: DescribeDBClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClustersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DocDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDB | DocDBClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBPaginationConfiguration, + DescribeDBClustersCommandInput, + DescribeDBClustersCommandOutput +>(DocDBClient, DescribeDBClustersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-docdb/src/pagination/DescribeDBEngineVersionsPaginator.ts b/clients/client-docdb/src/pagination/DescribeDBEngineVersionsPaginator.ts index a5ee7251adb3..70a4237a2b0f 100644 --- a/clients/client-docdb/src/pagination/DescribeDBEngineVersionsPaginator.ts +++ b/clients/client-docdb/src/pagination/DescribeDBEngineVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBClient } from "../DocDBClient"; import { DocDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBClient, - input: DescribeDBEngineVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBEngineVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBEngineVersions( +export const paginateDescribeDBEngineVersions: ( config: DocDBPaginationConfiguration, input: DescribeDBEngineVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBEngineVersionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DocDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDB | DocDBClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBPaginationConfiguration, + DescribeDBEngineVersionsCommandInput, + DescribeDBEngineVersionsCommandOutput +>(DocDBClient, DescribeDBEngineVersionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-docdb/src/pagination/DescribeDBInstancesPaginator.ts b/clients/client-docdb/src/pagination/DescribeDBInstancesPaginator.ts index 7da74b4ae38c..5448c47ae853 100644 --- a/clients/client-docdb/src/pagination/DescribeDBInstancesPaginator.ts +++ b/clients/client-docdb/src/pagination/DescribeDBInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBClient } from "../DocDBClient"; import { DocDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBClient, - input: DescribeDBInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBInstances( +export const paginateDescribeDBInstances: ( config: DocDBPaginationConfiguration, input: DescribeDBInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBInstancesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DocDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDB | DocDBClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBPaginationConfiguration, + DescribeDBInstancesCommandInput, + DescribeDBInstancesCommandOutput +>(DocDBClient, DescribeDBInstancesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-docdb/src/pagination/DescribeDBSubnetGroupsPaginator.ts b/clients/client-docdb/src/pagination/DescribeDBSubnetGroupsPaginator.ts index 9b5f43429363..4b80cc0479fe 100644 --- a/clients/client-docdb/src/pagination/DescribeDBSubnetGroupsPaginator.ts +++ b/clients/client-docdb/src/pagination/DescribeDBSubnetGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBClient } from "../DocDBClient"; import { DocDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBClient, - input: DescribeDBSubnetGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBSubnetGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBSubnetGroups( +export const paginateDescribeDBSubnetGroups: ( config: DocDBPaginationConfiguration, input: DescribeDBSubnetGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBSubnetGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DocDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDB | DocDBClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBPaginationConfiguration, + DescribeDBSubnetGroupsCommandInput, + DescribeDBSubnetGroupsCommandOutput +>(DocDBClient, DescribeDBSubnetGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-docdb/src/pagination/DescribeEventSubscriptionsPaginator.ts b/clients/client-docdb/src/pagination/DescribeEventSubscriptionsPaginator.ts index 60bb18b7e125..a797d44dbeef 100644 --- a/clients/client-docdb/src/pagination/DescribeEventSubscriptionsPaginator.ts +++ b/clients/client-docdb/src/pagination/DescribeEventSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBClient } from "../DocDBClient"; import { DocDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBClient, - input: DescribeEventSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEventSubscriptions( +export const paginateDescribeEventSubscriptions: ( config: DocDBPaginationConfiguration, input: DescribeEventSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventSubscriptionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DocDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDB | DocDBClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBPaginationConfiguration, + DescribeEventSubscriptionsCommandInput, + DescribeEventSubscriptionsCommandOutput +>(DocDBClient, DescribeEventSubscriptionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-docdb/src/pagination/DescribeEventsPaginator.ts b/clients/client-docdb/src/pagination/DescribeEventsPaginator.ts index b7402206f5b7..4d2dbcf31de5 100644 --- a/clients/client-docdb/src/pagination/DescribeEventsPaginator.ts +++ b/clients/client-docdb/src/pagination/DescribeEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBClient } from "../DocDBClient"; import { DocDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBClient, - input: DescribeEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEvents( +export const paginateDescribeEvents: ( config: DocDBPaginationConfiguration, input: DescribeEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DocDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDB | DocDBClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBPaginationConfiguration, + DescribeEventsCommandInput, + DescribeEventsCommandOutput +>(DocDBClient, DescribeEventsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-docdb/src/pagination/DescribeGlobalClustersPaginator.ts b/clients/client-docdb/src/pagination/DescribeGlobalClustersPaginator.ts index 837355374814..54c1cc50cc8b 100644 --- a/clients/client-docdb/src/pagination/DescribeGlobalClustersPaginator.ts +++ b/clients/client-docdb/src/pagination/DescribeGlobalClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBClient } from "../DocDBClient"; import { DocDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBClient, - input: DescribeGlobalClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeGlobalClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeGlobalClusters( +export const paginateDescribeGlobalClusters: ( config: DocDBPaginationConfiguration, input: DescribeGlobalClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeGlobalClustersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DocDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDB | DocDBClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBPaginationConfiguration, + DescribeGlobalClustersCommandInput, + DescribeGlobalClustersCommandOutput +>(DocDBClient, DescribeGlobalClustersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-docdb/src/pagination/DescribeOrderableDBInstanceOptionsPaginator.ts b/clients/client-docdb/src/pagination/DescribeOrderableDBInstanceOptionsPaginator.ts index b84447286c3c..ffd55a40b643 100644 --- a/clients/client-docdb/src/pagination/DescribeOrderableDBInstanceOptionsPaginator.ts +++ b/clients/client-docdb/src/pagination/DescribeOrderableDBInstanceOptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBClient } from "../DocDBClient"; import { DocDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBClient, - input: DescribeOrderableDBInstanceOptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOrderableDBInstanceOptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOrderableDBInstanceOptions( +export const paginateDescribeOrderableDBInstanceOptions: ( config: DocDBPaginationConfiguration, input: DescribeOrderableDBInstanceOptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOrderableDBInstanceOptionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DocDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDB | DocDBClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBPaginationConfiguration, + DescribeOrderableDBInstanceOptionsCommandInput, + DescribeOrderableDBInstanceOptionsCommandOutput +>(DocDBClient, DescribeOrderableDBInstanceOptionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-docdb/src/pagination/DescribePendingMaintenanceActionsPaginator.ts b/clients/client-docdb/src/pagination/DescribePendingMaintenanceActionsPaginator.ts index 505204cd7f71..d203ed76751f 100644 --- a/clients/client-docdb/src/pagination/DescribePendingMaintenanceActionsPaginator.ts +++ b/clients/client-docdb/src/pagination/DescribePendingMaintenanceActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DocDBClient } from "../DocDBClient"; import { DocDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DocDBClient, - input: DescribePendingMaintenanceActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePendingMaintenanceActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePendingMaintenanceActions( +export const paginateDescribePendingMaintenanceActions: ( config: DocDBPaginationConfiguration, input: DescribePendingMaintenanceActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePendingMaintenanceActionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof DocDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DocDB | DocDBClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DocDBPaginationConfiguration, + DescribePendingMaintenanceActionsCommandInput, + DescribePendingMaintenanceActionsCommandOutput +>(DocDBClient, DescribePendingMaintenanceActionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-drs/src/pagination/DescribeJobLogItemsPaginator.ts b/clients/client-drs/src/pagination/DescribeJobLogItemsPaginator.ts index d3dca40d4479..50adbb9d56e1 100644 --- a/clients/client-drs/src/pagination/DescribeJobLogItemsPaginator.ts +++ b/clients/client-drs/src/pagination/DescribeJobLogItemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DrsClient } from "../DrsClient"; import { DrsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DrsClient, - input: DescribeJobLogItemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeJobLogItemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeJobLogItems( +export const paginateDescribeJobLogItems: ( config: DrsPaginationConfiguration, input: DescribeJobLogItemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeJobLogItemsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DrsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Drs | DrsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DrsPaginationConfiguration, + DescribeJobLogItemsCommandInput, + DescribeJobLogItemsCommandOutput +>(DrsClient, DescribeJobLogItemsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-drs/src/pagination/DescribeJobsPaginator.ts b/clients/client-drs/src/pagination/DescribeJobsPaginator.ts index 35a154fb4687..cb989b618fbe 100644 --- a/clients/client-drs/src/pagination/DescribeJobsPaginator.ts +++ b/clients/client-drs/src/pagination/DescribeJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DrsClient } from "../DrsClient"; import { DrsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DrsClient, - input: DescribeJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeJobs( +export const paginateDescribeJobs: ( config: DrsPaginationConfiguration, input: DescribeJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DrsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Drs | DrsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DrsPaginationConfiguration, + DescribeJobsCommandInput, + DescribeJobsCommandOutput +>(DrsClient, DescribeJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-drs/src/pagination/DescribeLaunchConfigurationTemplatesPaginator.ts b/clients/client-drs/src/pagination/DescribeLaunchConfigurationTemplatesPaginator.ts index e29ce6f2aa02..ee5e91e01941 100644 --- a/clients/client-drs/src/pagination/DescribeLaunchConfigurationTemplatesPaginator.ts +++ b/clients/client-drs/src/pagination/DescribeLaunchConfigurationTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DrsClient } from "../DrsClient"; import { DrsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DrsClient, - input: DescribeLaunchConfigurationTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLaunchConfigurationTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLaunchConfigurationTemplates( +export const paginateDescribeLaunchConfigurationTemplates: ( config: DrsPaginationConfiguration, input: DescribeLaunchConfigurationTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLaunchConfigurationTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DrsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Drs | DrsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DrsPaginationConfiguration, + DescribeLaunchConfigurationTemplatesCommandInput, + DescribeLaunchConfigurationTemplatesCommandOutput +>(DrsClient, DescribeLaunchConfigurationTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-drs/src/pagination/DescribeRecoveryInstancesPaginator.ts b/clients/client-drs/src/pagination/DescribeRecoveryInstancesPaginator.ts index df9f71704e15..909c2d92bcfb 100644 --- a/clients/client-drs/src/pagination/DescribeRecoveryInstancesPaginator.ts +++ b/clients/client-drs/src/pagination/DescribeRecoveryInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DrsClient } from "../DrsClient"; import { DrsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DrsClient, - input: DescribeRecoveryInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRecoveryInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRecoveryInstances( +export const paginateDescribeRecoveryInstances: ( config: DrsPaginationConfiguration, input: DescribeRecoveryInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRecoveryInstancesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DrsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Drs | DrsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DrsPaginationConfiguration, + DescribeRecoveryInstancesCommandInput, + DescribeRecoveryInstancesCommandOutput +>(DrsClient, DescribeRecoveryInstancesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-drs/src/pagination/DescribeRecoverySnapshotsPaginator.ts b/clients/client-drs/src/pagination/DescribeRecoverySnapshotsPaginator.ts index 6f83d29cb6aa..c8e6a99a6e09 100644 --- a/clients/client-drs/src/pagination/DescribeRecoverySnapshotsPaginator.ts +++ b/clients/client-drs/src/pagination/DescribeRecoverySnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DrsClient } from "../DrsClient"; import { DrsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DrsClient, - input: DescribeRecoverySnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRecoverySnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRecoverySnapshots( +export const paginateDescribeRecoverySnapshots: ( config: DrsPaginationConfiguration, input: DescribeRecoverySnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRecoverySnapshotsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DrsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Drs | DrsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DrsPaginationConfiguration, + DescribeRecoverySnapshotsCommandInput, + DescribeRecoverySnapshotsCommandOutput +>(DrsClient, DescribeRecoverySnapshotsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-drs/src/pagination/DescribeReplicationConfigurationTemplatesPaginator.ts b/clients/client-drs/src/pagination/DescribeReplicationConfigurationTemplatesPaginator.ts index 59b6bf8abf8b..541a2c31899b 100644 --- a/clients/client-drs/src/pagination/DescribeReplicationConfigurationTemplatesPaginator.ts +++ b/clients/client-drs/src/pagination/DescribeReplicationConfigurationTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DrsClient } from "../DrsClient"; import { DrsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DrsClient, - input: DescribeReplicationConfigurationTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplicationConfigurationTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplicationConfigurationTemplates( +export const paginateDescribeReplicationConfigurationTemplates: ( config: DrsPaginationConfiguration, input: DescribeReplicationConfigurationTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplicationConfigurationTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DrsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Drs | DrsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DrsPaginationConfiguration, + DescribeReplicationConfigurationTemplatesCommandInput, + DescribeReplicationConfigurationTemplatesCommandOutput +>(DrsClient, DescribeReplicationConfigurationTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-drs/src/pagination/DescribeSourceNetworksPaginator.ts b/clients/client-drs/src/pagination/DescribeSourceNetworksPaginator.ts index 33f0fbc70857..81441e77869e 100644 --- a/clients/client-drs/src/pagination/DescribeSourceNetworksPaginator.ts +++ b/clients/client-drs/src/pagination/DescribeSourceNetworksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DrsClient } from "../DrsClient"; import { DrsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DrsClient, - input: DescribeSourceNetworksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSourceNetworksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSourceNetworks( +export const paginateDescribeSourceNetworks: ( config: DrsPaginationConfiguration, input: DescribeSourceNetworksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSourceNetworksCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DrsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Drs | DrsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DrsPaginationConfiguration, + DescribeSourceNetworksCommandInput, + DescribeSourceNetworksCommandOutput +>(DrsClient, DescribeSourceNetworksCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-drs/src/pagination/DescribeSourceServersPaginator.ts b/clients/client-drs/src/pagination/DescribeSourceServersPaginator.ts index cbc9b44e4a5d..04495be5e570 100644 --- a/clients/client-drs/src/pagination/DescribeSourceServersPaginator.ts +++ b/clients/client-drs/src/pagination/DescribeSourceServersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DrsClient } from "../DrsClient"; import { DrsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DrsClient, - input: DescribeSourceServersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSourceServersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSourceServers( +export const paginateDescribeSourceServers: ( config: DrsPaginationConfiguration, input: DescribeSourceServersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSourceServersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DrsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Drs | DrsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DrsPaginationConfiguration, + DescribeSourceServersCommandInput, + DescribeSourceServersCommandOutput +>(DrsClient, DescribeSourceServersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-drs/src/pagination/ListExtensibleSourceServersPaginator.ts b/clients/client-drs/src/pagination/ListExtensibleSourceServersPaginator.ts index b366fcbc3aa9..ccc04b86dcbd 100644 --- a/clients/client-drs/src/pagination/ListExtensibleSourceServersPaginator.ts +++ b/clients/client-drs/src/pagination/ListExtensibleSourceServersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DrsClient } from "../DrsClient"; import { DrsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DrsClient, - input: ListExtensibleSourceServersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExtensibleSourceServersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExtensibleSourceServers( +export const paginateListExtensibleSourceServers: ( config: DrsPaginationConfiguration, input: ListExtensibleSourceServersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExtensibleSourceServersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DrsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Drs | DrsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DrsPaginationConfiguration, + ListExtensibleSourceServersCommandInput, + ListExtensibleSourceServersCommandOutput +>(DrsClient, ListExtensibleSourceServersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-drs/src/pagination/ListLaunchActionsPaginator.ts b/clients/client-drs/src/pagination/ListLaunchActionsPaginator.ts index 52c6e585d5f7..c810295c7008 100644 --- a/clients/client-drs/src/pagination/ListLaunchActionsPaginator.ts +++ b/clients/client-drs/src/pagination/ListLaunchActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DrsClient } from "../DrsClient"; import { DrsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DrsClient, - input: ListLaunchActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLaunchActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLaunchActions( +export const paginateListLaunchActions: ( config: DrsPaginationConfiguration, input: ListLaunchActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLaunchActionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DrsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Drs | DrsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DrsPaginationConfiguration, + ListLaunchActionsCommandInput, + ListLaunchActionsCommandOutput +>(DrsClient, ListLaunchActionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-drs/src/pagination/ListStagingAccountsPaginator.ts b/clients/client-drs/src/pagination/ListStagingAccountsPaginator.ts index e2b76305f0fb..b4094ae6e49f 100644 --- a/clients/client-drs/src/pagination/ListStagingAccountsPaginator.ts +++ b/clients/client-drs/src/pagination/ListStagingAccountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DrsClient } from "../DrsClient"; import { DrsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DrsClient, - input: ListStagingAccountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStagingAccountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStagingAccounts( +export const paginateListStagingAccounts: ( config: DrsPaginationConfiguration, input: ListStagingAccountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStagingAccountsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof DrsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Drs | DrsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DrsPaginationConfiguration, + ListStagingAccountsCommandInput, + ListStagingAccountsCommandOutput +>(DrsClient, ListStagingAccountsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-dynamodb/src/pagination/ListContributorInsightsPaginator.ts b/clients/client-dynamodb/src/pagination/ListContributorInsightsPaginator.ts index 7c4d4d6ed5a6..a7ee6b7a5c87 100644 --- a/clients/client-dynamodb/src/pagination/ListContributorInsightsPaginator.ts +++ b/clients/client-dynamodb/src/pagination/ListContributorInsightsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { DynamoDBClient } from "../DynamoDBClient"; import { DynamoDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DynamoDBClient, - input: ListContributorInsightsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContributorInsightsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContributorInsights( +export const paginateListContributorInsights: ( config: DynamoDBPaginationConfiguration, input: ListContributorInsightsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContributorInsightsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DynamoDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DynamoDB | DynamoDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DynamoDBPaginationConfiguration, + ListContributorInsightsCommandInput, + ListContributorInsightsCommandOutput +>(DynamoDBClient, ListContributorInsightsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-dynamodb/src/pagination/ListExportsPaginator.ts b/clients/client-dynamodb/src/pagination/ListExportsPaginator.ts index 3eaa7b45fded..9021ea58aacc 100644 --- a/clients/client-dynamodb/src/pagination/ListExportsPaginator.ts +++ b/clients/client-dynamodb/src/pagination/ListExportsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListExportsCommand, ListExportsCommandInput, ListExportsCommandOutput } from "../commands/ListExportsCommand"; import { DynamoDBClient } from "../DynamoDBClient"; import { DynamoDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DynamoDBClient, - input: ListExportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExports( +export const paginateListExports: ( config: DynamoDBPaginationConfiguration, input: ListExportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExportsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof DynamoDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DynamoDB | DynamoDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DynamoDBPaginationConfiguration, + ListExportsCommandInput, + ListExportsCommandOutput +>(DynamoDBClient, ListExportsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-dynamodb/src/pagination/ListImportsPaginator.ts b/clients/client-dynamodb/src/pagination/ListImportsPaginator.ts index 6d43a9b2c204..7044edda3f55 100644 --- a/clients/client-dynamodb/src/pagination/ListImportsPaginator.ts +++ b/clients/client-dynamodb/src/pagination/ListImportsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListImportsCommand, ListImportsCommandInput, ListImportsCommandOutput } from "../commands/ListImportsCommand"; import { DynamoDBClient } from "../DynamoDBClient"; import { DynamoDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DynamoDBClient, - input: ListImportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImports( +export const paginateListImports: ( config: DynamoDBPaginationConfiguration, input: ListImportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImportsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof DynamoDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DynamoDB | DynamoDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DynamoDBPaginationConfiguration, + ListImportsCommandInput, + ListImportsCommandOutput +>(DynamoDBClient, ListImportsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-dynamodb/src/pagination/ListTablesPaginator.ts b/clients/client-dynamodb/src/pagination/ListTablesPaginator.ts index 1646f74260b5..bcf6bdb13703 100644 --- a/clients/client-dynamodb/src/pagination/ListTablesPaginator.ts +++ b/clients/client-dynamodb/src/pagination/ListTablesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTablesCommand, ListTablesCommandInput, ListTablesCommandOutput } from "../commands/ListTablesCommand"; import { DynamoDBClient } from "../DynamoDBClient"; import { DynamoDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DynamoDBClient, - input: ListTablesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTablesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTables( +export const paginateListTables: ( config: DynamoDBPaginationConfiguration, input: ListTablesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.ExclusiveStartTableName - let token: typeof input.ExclusiveStartTableName | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTablesCommandOutput; - while (hasNext) { - input.ExclusiveStartTableName = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DynamoDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DynamoDB | DynamoDBClient"); - } - yield page; - const prevToken = token; - token = page.LastEvaluatedTableName; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DynamoDBPaginationConfiguration, + ListTablesCommandInput, + ListTablesCommandOutput +>(DynamoDBClient, ListTablesCommand, "ExclusiveStartTableName", "LastEvaluatedTableName", "Limit"); diff --git a/clients/client-dynamodb/src/pagination/QueryPaginator.ts b/clients/client-dynamodb/src/pagination/QueryPaginator.ts index 53f22e272ebf..da685a5d70df 100644 --- a/clients/client-dynamodb/src/pagination/QueryPaginator.ts +++ b/clients/client-dynamodb/src/pagination/QueryPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { QueryCommand, QueryCommandInput, QueryCommandOutput } from "../commands/QueryCommand"; import { DynamoDBClient } from "../DynamoDBClient"; import { DynamoDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DynamoDBClient, - input: QueryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new QueryCommand(input), ...args); -}; /** * @public */ -export async function* paginateQuery( +export const paginateQuery: ( config: DynamoDBPaginationConfiguration, input: QueryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.ExclusiveStartKey - let token: typeof input.ExclusiveStartKey | undefined = config.startingToken || undefined; - let hasNext = true; - let page: QueryCommandOutput; - while (hasNext) { - input.ExclusiveStartKey = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DynamoDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DynamoDB | DynamoDBClient"); - } - yield page; - const prevToken = token; - token = page.LastEvaluatedKey; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DynamoDBPaginationConfiguration, + QueryCommandInput, + QueryCommandOutput +>(DynamoDBClient, QueryCommand, "ExclusiveStartKey", "LastEvaluatedKey", "Limit"); diff --git a/clients/client-dynamodb/src/pagination/ScanPaginator.ts b/clients/client-dynamodb/src/pagination/ScanPaginator.ts index 4398fc305d33..7f578fab3aeb 100644 --- a/clients/client-dynamodb/src/pagination/ScanPaginator.ts +++ b/clients/client-dynamodb/src/pagination/ScanPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ScanCommand, ScanCommandInput, ScanCommandOutput } from "../commands/ScanCommand"; import { DynamoDBClient } from "../DynamoDBClient"; import { DynamoDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: DynamoDBClient, - input: ScanCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ScanCommand(input), ...args); -}; /** * @public */ -export async function* paginateScan( +export const paginateScan: ( config: DynamoDBPaginationConfiguration, input: ScanCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.ExclusiveStartKey - let token: typeof input.ExclusiveStartKey | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ScanCommandOutput; - while (hasNext) { - input.ExclusiveStartKey = token; - input["Limit"] = config.pageSize; - if (config.client instanceof DynamoDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected DynamoDB | DynamoDBClient"); - } - yield page; - const prevToken = token; - token = page.LastEvaluatedKey; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + DynamoDBPaginationConfiguration, + ScanCommandInput, + ScanCommandOutput +>(DynamoDBClient, ScanCommand, "ExclusiveStartKey", "LastEvaluatedKey", "Limit"); diff --git a/clients/client-ebs/src/pagination/ListChangedBlocksPaginator.ts b/clients/client-ebs/src/pagination/ListChangedBlocksPaginator.ts index 5122739a2b60..b92ea307326a 100644 --- a/clients/client-ebs/src/pagination/ListChangedBlocksPaginator.ts +++ b/clients/client-ebs/src/pagination/ListChangedBlocksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EBSClient } from "../EBSClient"; import { EBSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EBSClient, - input: ListChangedBlocksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChangedBlocksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChangedBlocks( +export const paginateListChangedBlocks: ( config: EBSPaginationConfiguration, input: ListChangedBlocksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChangedBlocksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EBSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EBS | EBSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EBSPaginationConfiguration, + ListChangedBlocksCommandInput, + ListChangedBlocksCommandOutput +>(EBSClient, ListChangedBlocksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ebs/src/pagination/ListSnapshotBlocksPaginator.ts b/clients/client-ebs/src/pagination/ListSnapshotBlocksPaginator.ts index cfb7e5939f79..969c19abf3c7 100644 --- a/clients/client-ebs/src/pagination/ListSnapshotBlocksPaginator.ts +++ b/clients/client-ebs/src/pagination/ListSnapshotBlocksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EBSClient } from "../EBSClient"; import { EBSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EBSClient, - input: ListSnapshotBlocksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSnapshotBlocksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSnapshotBlocks( +export const paginateListSnapshotBlocks: ( config: EBSPaginationConfiguration, input: ListSnapshotBlocksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSnapshotBlocksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EBSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EBS | EBSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EBSPaginationConfiguration, + ListSnapshotBlocksCommandInput, + ListSnapshotBlocksCommandOutput +>(EBSClient, ListSnapshotBlocksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/package.json b/clients/client-ec2/package.json index 739a8f701108..2b5bc7447365 100644 --- a/clients/client-ec2/package.json +++ b/clients/client-ec2/package.json @@ -35,6 +35,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-ec2/src/pagination/DescribeAddressTransfersPaginator.ts b/clients/client-ec2/src/pagination/DescribeAddressTransfersPaginator.ts index 031cd7a8ebd5..4637a49c5043 100644 --- a/clients/client-ec2/src/pagination/DescribeAddressTransfersPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeAddressTransfersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeAddressTransfersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAddressTransfersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAddressTransfers( +export const paginateDescribeAddressTransfers: ( config: EC2PaginationConfiguration, input: DescribeAddressTransfersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAddressTransfersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeAddressTransfersCommandInput, + DescribeAddressTransfersCommandOutput +>(EC2Client, DescribeAddressTransfersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeAddressesAttributePaginator.ts b/clients/client-ec2/src/pagination/DescribeAddressesAttributePaginator.ts index 16153d05d8ad..99f1b039d13a 100644 --- a/clients/client-ec2/src/pagination/DescribeAddressesAttributePaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeAddressesAttributePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeAddressesAttributeCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAddressesAttributeCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAddressesAttribute( +export const paginateDescribeAddressesAttribute: ( config: EC2PaginationConfiguration, input: DescribeAddressesAttributeCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAddressesAttributeCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeAddressesAttributeCommandInput, + DescribeAddressesAttributeCommandOutput +>(EC2Client, DescribeAddressesAttributeCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeAwsNetworkPerformanceMetricSubscriptionsPaginator.ts b/clients/client-ec2/src/pagination/DescribeAwsNetworkPerformanceMetricSubscriptionsPaginator.ts index 6f91031ec356..00f8417aac78 100644 --- a/clients/client-ec2/src/pagination/DescribeAwsNetworkPerformanceMetricSubscriptionsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeAwsNetworkPerformanceMetricSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeAwsNetworkPerformanceMetricSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAwsNetworkPerformanceMetricSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAwsNetworkPerformanceMetricSubscriptions( +export const paginateDescribeAwsNetworkPerformanceMetricSubscriptions: ( config: EC2PaginationConfiguration, input: DescribeAwsNetworkPerformanceMetricSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAwsNetworkPerformanceMetricSubscriptionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeAwsNetworkPerformanceMetricSubscriptionsCommandInput, + DescribeAwsNetworkPerformanceMetricSubscriptionsCommandOutput +>(EC2Client, DescribeAwsNetworkPerformanceMetricSubscriptionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeByoipCidrsPaginator.ts b/clients/client-ec2/src/pagination/DescribeByoipCidrsPaginator.ts index fa61d974280d..1361b14e8cc4 100644 --- a/clients/client-ec2/src/pagination/DescribeByoipCidrsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeByoipCidrsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeByoipCidrsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeByoipCidrsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeByoipCidrs( +export const paginateDescribeByoipCidrs: ( config: EC2PaginationConfiguration, input: DescribeByoipCidrsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeByoipCidrsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeByoipCidrsCommandInput, + DescribeByoipCidrsCommandOutput +>(EC2Client, DescribeByoipCidrsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeCapacityBlockOfferingsPaginator.ts b/clients/client-ec2/src/pagination/DescribeCapacityBlockOfferingsPaginator.ts index db83c69f3397..0ecb3fa83156 100644 --- a/clients/client-ec2/src/pagination/DescribeCapacityBlockOfferingsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeCapacityBlockOfferingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeCapacityBlockOfferingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCapacityBlockOfferingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCapacityBlockOfferings( +export const paginateDescribeCapacityBlockOfferings: ( config: EC2PaginationConfiguration, input: DescribeCapacityBlockOfferingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCapacityBlockOfferingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeCapacityBlockOfferingsCommandInput, + DescribeCapacityBlockOfferingsCommandOutput +>(EC2Client, DescribeCapacityBlockOfferingsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeCapacityReservationFleetsPaginator.ts b/clients/client-ec2/src/pagination/DescribeCapacityReservationFleetsPaginator.ts index 42ec9bb24c7a..6a7e32a7d07b 100644 --- a/clients/client-ec2/src/pagination/DescribeCapacityReservationFleetsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeCapacityReservationFleetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeCapacityReservationFleetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCapacityReservationFleetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCapacityReservationFleets( +export const paginateDescribeCapacityReservationFleets: ( config: EC2PaginationConfiguration, input: DescribeCapacityReservationFleetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCapacityReservationFleetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeCapacityReservationFleetsCommandInput, + DescribeCapacityReservationFleetsCommandOutput +>(EC2Client, DescribeCapacityReservationFleetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeCapacityReservationsPaginator.ts b/clients/client-ec2/src/pagination/DescribeCapacityReservationsPaginator.ts index 2dfa44140fb0..6b02e8ddc05c 100644 --- a/clients/client-ec2/src/pagination/DescribeCapacityReservationsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeCapacityReservationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeCapacityReservationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCapacityReservationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCapacityReservations( +export const paginateDescribeCapacityReservations: ( config: EC2PaginationConfiguration, input: DescribeCapacityReservationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCapacityReservationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeCapacityReservationsCommandInput, + DescribeCapacityReservationsCommandOutput +>(EC2Client, DescribeCapacityReservationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeCarrierGatewaysPaginator.ts b/clients/client-ec2/src/pagination/DescribeCarrierGatewaysPaginator.ts index 494ad74e8afd..efae04e9d2f0 100644 --- a/clients/client-ec2/src/pagination/DescribeCarrierGatewaysPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeCarrierGatewaysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeCarrierGatewaysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCarrierGatewaysCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCarrierGateways( +export const paginateDescribeCarrierGateways: ( config: EC2PaginationConfiguration, input: DescribeCarrierGatewaysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCarrierGatewaysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeCarrierGatewaysCommandInput, + DescribeCarrierGatewaysCommandOutput +>(EC2Client, DescribeCarrierGatewaysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeClassicLinkInstancesPaginator.ts b/clients/client-ec2/src/pagination/DescribeClassicLinkInstancesPaginator.ts index 21c3383ea82a..f24a20d9f6b6 100644 --- a/clients/client-ec2/src/pagination/DescribeClassicLinkInstancesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeClassicLinkInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeClassicLinkInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClassicLinkInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClassicLinkInstances( +export const paginateDescribeClassicLinkInstances: ( config: EC2PaginationConfiguration, input: DescribeClassicLinkInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClassicLinkInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeClassicLinkInstancesCommandInput, + DescribeClassicLinkInstancesCommandOutput +>(EC2Client, DescribeClassicLinkInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeClientVpnAuthorizationRulesPaginator.ts b/clients/client-ec2/src/pagination/DescribeClientVpnAuthorizationRulesPaginator.ts index ea9eaaa5297f..757c0518287c 100644 --- a/clients/client-ec2/src/pagination/DescribeClientVpnAuthorizationRulesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeClientVpnAuthorizationRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeClientVpnAuthorizationRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClientVpnAuthorizationRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClientVpnAuthorizationRules( +export const paginateDescribeClientVpnAuthorizationRules: ( config: EC2PaginationConfiguration, input: DescribeClientVpnAuthorizationRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClientVpnAuthorizationRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeClientVpnAuthorizationRulesCommandInput, + DescribeClientVpnAuthorizationRulesCommandOutput +>(EC2Client, DescribeClientVpnAuthorizationRulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeClientVpnConnectionsPaginator.ts b/clients/client-ec2/src/pagination/DescribeClientVpnConnectionsPaginator.ts index 44743c621330..a2d718173bcd 100644 --- a/clients/client-ec2/src/pagination/DescribeClientVpnConnectionsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeClientVpnConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeClientVpnConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClientVpnConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClientVpnConnections( +export const paginateDescribeClientVpnConnections: ( config: EC2PaginationConfiguration, input: DescribeClientVpnConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClientVpnConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeClientVpnConnectionsCommandInput, + DescribeClientVpnConnectionsCommandOutput +>(EC2Client, DescribeClientVpnConnectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeClientVpnEndpointsPaginator.ts b/clients/client-ec2/src/pagination/DescribeClientVpnEndpointsPaginator.ts index 74efde781081..8f83e8ec48aa 100644 --- a/clients/client-ec2/src/pagination/DescribeClientVpnEndpointsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeClientVpnEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeClientVpnEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClientVpnEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClientVpnEndpoints( +export const paginateDescribeClientVpnEndpoints: ( config: EC2PaginationConfiguration, input: DescribeClientVpnEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClientVpnEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeClientVpnEndpointsCommandInput, + DescribeClientVpnEndpointsCommandOutput +>(EC2Client, DescribeClientVpnEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeClientVpnRoutesPaginator.ts b/clients/client-ec2/src/pagination/DescribeClientVpnRoutesPaginator.ts index 9f9640f7d10f..61d49e64eec8 100644 --- a/clients/client-ec2/src/pagination/DescribeClientVpnRoutesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeClientVpnRoutesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeClientVpnRoutesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClientVpnRoutesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClientVpnRoutes( +export const paginateDescribeClientVpnRoutes: ( config: EC2PaginationConfiguration, input: DescribeClientVpnRoutesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClientVpnRoutesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeClientVpnRoutesCommandInput, + DescribeClientVpnRoutesCommandOutput +>(EC2Client, DescribeClientVpnRoutesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeClientVpnTargetNetworksPaginator.ts b/clients/client-ec2/src/pagination/DescribeClientVpnTargetNetworksPaginator.ts index e33571248807..9805ed38ceaf 100644 --- a/clients/client-ec2/src/pagination/DescribeClientVpnTargetNetworksPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeClientVpnTargetNetworksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeClientVpnTargetNetworksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClientVpnTargetNetworksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClientVpnTargetNetworks( +export const paginateDescribeClientVpnTargetNetworks: ( config: EC2PaginationConfiguration, input: DescribeClientVpnTargetNetworksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClientVpnTargetNetworksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeClientVpnTargetNetworksCommandInput, + DescribeClientVpnTargetNetworksCommandOutput +>(EC2Client, DescribeClientVpnTargetNetworksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeCoipPoolsPaginator.ts b/clients/client-ec2/src/pagination/DescribeCoipPoolsPaginator.ts index 009508c3eb74..cb88a16ccbcd 100644 --- a/clients/client-ec2/src/pagination/DescribeCoipPoolsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeCoipPoolsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeCoipPoolsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCoipPoolsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCoipPools( +export const paginateDescribeCoipPools: ( config: EC2PaginationConfiguration, input: DescribeCoipPoolsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCoipPoolsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeCoipPoolsCommandInput, + DescribeCoipPoolsCommandOutput +>(EC2Client, DescribeCoipPoolsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeDhcpOptionsPaginator.ts b/clients/client-ec2/src/pagination/DescribeDhcpOptionsPaginator.ts index 725a773cbc19..249dd74a8004 100644 --- a/clients/client-ec2/src/pagination/DescribeDhcpOptionsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeDhcpOptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeDhcpOptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDhcpOptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDhcpOptions( +export const paginateDescribeDhcpOptions: ( config: EC2PaginationConfiguration, input: DescribeDhcpOptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDhcpOptionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeDhcpOptionsCommandInput, + DescribeDhcpOptionsCommandOutput +>(EC2Client, DescribeDhcpOptionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeEgressOnlyInternetGatewaysPaginator.ts b/clients/client-ec2/src/pagination/DescribeEgressOnlyInternetGatewaysPaginator.ts index 38768f77242b..36bab5a2c95a 100644 --- a/clients/client-ec2/src/pagination/DescribeEgressOnlyInternetGatewaysPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeEgressOnlyInternetGatewaysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeEgressOnlyInternetGatewaysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEgressOnlyInternetGatewaysCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEgressOnlyInternetGateways( +export const paginateDescribeEgressOnlyInternetGateways: ( config: EC2PaginationConfiguration, input: DescribeEgressOnlyInternetGatewaysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEgressOnlyInternetGatewaysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeEgressOnlyInternetGatewaysCommandInput, + DescribeEgressOnlyInternetGatewaysCommandOutput +>(EC2Client, DescribeEgressOnlyInternetGatewaysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeExportImageTasksPaginator.ts b/clients/client-ec2/src/pagination/DescribeExportImageTasksPaginator.ts index 80d715c696a8..2c246709392c 100644 --- a/clients/client-ec2/src/pagination/DescribeExportImageTasksPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeExportImageTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeExportImageTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeExportImageTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeExportImageTasks( +export const paginateDescribeExportImageTasks: ( config: EC2PaginationConfiguration, input: DescribeExportImageTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeExportImageTasksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeExportImageTasksCommandInput, + DescribeExportImageTasksCommandOutput +>(EC2Client, DescribeExportImageTasksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeFastLaunchImagesPaginator.ts b/clients/client-ec2/src/pagination/DescribeFastLaunchImagesPaginator.ts index 4f7566ba3cfc..12c60cee962e 100644 --- a/clients/client-ec2/src/pagination/DescribeFastLaunchImagesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeFastLaunchImagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeFastLaunchImagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFastLaunchImagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFastLaunchImages( +export const paginateDescribeFastLaunchImages: ( config: EC2PaginationConfiguration, input: DescribeFastLaunchImagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFastLaunchImagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeFastLaunchImagesCommandInput, + DescribeFastLaunchImagesCommandOutput +>(EC2Client, DescribeFastLaunchImagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeFastSnapshotRestoresPaginator.ts b/clients/client-ec2/src/pagination/DescribeFastSnapshotRestoresPaginator.ts index 01cd19108114..fa2e2d441a6f 100644 --- a/clients/client-ec2/src/pagination/DescribeFastSnapshotRestoresPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeFastSnapshotRestoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeFastSnapshotRestoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFastSnapshotRestoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFastSnapshotRestores( +export const paginateDescribeFastSnapshotRestores: ( config: EC2PaginationConfiguration, input: DescribeFastSnapshotRestoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFastSnapshotRestoresCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeFastSnapshotRestoresCommandInput, + DescribeFastSnapshotRestoresCommandOutput +>(EC2Client, DescribeFastSnapshotRestoresCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeFleetsPaginator.ts b/clients/client-ec2/src/pagination/DescribeFleetsPaginator.ts index 847d25ea6cff..2eda50f6c3e3 100644 --- a/clients/client-ec2/src/pagination/DescribeFleetsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeFleetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeFleetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFleetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFleets( +export const paginateDescribeFleets: ( config: EC2PaginationConfiguration, input: DescribeFleetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFleetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeFleetsCommandInput, + DescribeFleetsCommandOutput +>(EC2Client, DescribeFleetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeFlowLogsPaginator.ts b/clients/client-ec2/src/pagination/DescribeFlowLogsPaginator.ts index 5ceb67f7482b..a567b161f2d4 100644 --- a/clients/client-ec2/src/pagination/DescribeFlowLogsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeFlowLogsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeFlowLogsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFlowLogsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFlowLogs( +export const paginateDescribeFlowLogs: ( config: EC2PaginationConfiguration, input: DescribeFlowLogsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFlowLogsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeFlowLogsCommandInput, + DescribeFlowLogsCommandOutput +>(EC2Client, DescribeFlowLogsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeFpgaImagesPaginator.ts b/clients/client-ec2/src/pagination/DescribeFpgaImagesPaginator.ts index 5df21d822bf1..06abc00fcc8a 100644 --- a/clients/client-ec2/src/pagination/DescribeFpgaImagesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeFpgaImagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeFpgaImagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFpgaImagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFpgaImages( +export const paginateDescribeFpgaImages: ( config: EC2PaginationConfiguration, input: DescribeFpgaImagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFpgaImagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeFpgaImagesCommandInput, + DescribeFpgaImagesCommandOutput +>(EC2Client, DescribeFpgaImagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeHostReservationOfferingsPaginator.ts b/clients/client-ec2/src/pagination/DescribeHostReservationOfferingsPaginator.ts index 6b1dd5a846c7..ac987ebff501 100644 --- a/clients/client-ec2/src/pagination/DescribeHostReservationOfferingsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeHostReservationOfferingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeHostReservationOfferingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeHostReservationOfferingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeHostReservationOfferings( +export const paginateDescribeHostReservationOfferings: ( config: EC2PaginationConfiguration, input: DescribeHostReservationOfferingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeHostReservationOfferingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeHostReservationOfferingsCommandInput, + DescribeHostReservationOfferingsCommandOutput +>(EC2Client, DescribeHostReservationOfferingsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeHostReservationsPaginator.ts b/clients/client-ec2/src/pagination/DescribeHostReservationsPaginator.ts index 6bf1d792734d..4f782a774610 100644 --- a/clients/client-ec2/src/pagination/DescribeHostReservationsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeHostReservationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeHostReservationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeHostReservationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeHostReservations( +export const paginateDescribeHostReservations: ( config: EC2PaginationConfiguration, input: DescribeHostReservationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeHostReservationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeHostReservationsCommandInput, + DescribeHostReservationsCommandOutput +>(EC2Client, DescribeHostReservationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeHostsPaginator.ts b/clients/client-ec2/src/pagination/DescribeHostsPaginator.ts index 6aab163db4da..7042bdf0e7c4 100644 --- a/clients/client-ec2/src/pagination/DescribeHostsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeHostsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeHostsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeHostsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeHosts( +export const paginateDescribeHosts: ( config: EC2PaginationConfiguration, input: DescribeHostsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeHostsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeHostsCommandInput, + DescribeHostsCommandOutput +>(EC2Client, DescribeHostsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeIamInstanceProfileAssociationsPaginator.ts b/clients/client-ec2/src/pagination/DescribeIamInstanceProfileAssociationsPaginator.ts index 85591c1816f1..479dd4f5955a 100644 --- a/clients/client-ec2/src/pagination/DescribeIamInstanceProfileAssociationsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeIamInstanceProfileAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeIamInstanceProfileAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeIamInstanceProfileAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeIamInstanceProfileAssociations( +export const paginateDescribeIamInstanceProfileAssociations: ( config: EC2PaginationConfiguration, input: DescribeIamInstanceProfileAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeIamInstanceProfileAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeIamInstanceProfileAssociationsCommandInput, + DescribeIamInstanceProfileAssociationsCommandOutput +>(EC2Client, DescribeIamInstanceProfileAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeImagesPaginator.ts b/clients/client-ec2/src/pagination/DescribeImagesPaginator.ts index d1e6be45c5d1..e36bf87ac441 100644 --- a/clients/client-ec2/src/pagination/DescribeImagesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeImagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeImagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeImagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeImages( +export const paginateDescribeImages: ( config: EC2PaginationConfiguration, input: DescribeImagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeImagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeImagesCommandInput, + DescribeImagesCommandOutput +>(EC2Client, DescribeImagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeImportImageTasksPaginator.ts b/clients/client-ec2/src/pagination/DescribeImportImageTasksPaginator.ts index cfa280db2adb..7e4b4efd6530 100644 --- a/clients/client-ec2/src/pagination/DescribeImportImageTasksPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeImportImageTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeImportImageTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeImportImageTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeImportImageTasks( +export const paginateDescribeImportImageTasks: ( config: EC2PaginationConfiguration, input: DescribeImportImageTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeImportImageTasksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeImportImageTasksCommandInput, + DescribeImportImageTasksCommandOutput +>(EC2Client, DescribeImportImageTasksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeImportSnapshotTasksPaginator.ts b/clients/client-ec2/src/pagination/DescribeImportSnapshotTasksPaginator.ts index 464e892e745c..b91cab7984e9 100644 --- a/clients/client-ec2/src/pagination/DescribeImportSnapshotTasksPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeImportSnapshotTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeImportSnapshotTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeImportSnapshotTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeImportSnapshotTasks( +export const paginateDescribeImportSnapshotTasks: ( config: EC2PaginationConfiguration, input: DescribeImportSnapshotTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeImportSnapshotTasksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeImportSnapshotTasksCommandInput, + DescribeImportSnapshotTasksCommandOutput +>(EC2Client, DescribeImportSnapshotTasksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeInstanceConnectEndpointsPaginator.ts b/clients/client-ec2/src/pagination/DescribeInstanceConnectEndpointsPaginator.ts index 831024a43b3d..07d1e152cdc5 100644 --- a/clients/client-ec2/src/pagination/DescribeInstanceConnectEndpointsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeInstanceConnectEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeInstanceConnectEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstanceConnectEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstanceConnectEndpoints( +export const paginateDescribeInstanceConnectEndpoints: ( config: EC2PaginationConfiguration, input: DescribeInstanceConnectEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstanceConnectEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeInstanceConnectEndpointsCommandInput, + DescribeInstanceConnectEndpointsCommandOutput +>(EC2Client, DescribeInstanceConnectEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeInstanceCreditSpecificationsPaginator.ts b/clients/client-ec2/src/pagination/DescribeInstanceCreditSpecificationsPaginator.ts index ae0d52f3770e..fafebd43fdb7 100644 --- a/clients/client-ec2/src/pagination/DescribeInstanceCreditSpecificationsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeInstanceCreditSpecificationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeInstanceCreditSpecificationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstanceCreditSpecificationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstanceCreditSpecifications( +export const paginateDescribeInstanceCreditSpecifications: ( config: EC2PaginationConfiguration, input: DescribeInstanceCreditSpecificationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstanceCreditSpecificationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeInstanceCreditSpecificationsCommandInput, + DescribeInstanceCreditSpecificationsCommandOutput +>(EC2Client, DescribeInstanceCreditSpecificationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeInstanceEventWindowsPaginator.ts b/clients/client-ec2/src/pagination/DescribeInstanceEventWindowsPaginator.ts index ba02ea0c026b..a570254e1155 100644 --- a/clients/client-ec2/src/pagination/DescribeInstanceEventWindowsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeInstanceEventWindowsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeInstanceEventWindowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstanceEventWindowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstanceEventWindows( +export const paginateDescribeInstanceEventWindows: ( config: EC2PaginationConfiguration, input: DescribeInstanceEventWindowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstanceEventWindowsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeInstanceEventWindowsCommandInput, + DescribeInstanceEventWindowsCommandOutput +>(EC2Client, DescribeInstanceEventWindowsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeInstanceStatusPaginator.ts b/clients/client-ec2/src/pagination/DescribeInstanceStatusPaginator.ts index 4fa47b065e70..6d31ff578cb9 100644 --- a/clients/client-ec2/src/pagination/DescribeInstanceStatusPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeInstanceStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeInstanceStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstanceStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstanceStatus( +export const paginateDescribeInstanceStatus: ( config: EC2PaginationConfiguration, input: DescribeInstanceStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstanceStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeInstanceStatusCommandInput, + DescribeInstanceStatusCommandOutput +>(EC2Client, DescribeInstanceStatusCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeInstanceTopologyPaginator.ts b/clients/client-ec2/src/pagination/DescribeInstanceTopologyPaginator.ts index 04e37a311540..dc2a99747d45 100644 --- a/clients/client-ec2/src/pagination/DescribeInstanceTopologyPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeInstanceTopologyPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeInstanceTopologyCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstanceTopologyCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstanceTopology( +export const paginateDescribeInstanceTopology: ( config: EC2PaginationConfiguration, input: DescribeInstanceTopologyCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstanceTopologyCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeInstanceTopologyCommandInput, + DescribeInstanceTopologyCommandOutput +>(EC2Client, DescribeInstanceTopologyCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeInstanceTypeOfferingsPaginator.ts b/clients/client-ec2/src/pagination/DescribeInstanceTypeOfferingsPaginator.ts index 9360454fe169..1ede3631b84b 100644 --- a/clients/client-ec2/src/pagination/DescribeInstanceTypeOfferingsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeInstanceTypeOfferingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeInstanceTypeOfferingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstanceTypeOfferingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstanceTypeOfferings( +export const paginateDescribeInstanceTypeOfferings: ( config: EC2PaginationConfiguration, input: DescribeInstanceTypeOfferingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstanceTypeOfferingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeInstanceTypeOfferingsCommandInput, + DescribeInstanceTypeOfferingsCommandOutput +>(EC2Client, DescribeInstanceTypeOfferingsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeInstanceTypesPaginator.ts b/clients/client-ec2/src/pagination/DescribeInstanceTypesPaginator.ts index 442ec19b8e0b..d83b9f517a55 100644 --- a/clients/client-ec2/src/pagination/DescribeInstanceTypesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeInstanceTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeInstanceTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstanceTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstanceTypes( +export const paginateDescribeInstanceTypes: ( config: EC2PaginationConfiguration, input: DescribeInstanceTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstanceTypesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeInstanceTypesCommandInput, + DescribeInstanceTypesCommandOutput +>(EC2Client, DescribeInstanceTypesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeInstancesPaginator.ts b/clients/client-ec2/src/pagination/DescribeInstancesPaginator.ts index a1f3ca6563dc..2cbe76e6c55e 100644 --- a/clients/client-ec2/src/pagination/DescribeInstancesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstances( +export const paginateDescribeInstances: ( config: EC2PaginationConfiguration, input: DescribeInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeInstancesCommandInput, + DescribeInstancesCommandOutput +>(EC2Client, DescribeInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeInternetGatewaysPaginator.ts b/clients/client-ec2/src/pagination/DescribeInternetGatewaysPaginator.ts index 4d188dbd9b26..fa5bdc1d1a48 100644 --- a/clients/client-ec2/src/pagination/DescribeInternetGatewaysPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeInternetGatewaysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeInternetGatewaysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInternetGatewaysCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInternetGateways( +export const paginateDescribeInternetGateways: ( config: EC2PaginationConfiguration, input: DescribeInternetGatewaysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInternetGatewaysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeInternetGatewaysCommandInput, + DescribeInternetGatewaysCommandOutput +>(EC2Client, DescribeInternetGatewaysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeIpamPoolsPaginator.ts b/clients/client-ec2/src/pagination/DescribeIpamPoolsPaginator.ts index 3dbf66f550ff..d7d5e22dbac9 100644 --- a/clients/client-ec2/src/pagination/DescribeIpamPoolsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeIpamPoolsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeIpamPoolsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeIpamPoolsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeIpamPools( +export const paginateDescribeIpamPools: ( config: EC2PaginationConfiguration, input: DescribeIpamPoolsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeIpamPoolsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeIpamPoolsCommandInput, + DescribeIpamPoolsCommandOutput +>(EC2Client, DescribeIpamPoolsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeIpamResourceDiscoveriesPaginator.ts b/clients/client-ec2/src/pagination/DescribeIpamResourceDiscoveriesPaginator.ts index 449ddea2eedb..7bf06636b4f0 100644 --- a/clients/client-ec2/src/pagination/DescribeIpamResourceDiscoveriesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeIpamResourceDiscoveriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeIpamResourceDiscoveriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeIpamResourceDiscoveriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeIpamResourceDiscoveries( +export const paginateDescribeIpamResourceDiscoveries: ( config: EC2PaginationConfiguration, input: DescribeIpamResourceDiscoveriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeIpamResourceDiscoveriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeIpamResourceDiscoveriesCommandInput, + DescribeIpamResourceDiscoveriesCommandOutput +>(EC2Client, DescribeIpamResourceDiscoveriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeIpamResourceDiscoveryAssociationsPaginator.ts b/clients/client-ec2/src/pagination/DescribeIpamResourceDiscoveryAssociationsPaginator.ts index 97693775e89a..357f18f1e9d4 100644 --- a/clients/client-ec2/src/pagination/DescribeIpamResourceDiscoveryAssociationsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeIpamResourceDiscoveryAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeIpamResourceDiscoveryAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeIpamResourceDiscoveryAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeIpamResourceDiscoveryAssociations( +export const paginateDescribeIpamResourceDiscoveryAssociations: ( config: EC2PaginationConfiguration, input: DescribeIpamResourceDiscoveryAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeIpamResourceDiscoveryAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeIpamResourceDiscoveryAssociationsCommandInput, + DescribeIpamResourceDiscoveryAssociationsCommandOutput +>(EC2Client, DescribeIpamResourceDiscoveryAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeIpamScopesPaginator.ts b/clients/client-ec2/src/pagination/DescribeIpamScopesPaginator.ts index 68c2ca97b375..334fe5fbe99e 100644 --- a/clients/client-ec2/src/pagination/DescribeIpamScopesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeIpamScopesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeIpamScopesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeIpamScopesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeIpamScopes( +export const paginateDescribeIpamScopes: ( config: EC2PaginationConfiguration, input: DescribeIpamScopesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeIpamScopesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeIpamScopesCommandInput, + DescribeIpamScopesCommandOutput +>(EC2Client, DescribeIpamScopesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeIpamsPaginator.ts b/clients/client-ec2/src/pagination/DescribeIpamsPaginator.ts index fa2166f0dbd9..1992ea24f11d 100644 --- a/clients/client-ec2/src/pagination/DescribeIpamsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeIpamsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeIpamsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeIpamsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeIpams( +export const paginateDescribeIpams: ( config: EC2PaginationConfiguration, input: DescribeIpamsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeIpamsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeIpamsCommandInput, + DescribeIpamsCommandOutput +>(EC2Client, DescribeIpamsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeIpv6PoolsPaginator.ts b/clients/client-ec2/src/pagination/DescribeIpv6PoolsPaginator.ts index 7143bcfcb795..d80c139f73de 100644 --- a/clients/client-ec2/src/pagination/DescribeIpv6PoolsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeIpv6PoolsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeIpv6PoolsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeIpv6PoolsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeIpv6Pools( +export const paginateDescribeIpv6Pools: ( config: EC2PaginationConfiguration, input: DescribeIpv6PoolsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeIpv6PoolsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeIpv6PoolsCommandInput, + DescribeIpv6PoolsCommandOutput +>(EC2Client, DescribeIpv6PoolsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeLaunchTemplateVersionsPaginator.ts b/clients/client-ec2/src/pagination/DescribeLaunchTemplateVersionsPaginator.ts index 269fb7a2271d..d14221ff652b 100644 --- a/clients/client-ec2/src/pagination/DescribeLaunchTemplateVersionsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeLaunchTemplateVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeLaunchTemplateVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLaunchTemplateVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLaunchTemplateVersions( +export const paginateDescribeLaunchTemplateVersions: ( config: EC2PaginationConfiguration, input: DescribeLaunchTemplateVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLaunchTemplateVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeLaunchTemplateVersionsCommandInput, + DescribeLaunchTemplateVersionsCommandOutput +>(EC2Client, DescribeLaunchTemplateVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeLaunchTemplatesPaginator.ts b/clients/client-ec2/src/pagination/DescribeLaunchTemplatesPaginator.ts index af1c693908ca..265c1755a841 100644 --- a/clients/client-ec2/src/pagination/DescribeLaunchTemplatesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeLaunchTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeLaunchTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLaunchTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLaunchTemplates( +export const paginateDescribeLaunchTemplates: ( config: EC2PaginationConfiguration, input: DescribeLaunchTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLaunchTemplatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeLaunchTemplatesCommandInput, + DescribeLaunchTemplatesCommandOutput +>(EC2Client, DescribeLaunchTemplatesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsPaginator.ts b/clients/client-ec2/src/pagination/DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsPaginator.ts index 404e4dfda010..12c898f06791 100644 --- a/clients/client-ec2/src/pagination/DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,21 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociations( +export const paginateDescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociations: ( config: EC2PaginationConfiguration, input: DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsCommandInput, + DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsCommandOutput +>( + EC2Client, + DescribeLocalGatewayRouteTableVirtualInterfaceGroupAssociationsCommand, + "NextToken", + "NextToken", + "MaxResults" +); diff --git a/clients/client-ec2/src/pagination/DescribeLocalGatewayRouteTableVpcAssociationsPaginator.ts b/clients/client-ec2/src/pagination/DescribeLocalGatewayRouteTableVpcAssociationsPaginator.ts index 53cebbb76c2e..91b12100953d 100644 --- a/clients/client-ec2/src/pagination/DescribeLocalGatewayRouteTableVpcAssociationsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeLocalGatewayRouteTableVpcAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeLocalGatewayRouteTableVpcAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLocalGatewayRouteTableVpcAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLocalGatewayRouteTableVpcAssociations( +export const paginateDescribeLocalGatewayRouteTableVpcAssociations: ( config: EC2PaginationConfiguration, input: DescribeLocalGatewayRouteTableVpcAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLocalGatewayRouteTableVpcAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeLocalGatewayRouteTableVpcAssociationsCommandInput, + DescribeLocalGatewayRouteTableVpcAssociationsCommandOutput +>(EC2Client, DescribeLocalGatewayRouteTableVpcAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeLocalGatewayRouteTablesPaginator.ts b/clients/client-ec2/src/pagination/DescribeLocalGatewayRouteTablesPaginator.ts index 2296ea3b062f..e17f902722ce 100644 --- a/clients/client-ec2/src/pagination/DescribeLocalGatewayRouteTablesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeLocalGatewayRouteTablesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeLocalGatewayRouteTablesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLocalGatewayRouteTablesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLocalGatewayRouteTables( +export const paginateDescribeLocalGatewayRouteTables: ( config: EC2PaginationConfiguration, input: DescribeLocalGatewayRouteTablesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLocalGatewayRouteTablesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeLocalGatewayRouteTablesCommandInput, + DescribeLocalGatewayRouteTablesCommandOutput +>(EC2Client, DescribeLocalGatewayRouteTablesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeLocalGatewayVirtualInterfaceGroupsPaginator.ts b/clients/client-ec2/src/pagination/DescribeLocalGatewayVirtualInterfaceGroupsPaginator.ts index d9d4a071b5ff..606ab5774f90 100644 --- a/clients/client-ec2/src/pagination/DescribeLocalGatewayVirtualInterfaceGroupsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeLocalGatewayVirtualInterfaceGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeLocalGatewayVirtualInterfaceGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLocalGatewayVirtualInterfaceGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLocalGatewayVirtualInterfaceGroups( +export const paginateDescribeLocalGatewayVirtualInterfaceGroups: ( config: EC2PaginationConfiguration, input: DescribeLocalGatewayVirtualInterfaceGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLocalGatewayVirtualInterfaceGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeLocalGatewayVirtualInterfaceGroupsCommandInput, + DescribeLocalGatewayVirtualInterfaceGroupsCommandOutput +>(EC2Client, DescribeLocalGatewayVirtualInterfaceGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeLocalGatewayVirtualInterfacesPaginator.ts b/clients/client-ec2/src/pagination/DescribeLocalGatewayVirtualInterfacesPaginator.ts index 6a27bbe2b780..465dff747e20 100644 --- a/clients/client-ec2/src/pagination/DescribeLocalGatewayVirtualInterfacesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeLocalGatewayVirtualInterfacesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeLocalGatewayVirtualInterfacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLocalGatewayVirtualInterfacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLocalGatewayVirtualInterfaces( +export const paginateDescribeLocalGatewayVirtualInterfaces: ( config: EC2PaginationConfiguration, input: DescribeLocalGatewayVirtualInterfacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLocalGatewayVirtualInterfacesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeLocalGatewayVirtualInterfacesCommandInput, + DescribeLocalGatewayVirtualInterfacesCommandOutput +>(EC2Client, DescribeLocalGatewayVirtualInterfacesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeLocalGatewaysPaginator.ts b/clients/client-ec2/src/pagination/DescribeLocalGatewaysPaginator.ts index 312cb4406d36..8473f000930f 100644 --- a/clients/client-ec2/src/pagination/DescribeLocalGatewaysPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeLocalGatewaysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeLocalGatewaysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLocalGatewaysCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLocalGateways( +export const paginateDescribeLocalGateways: ( config: EC2PaginationConfiguration, input: DescribeLocalGatewaysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLocalGatewaysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeLocalGatewaysCommandInput, + DescribeLocalGatewaysCommandOutput +>(EC2Client, DescribeLocalGatewaysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeManagedPrefixListsPaginator.ts b/clients/client-ec2/src/pagination/DescribeManagedPrefixListsPaginator.ts index 0be8c00eaa4e..5c9add5bf378 100644 --- a/clients/client-ec2/src/pagination/DescribeManagedPrefixListsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeManagedPrefixListsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeManagedPrefixListsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeManagedPrefixListsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeManagedPrefixLists( +export const paginateDescribeManagedPrefixLists: ( config: EC2PaginationConfiguration, input: DescribeManagedPrefixListsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeManagedPrefixListsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeManagedPrefixListsCommandInput, + DescribeManagedPrefixListsCommandOutput +>(EC2Client, DescribeManagedPrefixListsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeMovingAddressesPaginator.ts b/clients/client-ec2/src/pagination/DescribeMovingAddressesPaginator.ts index 56c7c017c998..fd2aaa8ab584 100644 --- a/clients/client-ec2/src/pagination/DescribeMovingAddressesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeMovingAddressesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeMovingAddressesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMovingAddressesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMovingAddresses( +export const paginateDescribeMovingAddresses: ( config: EC2PaginationConfiguration, input: DescribeMovingAddressesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMovingAddressesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeMovingAddressesCommandInput, + DescribeMovingAddressesCommandOutput +>(EC2Client, DescribeMovingAddressesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeNatGatewaysPaginator.ts b/clients/client-ec2/src/pagination/DescribeNatGatewaysPaginator.ts index 14e1033e10c2..ea0d79ac15b2 100644 --- a/clients/client-ec2/src/pagination/DescribeNatGatewaysPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeNatGatewaysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeNatGatewaysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeNatGatewaysCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeNatGateways( +export const paginateDescribeNatGateways: ( config: EC2PaginationConfiguration, input: DescribeNatGatewaysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeNatGatewaysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeNatGatewaysCommandInput, + DescribeNatGatewaysCommandOutput +>(EC2Client, DescribeNatGatewaysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeNetworkAclsPaginator.ts b/clients/client-ec2/src/pagination/DescribeNetworkAclsPaginator.ts index b707981a24fe..b94ff8b4f6ee 100644 --- a/clients/client-ec2/src/pagination/DescribeNetworkAclsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeNetworkAclsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeNetworkAclsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeNetworkAclsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeNetworkAcls( +export const paginateDescribeNetworkAcls: ( config: EC2PaginationConfiguration, input: DescribeNetworkAclsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeNetworkAclsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeNetworkAclsCommandInput, + DescribeNetworkAclsCommandOutput +>(EC2Client, DescribeNetworkAclsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeNetworkInsightsAccessScopeAnalysesPaginator.ts b/clients/client-ec2/src/pagination/DescribeNetworkInsightsAccessScopeAnalysesPaginator.ts index d32f0feab23b..bb65ef27f166 100644 --- a/clients/client-ec2/src/pagination/DescribeNetworkInsightsAccessScopeAnalysesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeNetworkInsightsAccessScopeAnalysesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeNetworkInsightsAccessScopeAnalysesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeNetworkInsightsAccessScopeAnalysesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeNetworkInsightsAccessScopeAnalyses( +export const paginateDescribeNetworkInsightsAccessScopeAnalyses: ( config: EC2PaginationConfiguration, input: DescribeNetworkInsightsAccessScopeAnalysesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeNetworkInsightsAccessScopeAnalysesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeNetworkInsightsAccessScopeAnalysesCommandInput, + DescribeNetworkInsightsAccessScopeAnalysesCommandOutput +>(EC2Client, DescribeNetworkInsightsAccessScopeAnalysesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeNetworkInsightsAccessScopesPaginator.ts b/clients/client-ec2/src/pagination/DescribeNetworkInsightsAccessScopesPaginator.ts index 2a4cb953d1b0..1198d0422096 100644 --- a/clients/client-ec2/src/pagination/DescribeNetworkInsightsAccessScopesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeNetworkInsightsAccessScopesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeNetworkInsightsAccessScopesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeNetworkInsightsAccessScopesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeNetworkInsightsAccessScopes( +export const paginateDescribeNetworkInsightsAccessScopes: ( config: EC2PaginationConfiguration, input: DescribeNetworkInsightsAccessScopesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeNetworkInsightsAccessScopesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeNetworkInsightsAccessScopesCommandInput, + DescribeNetworkInsightsAccessScopesCommandOutput +>(EC2Client, DescribeNetworkInsightsAccessScopesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeNetworkInsightsAnalysesPaginator.ts b/clients/client-ec2/src/pagination/DescribeNetworkInsightsAnalysesPaginator.ts index e3f1d57113a3..283aa9ac9f7f 100644 --- a/clients/client-ec2/src/pagination/DescribeNetworkInsightsAnalysesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeNetworkInsightsAnalysesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeNetworkInsightsAnalysesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeNetworkInsightsAnalysesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeNetworkInsightsAnalyses( +export const paginateDescribeNetworkInsightsAnalyses: ( config: EC2PaginationConfiguration, input: DescribeNetworkInsightsAnalysesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeNetworkInsightsAnalysesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeNetworkInsightsAnalysesCommandInput, + DescribeNetworkInsightsAnalysesCommandOutput +>(EC2Client, DescribeNetworkInsightsAnalysesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeNetworkInsightsPathsPaginator.ts b/clients/client-ec2/src/pagination/DescribeNetworkInsightsPathsPaginator.ts index fb42d88812f1..78aba23b350c 100644 --- a/clients/client-ec2/src/pagination/DescribeNetworkInsightsPathsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeNetworkInsightsPathsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeNetworkInsightsPathsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeNetworkInsightsPathsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeNetworkInsightsPaths( +export const paginateDescribeNetworkInsightsPaths: ( config: EC2PaginationConfiguration, input: DescribeNetworkInsightsPathsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeNetworkInsightsPathsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeNetworkInsightsPathsCommandInput, + DescribeNetworkInsightsPathsCommandOutput +>(EC2Client, DescribeNetworkInsightsPathsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeNetworkInterfacePermissionsPaginator.ts b/clients/client-ec2/src/pagination/DescribeNetworkInterfacePermissionsPaginator.ts index 81c4049b87a6..b79f4c0af8c3 100644 --- a/clients/client-ec2/src/pagination/DescribeNetworkInterfacePermissionsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeNetworkInterfacePermissionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeNetworkInterfacePermissionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeNetworkInterfacePermissionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeNetworkInterfacePermissions( +export const paginateDescribeNetworkInterfacePermissions: ( config: EC2PaginationConfiguration, input: DescribeNetworkInterfacePermissionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeNetworkInterfacePermissionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeNetworkInterfacePermissionsCommandInput, + DescribeNetworkInterfacePermissionsCommandOutput +>(EC2Client, DescribeNetworkInterfacePermissionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeNetworkInterfacesPaginator.ts b/clients/client-ec2/src/pagination/DescribeNetworkInterfacesPaginator.ts index 69194f178647..05c47e340dc1 100644 --- a/clients/client-ec2/src/pagination/DescribeNetworkInterfacesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeNetworkInterfacesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeNetworkInterfacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeNetworkInterfacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeNetworkInterfaces( +export const paginateDescribeNetworkInterfaces: ( config: EC2PaginationConfiguration, input: DescribeNetworkInterfacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeNetworkInterfacesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeNetworkInterfacesCommandInput, + DescribeNetworkInterfacesCommandOutput +>(EC2Client, DescribeNetworkInterfacesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribePrefixListsPaginator.ts b/clients/client-ec2/src/pagination/DescribePrefixListsPaginator.ts index 9e347fce0506..bb010b3748a7 100644 --- a/clients/client-ec2/src/pagination/DescribePrefixListsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribePrefixListsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribePrefixListsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePrefixListsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePrefixLists( +export const paginateDescribePrefixLists: ( config: EC2PaginationConfiguration, input: DescribePrefixListsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePrefixListsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribePrefixListsCommandInput, + DescribePrefixListsCommandOutput +>(EC2Client, DescribePrefixListsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribePrincipalIdFormatPaginator.ts b/clients/client-ec2/src/pagination/DescribePrincipalIdFormatPaginator.ts index 9c4e04198d69..e5412e6a021b 100644 --- a/clients/client-ec2/src/pagination/DescribePrincipalIdFormatPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribePrincipalIdFormatPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribePrincipalIdFormatCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePrincipalIdFormatCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePrincipalIdFormat( +export const paginateDescribePrincipalIdFormat: ( config: EC2PaginationConfiguration, input: DescribePrincipalIdFormatCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePrincipalIdFormatCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribePrincipalIdFormatCommandInput, + DescribePrincipalIdFormatCommandOutput +>(EC2Client, DescribePrincipalIdFormatCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribePublicIpv4PoolsPaginator.ts b/clients/client-ec2/src/pagination/DescribePublicIpv4PoolsPaginator.ts index 35f252292697..ccd3fe89f0c0 100644 --- a/clients/client-ec2/src/pagination/DescribePublicIpv4PoolsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribePublicIpv4PoolsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribePublicIpv4PoolsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePublicIpv4PoolsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePublicIpv4Pools( +export const paginateDescribePublicIpv4Pools: ( config: EC2PaginationConfiguration, input: DescribePublicIpv4PoolsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePublicIpv4PoolsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribePublicIpv4PoolsCommandInput, + DescribePublicIpv4PoolsCommandOutput +>(EC2Client, DescribePublicIpv4PoolsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeReplaceRootVolumeTasksPaginator.ts b/clients/client-ec2/src/pagination/DescribeReplaceRootVolumeTasksPaginator.ts index b07c0e501920..5b0f4e447374 100644 --- a/clients/client-ec2/src/pagination/DescribeReplaceRootVolumeTasksPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeReplaceRootVolumeTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeReplaceRootVolumeTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplaceRootVolumeTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplaceRootVolumeTasks( +export const paginateDescribeReplaceRootVolumeTasks: ( config: EC2PaginationConfiguration, input: DescribeReplaceRootVolumeTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplaceRootVolumeTasksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeReplaceRootVolumeTasksCommandInput, + DescribeReplaceRootVolumeTasksCommandOutput +>(EC2Client, DescribeReplaceRootVolumeTasksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeReservedInstancesModificationsPaginator.ts b/clients/client-ec2/src/pagination/DescribeReservedInstancesModificationsPaginator.ts index 3a8b858f8523..fcbeeae38069 100644 --- a/clients/client-ec2/src/pagination/DescribeReservedInstancesModificationsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeReservedInstancesModificationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeReservedInstancesModificationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedInstancesModificationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedInstancesModifications( +export const paginateDescribeReservedInstancesModifications: ( config: EC2PaginationConfiguration, input: DescribeReservedInstancesModificationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedInstancesModificationsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeReservedInstancesModificationsCommandInput, + DescribeReservedInstancesModificationsCommandOutput +>(EC2Client, DescribeReservedInstancesModificationsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-ec2/src/pagination/DescribeReservedInstancesOfferingsPaginator.ts b/clients/client-ec2/src/pagination/DescribeReservedInstancesOfferingsPaginator.ts index 737214915fd0..0755c46648ee 100644 --- a/clients/client-ec2/src/pagination/DescribeReservedInstancesOfferingsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeReservedInstancesOfferingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeReservedInstancesOfferingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedInstancesOfferingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedInstancesOfferings( +export const paginateDescribeReservedInstancesOfferings: ( config: EC2PaginationConfiguration, input: DescribeReservedInstancesOfferingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedInstancesOfferingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeReservedInstancesOfferingsCommandInput, + DescribeReservedInstancesOfferingsCommandOutput +>(EC2Client, DescribeReservedInstancesOfferingsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeRouteTablesPaginator.ts b/clients/client-ec2/src/pagination/DescribeRouteTablesPaginator.ts index 9c6101152521..a79c02e36030 100644 --- a/clients/client-ec2/src/pagination/DescribeRouteTablesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeRouteTablesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeRouteTablesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRouteTablesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRouteTables( +export const paginateDescribeRouteTables: ( config: EC2PaginationConfiguration, input: DescribeRouteTablesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRouteTablesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeRouteTablesCommandInput, + DescribeRouteTablesCommandOutput +>(EC2Client, DescribeRouteTablesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeScheduledInstanceAvailabilityPaginator.ts b/clients/client-ec2/src/pagination/DescribeScheduledInstanceAvailabilityPaginator.ts index 7ee05c162eef..f46d9722d102 100644 --- a/clients/client-ec2/src/pagination/DescribeScheduledInstanceAvailabilityPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeScheduledInstanceAvailabilityPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeScheduledInstanceAvailabilityCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeScheduledInstanceAvailabilityCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeScheduledInstanceAvailability( +export const paginateDescribeScheduledInstanceAvailability: ( config: EC2PaginationConfiguration, input: DescribeScheduledInstanceAvailabilityCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeScheduledInstanceAvailabilityCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeScheduledInstanceAvailabilityCommandInput, + DescribeScheduledInstanceAvailabilityCommandOutput +>(EC2Client, DescribeScheduledInstanceAvailabilityCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeScheduledInstancesPaginator.ts b/clients/client-ec2/src/pagination/DescribeScheduledInstancesPaginator.ts index a4df9624ac2c..51f15e338959 100644 --- a/clients/client-ec2/src/pagination/DescribeScheduledInstancesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeScheduledInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeScheduledInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeScheduledInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeScheduledInstances( +export const paginateDescribeScheduledInstances: ( config: EC2PaginationConfiguration, input: DescribeScheduledInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeScheduledInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeScheduledInstancesCommandInput, + DescribeScheduledInstancesCommandOutput +>(EC2Client, DescribeScheduledInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeSecurityGroupRulesPaginator.ts b/clients/client-ec2/src/pagination/DescribeSecurityGroupRulesPaginator.ts index 52a1413d2bd9..32d955bb1bdf 100644 --- a/clients/client-ec2/src/pagination/DescribeSecurityGroupRulesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeSecurityGroupRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeSecurityGroupRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSecurityGroupRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSecurityGroupRules( +export const paginateDescribeSecurityGroupRules: ( config: EC2PaginationConfiguration, input: DescribeSecurityGroupRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSecurityGroupRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeSecurityGroupRulesCommandInput, + DescribeSecurityGroupRulesCommandOutput +>(EC2Client, DescribeSecurityGroupRulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeSecurityGroupsPaginator.ts b/clients/client-ec2/src/pagination/DescribeSecurityGroupsPaginator.ts index 4560d61121db..2712de6b7288 100644 --- a/clients/client-ec2/src/pagination/DescribeSecurityGroupsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeSecurityGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeSecurityGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSecurityGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSecurityGroups( +export const paginateDescribeSecurityGroups: ( config: EC2PaginationConfiguration, input: DescribeSecurityGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSecurityGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeSecurityGroupsCommandInput, + DescribeSecurityGroupsCommandOutput +>(EC2Client, DescribeSecurityGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeSnapshotTierStatusPaginator.ts b/clients/client-ec2/src/pagination/DescribeSnapshotTierStatusPaginator.ts index 8cbc4efbaf6a..9bb33b63acf9 100644 --- a/clients/client-ec2/src/pagination/DescribeSnapshotTierStatusPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeSnapshotTierStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeSnapshotTierStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSnapshotTierStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSnapshotTierStatus( +export const paginateDescribeSnapshotTierStatus: ( config: EC2PaginationConfiguration, input: DescribeSnapshotTierStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSnapshotTierStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeSnapshotTierStatusCommandInput, + DescribeSnapshotTierStatusCommandOutput +>(EC2Client, DescribeSnapshotTierStatusCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeSnapshotsPaginator.ts b/clients/client-ec2/src/pagination/DescribeSnapshotsPaginator.ts index 3733ed9d496f..1e799d5d8241 100644 --- a/clients/client-ec2/src/pagination/DescribeSnapshotsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSnapshots( +export const paginateDescribeSnapshots: ( config: EC2PaginationConfiguration, input: DescribeSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSnapshotsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeSnapshotsCommandInput, + DescribeSnapshotsCommandOutput +>(EC2Client, DescribeSnapshotsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeSpotFleetRequestsPaginator.ts b/clients/client-ec2/src/pagination/DescribeSpotFleetRequestsPaginator.ts index 72cc71e53f6b..2da330a4f864 100644 --- a/clients/client-ec2/src/pagination/DescribeSpotFleetRequestsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeSpotFleetRequestsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeSpotFleetRequestsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSpotFleetRequestsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSpotFleetRequests( +export const paginateDescribeSpotFleetRequests: ( config: EC2PaginationConfiguration, input: DescribeSpotFleetRequestsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSpotFleetRequestsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeSpotFleetRequestsCommandInput, + DescribeSpotFleetRequestsCommandOutput +>(EC2Client, DescribeSpotFleetRequestsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeSpotInstanceRequestsPaginator.ts b/clients/client-ec2/src/pagination/DescribeSpotInstanceRequestsPaginator.ts index 9dc7335334be..e1fb7caf55c2 100644 --- a/clients/client-ec2/src/pagination/DescribeSpotInstanceRequestsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeSpotInstanceRequestsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeSpotInstanceRequestsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSpotInstanceRequestsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSpotInstanceRequests( +export const paginateDescribeSpotInstanceRequests: ( config: EC2PaginationConfiguration, input: DescribeSpotInstanceRequestsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSpotInstanceRequestsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeSpotInstanceRequestsCommandInput, + DescribeSpotInstanceRequestsCommandOutput +>(EC2Client, DescribeSpotInstanceRequestsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeSpotPriceHistoryPaginator.ts b/clients/client-ec2/src/pagination/DescribeSpotPriceHistoryPaginator.ts index bd836cfa5375..5f00d3643e6b 100644 --- a/clients/client-ec2/src/pagination/DescribeSpotPriceHistoryPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeSpotPriceHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeSpotPriceHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSpotPriceHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSpotPriceHistory( +export const paginateDescribeSpotPriceHistory: ( config: EC2PaginationConfiguration, input: DescribeSpotPriceHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSpotPriceHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeSpotPriceHistoryCommandInput, + DescribeSpotPriceHistoryCommandOutput +>(EC2Client, DescribeSpotPriceHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeStaleSecurityGroupsPaginator.ts b/clients/client-ec2/src/pagination/DescribeStaleSecurityGroupsPaginator.ts index 8a6df0ae5d10..cc56b02f12de 100644 --- a/clients/client-ec2/src/pagination/DescribeStaleSecurityGroupsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeStaleSecurityGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeStaleSecurityGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeStaleSecurityGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeStaleSecurityGroups( +export const paginateDescribeStaleSecurityGroups: ( config: EC2PaginationConfiguration, input: DescribeStaleSecurityGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeStaleSecurityGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeStaleSecurityGroupsCommandInput, + DescribeStaleSecurityGroupsCommandOutput +>(EC2Client, DescribeStaleSecurityGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeStoreImageTasksPaginator.ts b/clients/client-ec2/src/pagination/DescribeStoreImageTasksPaginator.ts index a7a39a785c54..c64e4251c4c7 100644 --- a/clients/client-ec2/src/pagination/DescribeStoreImageTasksPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeStoreImageTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeStoreImageTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeStoreImageTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeStoreImageTasks( +export const paginateDescribeStoreImageTasks: ( config: EC2PaginationConfiguration, input: DescribeStoreImageTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeStoreImageTasksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeStoreImageTasksCommandInput, + DescribeStoreImageTasksCommandOutput +>(EC2Client, DescribeStoreImageTasksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeSubnetsPaginator.ts b/clients/client-ec2/src/pagination/DescribeSubnetsPaginator.ts index 7233531a1c27..81f748859754 100644 --- a/clients/client-ec2/src/pagination/DescribeSubnetsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeSubnetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeSubnetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSubnetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSubnets( +export const paginateDescribeSubnets: ( config: EC2PaginationConfiguration, input: DescribeSubnetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSubnetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeSubnetsCommandInput, + DescribeSubnetsCommandOutput +>(EC2Client, DescribeSubnetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTagsPaginator.ts b/clients/client-ec2/src/pagination/DescribeTagsPaginator.ts index c605f3482e3b..04878538d5cb 100644 --- a/clients/client-ec2/src/pagination/DescribeTagsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTags( +export const paginateDescribeTags: ( config: EC2PaginationConfiguration, input: DescribeTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTagsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTagsCommandInput, + DescribeTagsCommandOutput +>(EC2Client, DescribeTagsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTrafficMirrorFiltersPaginator.ts b/clients/client-ec2/src/pagination/DescribeTrafficMirrorFiltersPaginator.ts index fba3030a7fd2..6fe3a10bf964 100644 --- a/clients/client-ec2/src/pagination/DescribeTrafficMirrorFiltersPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTrafficMirrorFiltersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTrafficMirrorFiltersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTrafficMirrorFiltersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTrafficMirrorFilters( +export const paginateDescribeTrafficMirrorFilters: ( config: EC2PaginationConfiguration, input: DescribeTrafficMirrorFiltersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTrafficMirrorFiltersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTrafficMirrorFiltersCommandInput, + DescribeTrafficMirrorFiltersCommandOutput +>(EC2Client, DescribeTrafficMirrorFiltersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTrafficMirrorSessionsPaginator.ts b/clients/client-ec2/src/pagination/DescribeTrafficMirrorSessionsPaginator.ts index b33ddcaec9dc..3db590e738b5 100644 --- a/clients/client-ec2/src/pagination/DescribeTrafficMirrorSessionsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTrafficMirrorSessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTrafficMirrorSessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTrafficMirrorSessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTrafficMirrorSessions( +export const paginateDescribeTrafficMirrorSessions: ( config: EC2PaginationConfiguration, input: DescribeTrafficMirrorSessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTrafficMirrorSessionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTrafficMirrorSessionsCommandInput, + DescribeTrafficMirrorSessionsCommandOutput +>(EC2Client, DescribeTrafficMirrorSessionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTrafficMirrorTargetsPaginator.ts b/clients/client-ec2/src/pagination/DescribeTrafficMirrorTargetsPaginator.ts index 5bc82f58329a..0672b4ac5abf 100644 --- a/clients/client-ec2/src/pagination/DescribeTrafficMirrorTargetsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTrafficMirrorTargetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTrafficMirrorTargetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTrafficMirrorTargetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTrafficMirrorTargets( +export const paginateDescribeTrafficMirrorTargets: ( config: EC2PaginationConfiguration, input: DescribeTrafficMirrorTargetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTrafficMirrorTargetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTrafficMirrorTargetsCommandInput, + DescribeTrafficMirrorTargetsCommandOutput +>(EC2Client, DescribeTrafficMirrorTargetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTransitGatewayAttachmentsPaginator.ts b/clients/client-ec2/src/pagination/DescribeTransitGatewayAttachmentsPaginator.ts index 80ec51625f65..31367b4345c2 100644 --- a/clients/client-ec2/src/pagination/DescribeTransitGatewayAttachmentsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTransitGatewayAttachmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTransitGatewayAttachmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTransitGatewayAttachmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTransitGatewayAttachments( +export const paginateDescribeTransitGatewayAttachments: ( config: EC2PaginationConfiguration, input: DescribeTransitGatewayAttachmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTransitGatewayAttachmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTransitGatewayAttachmentsCommandInput, + DescribeTransitGatewayAttachmentsCommandOutput +>(EC2Client, DescribeTransitGatewayAttachmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTransitGatewayConnectPeersPaginator.ts b/clients/client-ec2/src/pagination/DescribeTransitGatewayConnectPeersPaginator.ts index 4446d7b23eb0..9339630bacc0 100644 --- a/clients/client-ec2/src/pagination/DescribeTransitGatewayConnectPeersPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTransitGatewayConnectPeersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTransitGatewayConnectPeersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTransitGatewayConnectPeersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTransitGatewayConnectPeers( +export const paginateDescribeTransitGatewayConnectPeers: ( config: EC2PaginationConfiguration, input: DescribeTransitGatewayConnectPeersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTransitGatewayConnectPeersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTransitGatewayConnectPeersCommandInput, + DescribeTransitGatewayConnectPeersCommandOutput +>(EC2Client, DescribeTransitGatewayConnectPeersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTransitGatewayConnectsPaginator.ts b/clients/client-ec2/src/pagination/DescribeTransitGatewayConnectsPaginator.ts index 42109cf46684..c84d50fc22e0 100644 --- a/clients/client-ec2/src/pagination/DescribeTransitGatewayConnectsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTransitGatewayConnectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTransitGatewayConnectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTransitGatewayConnectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTransitGatewayConnects( +export const paginateDescribeTransitGatewayConnects: ( config: EC2PaginationConfiguration, input: DescribeTransitGatewayConnectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTransitGatewayConnectsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTransitGatewayConnectsCommandInput, + DescribeTransitGatewayConnectsCommandOutput +>(EC2Client, DescribeTransitGatewayConnectsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTransitGatewayMulticastDomainsPaginator.ts b/clients/client-ec2/src/pagination/DescribeTransitGatewayMulticastDomainsPaginator.ts index 90e0bdba7ab5..36d8f3b18d74 100644 --- a/clients/client-ec2/src/pagination/DescribeTransitGatewayMulticastDomainsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTransitGatewayMulticastDomainsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTransitGatewayMulticastDomainsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTransitGatewayMulticastDomainsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTransitGatewayMulticastDomains( +export const paginateDescribeTransitGatewayMulticastDomains: ( config: EC2PaginationConfiguration, input: DescribeTransitGatewayMulticastDomainsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTransitGatewayMulticastDomainsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTransitGatewayMulticastDomainsCommandInput, + DescribeTransitGatewayMulticastDomainsCommandOutput +>(EC2Client, DescribeTransitGatewayMulticastDomainsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTransitGatewayPeeringAttachmentsPaginator.ts b/clients/client-ec2/src/pagination/DescribeTransitGatewayPeeringAttachmentsPaginator.ts index 0ac2e5934825..f6843803d1f7 100644 --- a/clients/client-ec2/src/pagination/DescribeTransitGatewayPeeringAttachmentsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTransitGatewayPeeringAttachmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTransitGatewayPeeringAttachmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTransitGatewayPeeringAttachmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTransitGatewayPeeringAttachments( +export const paginateDescribeTransitGatewayPeeringAttachments: ( config: EC2PaginationConfiguration, input: DescribeTransitGatewayPeeringAttachmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTransitGatewayPeeringAttachmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTransitGatewayPeeringAttachmentsCommandInput, + DescribeTransitGatewayPeeringAttachmentsCommandOutput +>(EC2Client, DescribeTransitGatewayPeeringAttachmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTransitGatewayPolicyTablesPaginator.ts b/clients/client-ec2/src/pagination/DescribeTransitGatewayPolicyTablesPaginator.ts index 568c8daf686f..7656e6398a4b 100644 --- a/clients/client-ec2/src/pagination/DescribeTransitGatewayPolicyTablesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTransitGatewayPolicyTablesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTransitGatewayPolicyTablesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTransitGatewayPolicyTablesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTransitGatewayPolicyTables( +export const paginateDescribeTransitGatewayPolicyTables: ( config: EC2PaginationConfiguration, input: DescribeTransitGatewayPolicyTablesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTransitGatewayPolicyTablesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTransitGatewayPolicyTablesCommandInput, + DescribeTransitGatewayPolicyTablesCommandOutput +>(EC2Client, DescribeTransitGatewayPolicyTablesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTransitGatewayRouteTableAnnouncementsPaginator.ts b/clients/client-ec2/src/pagination/DescribeTransitGatewayRouteTableAnnouncementsPaginator.ts index c45aa1b17325..9f9926649dc2 100644 --- a/clients/client-ec2/src/pagination/DescribeTransitGatewayRouteTableAnnouncementsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTransitGatewayRouteTableAnnouncementsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTransitGatewayRouteTableAnnouncementsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTransitGatewayRouteTableAnnouncementsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTransitGatewayRouteTableAnnouncements( +export const paginateDescribeTransitGatewayRouteTableAnnouncements: ( config: EC2PaginationConfiguration, input: DescribeTransitGatewayRouteTableAnnouncementsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTransitGatewayRouteTableAnnouncementsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTransitGatewayRouteTableAnnouncementsCommandInput, + DescribeTransitGatewayRouteTableAnnouncementsCommandOutput +>(EC2Client, DescribeTransitGatewayRouteTableAnnouncementsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTransitGatewayRouteTablesPaginator.ts b/clients/client-ec2/src/pagination/DescribeTransitGatewayRouteTablesPaginator.ts index 732407e44310..65de33674afd 100644 --- a/clients/client-ec2/src/pagination/DescribeTransitGatewayRouteTablesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTransitGatewayRouteTablesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTransitGatewayRouteTablesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTransitGatewayRouteTablesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTransitGatewayRouteTables( +export const paginateDescribeTransitGatewayRouteTables: ( config: EC2PaginationConfiguration, input: DescribeTransitGatewayRouteTablesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTransitGatewayRouteTablesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTransitGatewayRouteTablesCommandInput, + DescribeTransitGatewayRouteTablesCommandOutput +>(EC2Client, DescribeTransitGatewayRouteTablesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTransitGatewayVpcAttachmentsPaginator.ts b/clients/client-ec2/src/pagination/DescribeTransitGatewayVpcAttachmentsPaginator.ts index d214e9c90019..dcbc82741d80 100644 --- a/clients/client-ec2/src/pagination/DescribeTransitGatewayVpcAttachmentsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTransitGatewayVpcAttachmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTransitGatewayVpcAttachmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTransitGatewayVpcAttachmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTransitGatewayVpcAttachments( +export const paginateDescribeTransitGatewayVpcAttachments: ( config: EC2PaginationConfiguration, input: DescribeTransitGatewayVpcAttachmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTransitGatewayVpcAttachmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTransitGatewayVpcAttachmentsCommandInput, + DescribeTransitGatewayVpcAttachmentsCommandOutput +>(EC2Client, DescribeTransitGatewayVpcAttachmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTransitGatewaysPaginator.ts b/clients/client-ec2/src/pagination/DescribeTransitGatewaysPaginator.ts index 09f2ffd038c3..1b22848b9ee1 100644 --- a/clients/client-ec2/src/pagination/DescribeTransitGatewaysPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTransitGatewaysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTransitGatewaysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTransitGatewaysCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTransitGateways( +export const paginateDescribeTransitGateways: ( config: EC2PaginationConfiguration, input: DescribeTransitGatewaysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTransitGatewaysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTransitGatewaysCommandInput, + DescribeTransitGatewaysCommandOutput +>(EC2Client, DescribeTransitGatewaysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeTrunkInterfaceAssociationsPaginator.ts b/clients/client-ec2/src/pagination/DescribeTrunkInterfaceAssociationsPaginator.ts index 51034320e6a9..decd9d6a675c 100644 --- a/clients/client-ec2/src/pagination/DescribeTrunkInterfaceAssociationsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeTrunkInterfaceAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeTrunkInterfaceAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTrunkInterfaceAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTrunkInterfaceAssociations( +export const paginateDescribeTrunkInterfaceAssociations: ( config: EC2PaginationConfiguration, input: DescribeTrunkInterfaceAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTrunkInterfaceAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeTrunkInterfaceAssociationsCommandInput, + DescribeTrunkInterfaceAssociationsCommandOutput +>(EC2Client, DescribeTrunkInterfaceAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVerifiedAccessEndpointsPaginator.ts b/clients/client-ec2/src/pagination/DescribeVerifiedAccessEndpointsPaginator.ts index 4f204f708dfb..94fe5bdba47b 100644 --- a/clients/client-ec2/src/pagination/DescribeVerifiedAccessEndpointsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVerifiedAccessEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVerifiedAccessEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVerifiedAccessEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVerifiedAccessEndpoints( +export const paginateDescribeVerifiedAccessEndpoints: ( config: EC2PaginationConfiguration, input: DescribeVerifiedAccessEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVerifiedAccessEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVerifiedAccessEndpointsCommandInput, + DescribeVerifiedAccessEndpointsCommandOutput +>(EC2Client, DescribeVerifiedAccessEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVerifiedAccessGroupsPaginator.ts b/clients/client-ec2/src/pagination/DescribeVerifiedAccessGroupsPaginator.ts index d8eab1969b28..444e38653889 100644 --- a/clients/client-ec2/src/pagination/DescribeVerifiedAccessGroupsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVerifiedAccessGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVerifiedAccessGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVerifiedAccessGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVerifiedAccessGroups( +export const paginateDescribeVerifiedAccessGroups: ( config: EC2PaginationConfiguration, input: DescribeVerifiedAccessGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVerifiedAccessGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVerifiedAccessGroupsCommandInput, + DescribeVerifiedAccessGroupsCommandOutput +>(EC2Client, DescribeVerifiedAccessGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVerifiedAccessInstanceLoggingConfigurationsPaginator.ts b/clients/client-ec2/src/pagination/DescribeVerifiedAccessInstanceLoggingConfigurationsPaginator.ts index ffd1de381935..17d0502d704b 100644 --- a/clients/client-ec2/src/pagination/DescribeVerifiedAccessInstanceLoggingConfigurationsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVerifiedAccessInstanceLoggingConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVerifiedAccessInstanceLoggingConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVerifiedAccessInstanceLoggingConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVerifiedAccessInstanceLoggingConfigurations( +export const paginateDescribeVerifiedAccessInstanceLoggingConfigurations: ( config: EC2PaginationConfiguration, input: DescribeVerifiedAccessInstanceLoggingConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVerifiedAccessInstanceLoggingConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVerifiedAccessInstanceLoggingConfigurationsCommandInput, + DescribeVerifiedAccessInstanceLoggingConfigurationsCommandOutput +>(EC2Client, DescribeVerifiedAccessInstanceLoggingConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVerifiedAccessInstancesPaginator.ts b/clients/client-ec2/src/pagination/DescribeVerifiedAccessInstancesPaginator.ts index 5f03ce159291..0cf397de1376 100644 --- a/clients/client-ec2/src/pagination/DescribeVerifiedAccessInstancesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVerifiedAccessInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVerifiedAccessInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVerifiedAccessInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVerifiedAccessInstances( +export const paginateDescribeVerifiedAccessInstances: ( config: EC2PaginationConfiguration, input: DescribeVerifiedAccessInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVerifiedAccessInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVerifiedAccessInstancesCommandInput, + DescribeVerifiedAccessInstancesCommandOutput +>(EC2Client, DescribeVerifiedAccessInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVerifiedAccessTrustProvidersPaginator.ts b/clients/client-ec2/src/pagination/DescribeVerifiedAccessTrustProvidersPaginator.ts index 3faadad0a1f4..57088c72a47d 100644 --- a/clients/client-ec2/src/pagination/DescribeVerifiedAccessTrustProvidersPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVerifiedAccessTrustProvidersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVerifiedAccessTrustProvidersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVerifiedAccessTrustProvidersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVerifiedAccessTrustProviders( +export const paginateDescribeVerifiedAccessTrustProviders: ( config: EC2PaginationConfiguration, input: DescribeVerifiedAccessTrustProvidersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVerifiedAccessTrustProvidersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVerifiedAccessTrustProvidersCommandInput, + DescribeVerifiedAccessTrustProvidersCommandOutput +>(EC2Client, DescribeVerifiedAccessTrustProvidersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVolumeStatusPaginator.ts b/clients/client-ec2/src/pagination/DescribeVolumeStatusPaginator.ts index e0ca5ea2b0d0..3187eec9c577 100644 --- a/clients/client-ec2/src/pagination/DescribeVolumeStatusPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVolumeStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVolumeStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVolumeStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVolumeStatus( +export const paginateDescribeVolumeStatus: ( config: EC2PaginationConfiguration, input: DescribeVolumeStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVolumeStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVolumeStatusCommandInput, + DescribeVolumeStatusCommandOutput +>(EC2Client, DescribeVolumeStatusCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVolumesModificationsPaginator.ts b/clients/client-ec2/src/pagination/DescribeVolumesModificationsPaginator.ts index e75d6b8651db..50fa2f9a2fd5 100644 --- a/clients/client-ec2/src/pagination/DescribeVolumesModificationsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVolumesModificationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVolumesModificationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVolumesModificationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVolumesModifications( +export const paginateDescribeVolumesModifications: ( config: EC2PaginationConfiguration, input: DescribeVolumesModificationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVolumesModificationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVolumesModificationsCommandInput, + DescribeVolumesModificationsCommandOutput +>(EC2Client, DescribeVolumesModificationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVolumesPaginator.ts b/clients/client-ec2/src/pagination/DescribeVolumesPaginator.ts index 2b74ea059ca3..39ab327f54c3 100644 --- a/clients/client-ec2/src/pagination/DescribeVolumesPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVolumesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVolumesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVolumesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVolumes( +export const paginateDescribeVolumes: ( config: EC2PaginationConfiguration, input: DescribeVolumesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVolumesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVolumesCommandInput, + DescribeVolumesCommandOutput +>(EC2Client, DescribeVolumesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVpcClassicLinkDnsSupportPaginator.ts b/clients/client-ec2/src/pagination/DescribeVpcClassicLinkDnsSupportPaginator.ts index 34b61c769b12..dd4572101577 100644 --- a/clients/client-ec2/src/pagination/DescribeVpcClassicLinkDnsSupportPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVpcClassicLinkDnsSupportPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVpcClassicLinkDnsSupportCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVpcClassicLinkDnsSupportCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVpcClassicLinkDnsSupport( +export const paginateDescribeVpcClassicLinkDnsSupport: ( config: EC2PaginationConfiguration, input: DescribeVpcClassicLinkDnsSupportCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVpcClassicLinkDnsSupportCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVpcClassicLinkDnsSupportCommandInput, + DescribeVpcClassicLinkDnsSupportCommandOutput +>(EC2Client, DescribeVpcClassicLinkDnsSupportCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVpcEndpointConnectionNotificationsPaginator.ts b/clients/client-ec2/src/pagination/DescribeVpcEndpointConnectionNotificationsPaginator.ts index 366a216fd59f..89f3a0a313cd 100644 --- a/clients/client-ec2/src/pagination/DescribeVpcEndpointConnectionNotificationsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVpcEndpointConnectionNotificationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVpcEndpointConnectionNotificationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVpcEndpointConnectionNotificationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVpcEndpointConnectionNotifications( +export const paginateDescribeVpcEndpointConnectionNotifications: ( config: EC2PaginationConfiguration, input: DescribeVpcEndpointConnectionNotificationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVpcEndpointConnectionNotificationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVpcEndpointConnectionNotificationsCommandInput, + DescribeVpcEndpointConnectionNotificationsCommandOutput +>(EC2Client, DescribeVpcEndpointConnectionNotificationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVpcEndpointConnectionsPaginator.ts b/clients/client-ec2/src/pagination/DescribeVpcEndpointConnectionsPaginator.ts index 95e0efd799d9..ce4ea181fb38 100644 --- a/clients/client-ec2/src/pagination/DescribeVpcEndpointConnectionsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVpcEndpointConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVpcEndpointConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVpcEndpointConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVpcEndpointConnections( +export const paginateDescribeVpcEndpointConnections: ( config: EC2PaginationConfiguration, input: DescribeVpcEndpointConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVpcEndpointConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVpcEndpointConnectionsCommandInput, + DescribeVpcEndpointConnectionsCommandOutput +>(EC2Client, DescribeVpcEndpointConnectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVpcEndpointServiceConfigurationsPaginator.ts b/clients/client-ec2/src/pagination/DescribeVpcEndpointServiceConfigurationsPaginator.ts index 36e9c89b169d..388a137d9b0c 100644 --- a/clients/client-ec2/src/pagination/DescribeVpcEndpointServiceConfigurationsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVpcEndpointServiceConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVpcEndpointServiceConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVpcEndpointServiceConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVpcEndpointServiceConfigurations( +export const paginateDescribeVpcEndpointServiceConfigurations: ( config: EC2PaginationConfiguration, input: DescribeVpcEndpointServiceConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVpcEndpointServiceConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVpcEndpointServiceConfigurationsCommandInput, + DescribeVpcEndpointServiceConfigurationsCommandOutput +>(EC2Client, DescribeVpcEndpointServiceConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVpcEndpointServicePermissionsPaginator.ts b/clients/client-ec2/src/pagination/DescribeVpcEndpointServicePermissionsPaginator.ts index 3cb429f28ba9..2353a029ec08 100644 --- a/clients/client-ec2/src/pagination/DescribeVpcEndpointServicePermissionsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVpcEndpointServicePermissionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVpcEndpointServicePermissionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVpcEndpointServicePermissionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVpcEndpointServicePermissions( +export const paginateDescribeVpcEndpointServicePermissions: ( config: EC2PaginationConfiguration, input: DescribeVpcEndpointServicePermissionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVpcEndpointServicePermissionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVpcEndpointServicePermissionsCommandInput, + DescribeVpcEndpointServicePermissionsCommandOutput +>(EC2Client, DescribeVpcEndpointServicePermissionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVpcEndpointsPaginator.ts b/clients/client-ec2/src/pagination/DescribeVpcEndpointsPaginator.ts index 6198770aa261..2da821c1d0cd 100644 --- a/clients/client-ec2/src/pagination/DescribeVpcEndpointsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVpcEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVpcEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVpcEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVpcEndpoints( +export const paginateDescribeVpcEndpoints: ( config: EC2PaginationConfiguration, input: DescribeVpcEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVpcEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVpcEndpointsCommandInput, + DescribeVpcEndpointsCommandOutput +>(EC2Client, DescribeVpcEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVpcPeeringConnectionsPaginator.ts b/clients/client-ec2/src/pagination/DescribeVpcPeeringConnectionsPaginator.ts index c8df85238d34..72ffe3c8b8b8 100644 --- a/clients/client-ec2/src/pagination/DescribeVpcPeeringConnectionsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVpcPeeringConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVpcPeeringConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVpcPeeringConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVpcPeeringConnections( +export const paginateDescribeVpcPeeringConnections: ( config: EC2PaginationConfiguration, input: DescribeVpcPeeringConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVpcPeeringConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVpcPeeringConnectionsCommandInput, + DescribeVpcPeeringConnectionsCommandOutput +>(EC2Client, DescribeVpcPeeringConnectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/DescribeVpcsPaginator.ts b/clients/client-ec2/src/pagination/DescribeVpcsPaginator.ts index 472452952f44..9668f35c291d 100644 --- a/clients/client-ec2/src/pagination/DescribeVpcsPaginator.ts +++ b/clients/client-ec2/src/pagination/DescribeVpcsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: DescribeVpcsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVpcsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVpcs( +export const paginateDescribeVpcs: ( config: EC2PaginationConfiguration, input: DescribeVpcsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVpcsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + DescribeVpcsCommandInput, + DescribeVpcsCommandOutput +>(EC2Client, DescribeVpcsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetAssociatedIpv6PoolCidrsPaginator.ts b/clients/client-ec2/src/pagination/GetAssociatedIpv6PoolCidrsPaginator.ts index e20ae940c462..300c5faa398a 100644 --- a/clients/client-ec2/src/pagination/GetAssociatedIpv6PoolCidrsPaginator.ts +++ b/clients/client-ec2/src/pagination/GetAssociatedIpv6PoolCidrsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetAssociatedIpv6PoolCidrsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetAssociatedIpv6PoolCidrsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetAssociatedIpv6PoolCidrs( +export const paginateGetAssociatedIpv6PoolCidrs: ( config: EC2PaginationConfiguration, input: GetAssociatedIpv6PoolCidrsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetAssociatedIpv6PoolCidrsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetAssociatedIpv6PoolCidrsCommandInput, + GetAssociatedIpv6PoolCidrsCommandOutput +>(EC2Client, GetAssociatedIpv6PoolCidrsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetAwsNetworkPerformanceDataPaginator.ts b/clients/client-ec2/src/pagination/GetAwsNetworkPerformanceDataPaginator.ts index 7e1272d704b2..895c2dd6274a 100644 --- a/clients/client-ec2/src/pagination/GetAwsNetworkPerformanceDataPaginator.ts +++ b/clients/client-ec2/src/pagination/GetAwsNetworkPerformanceDataPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetAwsNetworkPerformanceDataCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetAwsNetworkPerformanceDataCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetAwsNetworkPerformanceData( +export const paginateGetAwsNetworkPerformanceData: ( config: EC2PaginationConfiguration, input: GetAwsNetworkPerformanceDataCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetAwsNetworkPerformanceDataCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetAwsNetworkPerformanceDataCommandInput, + GetAwsNetworkPerformanceDataCommandOutput +>(EC2Client, GetAwsNetworkPerformanceDataCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetGroupsForCapacityReservationPaginator.ts b/clients/client-ec2/src/pagination/GetGroupsForCapacityReservationPaginator.ts index 3ed3db57e1ca..89e0c8f875af 100644 --- a/clients/client-ec2/src/pagination/GetGroupsForCapacityReservationPaginator.ts +++ b/clients/client-ec2/src/pagination/GetGroupsForCapacityReservationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetGroupsForCapacityReservationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetGroupsForCapacityReservationCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetGroupsForCapacityReservation( +export const paginateGetGroupsForCapacityReservation: ( config: EC2PaginationConfiguration, input: GetGroupsForCapacityReservationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetGroupsForCapacityReservationCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetGroupsForCapacityReservationCommandInput, + GetGroupsForCapacityReservationCommandOutput +>(EC2Client, GetGroupsForCapacityReservationCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetInstanceTypesFromInstanceRequirementsPaginator.ts b/clients/client-ec2/src/pagination/GetInstanceTypesFromInstanceRequirementsPaginator.ts index dcc6a33264be..7069fc269f5d 100644 --- a/clients/client-ec2/src/pagination/GetInstanceTypesFromInstanceRequirementsPaginator.ts +++ b/clients/client-ec2/src/pagination/GetInstanceTypesFromInstanceRequirementsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetInstanceTypesFromInstanceRequirementsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetInstanceTypesFromInstanceRequirementsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetInstanceTypesFromInstanceRequirements( +export const paginateGetInstanceTypesFromInstanceRequirements: ( config: EC2PaginationConfiguration, input: GetInstanceTypesFromInstanceRequirementsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetInstanceTypesFromInstanceRequirementsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetInstanceTypesFromInstanceRequirementsCommandInput, + GetInstanceTypesFromInstanceRequirementsCommandOutput +>(EC2Client, GetInstanceTypesFromInstanceRequirementsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetIpamAddressHistoryPaginator.ts b/clients/client-ec2/src/pagination/GetIpamAddressHistoryPaginator.ts index ce147ed9396e..720c6eb13b7c 100644 --- a/clients/client-ec2/src/pagination/GetIpamAddressHistoryPaginator.ts +++ b/clients/client-ec2/src/pagination/GetIpamAddressHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetIpamAddressHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetIpamAddressHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetIpamAddressHistory( +export const paginateGetIpamAddressHistory: ( config: EC2PaginationConfiguration, input: GetIpamAddressHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetIpamAddressHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetIpamAddressHistoryCommandInput, + GetIpamAddressHistoryCommandOutput +>(EC2Client, GetIpamAddressHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetIpamDiscoveredAccountsPaginator.ts b/clients/client-ec2/src/pagination/GetIpamDiscoveredAccountsPaginator.ts index d74685c493bf..174d8e5f9b51 100644 --- a/clients/client-ec2/src/pagination/GetIpamDiscoveredAccountsPaginator.ts +++ b/clients/client-ec2/src/pagination/GetIpamDiscoveredAccountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetIpamDiscoveredAccountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetIpamDiscoveredAccountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetIpamDiscoveredAccounts( +export const paginateGetIpamDiscoveredAccounts: ( config: EC2PaginationConfiguration, input: GetIpamDiscoveredAccountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetIpamDiscoveredAccountsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetIpamDiscoveredAccountsCommandInput, + GetIpamDiscoveredAccountsCommandOutput +>(EC2Client, GetIpamDiscoveredAccountsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetIpamDiscoveredResourceCidrsPaginator.ts b/clients/client-ec2/src/pagination/GetIpamDiscoveredResourceCidrsPaginator.ts index 916df3275d06..cf2c1a747aba 100644 --- a/clients/client-ec2/src/pagination/GetIpamDiscoveredResourceCidrsPaginator.ts +++ b/clients/client-ec2/src/pagination/GetIpamDiscoveredResourceCidrsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetIpamDiscoveredResourceCidrsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetIpamDiscoveredResourceCidrsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetIpamDiscoveredResourceCidrs( +export const paginateGetIpamDiscoveredResourceCidrs: ( config: EC2PaginationConfiguration, input: GetIpamDiscoveredResourceCidrsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetIpamDiscoveredResourceCidrsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetIpamDiscoveredResourceCidrsCommandInput, + GetIpamDiscoveredResourceCidrsCommandOutput +>(EC2Client, GetIpamDiscoveredResourceCidrsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetIpamPoolAllocationsPaginator.ts b/clients/client-ec2/src/pagination/GetIpamPoolAllocationsPaginator.ts index 7a5da61ce6d4..815402ea804a 100644 --- a/clients/client-ec2/src/pagination/GetIpamPoolAllocationsPaginator.ts +++ b/clients/client-ec2/src/pagination/GetIpamPoolAllocationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetIpamPoolAllocationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetIpamPoolAllocationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetIpamPoolAllocations( +export const paginateGetIpamPoolAllocations: ( config: EC2PaginationConfiguration, input: GetIpamPoolAllocationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetIpamPoolAllocationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetIpamPoolAllocationsCommandInput, + GetIpamPoolAllocationsCommandOutput +>(EC2Client, GetIpamPoolAllocationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetIpamPoolCidrsPaginator.ts b/clients/client-ec2/src/pagination/GetIpamPoolCidrsPaginator.ts index 6a138ee9092d..bb0f77645215 100644 --- a/clients/client-ec2/src/pagination/GetIpamPoolCidrsPaginator.ts +++ b/clients/client-ec2/src/pagination/GetIpamPoolCidrsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetIpamPoolCidrsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetIpamPoolCidrsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetIpamPoolCidrs( +export const paginateGetIpamPoolCidrs: ( config: EC2PaginationConfiguration, input: GetIpamPoolCidrsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetIpamPoolCidrsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetIpamPoolCidrsCommandInput, + GetIpamPoolCidrsCommandOutput +>(EC2Client, GetIpamPoolCidrsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetIpamResourceCidrsPaginator.ts b/clients/client-ec2/src/pagination/GetIpamResourceCidrsPaginator.ts index c94c4b2e133e..556e58791af0 100644 --- a/clients/client-ec2/src/pagination/GetIpamResourceCidrsPaginator.ts +++ b/clients/client-ec2/src/pagination/GetIpamResourceCidrsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetIpamResourceCidrsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetIpamResourceCidrsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetIpamResourceCidrs( +export const paginateGetIpamResourceCidrs: ( config: EC2PaginationConfiguration, input: GetIpamResourceCidrsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetIpamResourceCidrsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetIpamResourceCidrsCommandInput, + GetIpamResourceCidrsCommandOutput +>(EC2Client, GetIpamResourceCidrsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetManagedPrefixListAssociationsPaginator.ts b/clients/client-ec2/src/pagination/GetManagedPrefixListAssociationsPaginator.ts index 4db3b8a3ab8c..21f8216dfd11 100644 --- a/clients/client-ec2/src/pagination/GetManagedPrefixListAssociationsPaginator.ts +++ b/clients/client-ec2/src/pagination/GetManagedPrefixListAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetManagedPrefixListAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetManagedPrefixListAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetManagedPrefixListAssociations( +export const paginateGetManagedPrefixListAssociations: ( config: EC2PaginationConfiguration, input: GetManagedPrefixListAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetManagedPrefixListAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetManagedPrefixListAssociationsCommandInput, + GetManagedPrefixListAssociationsCommandOutput +>(EC2Client, GetManagedPrefixListAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetManagedPrefixListEntriesPaginator.ts b/clients/client-ec2/src/pagination/GetManagedPrefixListEntriesPaginator.ts index cd72eb3f6190..ce2aa79e9cd1 100644 --- a/clients/client-ec2/src/pagination/GetManagedPrefixListEntriesPaginator.ts +++ b/clients/client-ec2/src/pagination/GetManagedPrefixListEntriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetManagedPrefixListEntriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetManagedPrefixListEntriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetManagedPrefixListEntries( +export const paginateGetManagedPrefixListEntries: ( config: EC2PaginationConfiguration, input: GetManagedPrefixListEntriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetManagedPrefixListEntriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetManagedPrefixListEntriesCommandInput, + GetManagedPrefixListEntriesCommandOutput +>(EC2Client, GetManagedPrefixListEntriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetNetworkInsightsAccessScopeAnalysisFindingsPaginator.ts b/clients/client-ec2/src/pagination/GetNetworkInsightsAccessScopeAnalysisFindingsPaginator.ts index b172e3e41f99..db71a32b9222 100644 --- a/clients/client-ec2/src/pagination/GetNetworkInsightsAccessScopeAnalysisFindingsPaginator.ts +++ b/clients/client-ec2/src/pagination/GetNetworkInsightsAccessScopeAnalysisFindingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetNetworkInsightsAccessScopeAnalysisFindingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetNetworkInsightsAccessScopeAnalysisFindingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetNetworkInsightsAccessScopeAnalysisFindings( +export const paginateGetNetworkInsightsAccessScopeAnalysisFindings: ( config: EC2PaginationConfiguration, input: GetNetworkInsightsAccessScopeAnalysisFindingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetNetworkInsightsAccessScopeAnalysisFindingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetNetworkInsightsAccessScopeAnalysisFindingsCommandInput, + GetNetworkInsightsAccessScopeAnalysisFindingsCommandOutput +>(EC2Client, GetNetworkInsightsAccessScopeAnalysisFindingsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetSecurityGroupsForVpcPaginator.ts b/clients/client-ec2/src/pagination/GetSecurityGroupsForVpcPaginator.ts index c98331e6f72e..7f407c9b0782 100644 --- a/clients/client-ec2/src/pagination/GetSecurityGroupsForVpcPaginator.ts +++ b/clients/client-ec2/src/pagination/GetSecurityGroupsForVpcPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetSecurityGroupsForVpcCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetSecurityGroupsForVpcCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetSecurityGroupsForVpc( +export const paginateGetSecurityGroupsForVpc: ( config: EC2PaginationConfiguration, input: GetSecurityGroupsForVpcCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetSecurityGroupsForVpcCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetSecurityGroupsForVpcCommandInput, + GetSecurityGroupsForVpcCommandOutput +>(EC2Client, GetSecurityGroupsForVpcCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetSpotPlacementScoresPaginator.ts b/clients/client-ec2/src/pagination/GetSpotPlacementScoresPaginator.ts index 62f2c00c95c1..d4ddcde3d569 100644 --- a/clients/client-ec2/src/pagination/GetSpotPlacementScoresPaginator.ts +++ b/clients/client-ec2/src/pagination/GetSpotPlacementScoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetSpotPlacementScoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetSpotPlacementScoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetSpotPlacementScores( +export const paginateGetSpotPlacementScores: ( config: EC2PaginationConfiguration, input: GetSpotPlacementScoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetSpotPlacementScoresCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetSpotPlacementScoresCommandInput, + GetSpotPlacementScoresCommandOutput +>(EC2Client, GetSpotPlacementScoresCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetTransitGatewayAttachmentPropagationsPaginator.ts b/clients/client-ec2/src/pagination/GetTransitGatewayAttachmentPropagationsPaginator.ts index 93d46177c38d..0473d0654d8d 100644 --- a/clients/client-ec2/src/pagination/GetTransitGatewayAttachmentPropagationsPaginator.ts +++ b/clients/client-ec2/src/pagination/GetTransitGatewayAttachmentPropagationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetTransitGatewayAttachmentPropagationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTransitGatewayAttachmentPropagationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTransitGatewayAttachmentPropagations( +export const paginateGetTransitGatewayAttachmentPropagations: ( config: EC2PaginationConfiguration, input: GetTransitGatewayAttachmentPropagationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTransitGatewayAttachmentPropagationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetTransitGatewayAttachmentPropagationsCommandInput, + GetTransitGatewayAttachmentPropagationsCommandOutput +>(EC2Client, GetTransitGatewayAttachmentPropagationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetTransitGatewayMulticastDomainAssociationsPaginator.ts b/clients/client-ec2/src/pagination/GetTransitGatewayMulticastDomainAssociationsPaginator.ts index 444714f35036..b6104c176e87 100644 --- a/clients/client-ec2/src/pagination/GetTransitGatewayMulticastDomainAssociationsPaginator.ts +++ b/clients/client-ec2/src/pagination/GetTransitGatewayMulticastDomainAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetTransitGatewayMulticastDomainAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTransitGatewayMulticastDomainAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTransitGatewayMulticastDomainAssociations( +export const paginateGetTransitGatewayMulticastDomainAssociations: ( config: EC2PaginationConfiguration, input: GetTransitGatewayMulticastDomainAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTransitGatewayMulticastDomainAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetTransitGatewayMulticastDomainAssociationsCommandInput, + GetTransitGatewayMulticastDomainAssociationsCommandOutput +>(EC2Client, GetTransitGatewayMulticastDomainAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetTransitGatewayPolicyTableAssociationsPaginator.ts b/clients/client-ec2/src/pagination/GetTransitGatewayPolicyTableAssociationsPaginator.ts index 3b35c45eed24..86e053f110a5 100644 --- a/clients/client-ec2/src/pagination/GetTransitGatewayPolicyTableAssociationsPaginator.ts +++ b/clients/client-ec2/src/pagination/GetTransitGatewayPolicyTableAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetTransitGatewayPolicyTableAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTransitGatewayPolicyTableAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTransitGatewayPolicyTableAssociations( +export const paginateGetTransitGatewayPolicyTableAssociations: ( config: EC2PaginationConfiguration, input: GetTransitGatewayPolicyTableAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTransitGatewayPolicyTableAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetTransitGatewayPolicyTableAssociationsCommandInput, + GetTransitGatewayPolicyTableAssociationsCommandOutput +>(EC2Client, GetTransitGatewayPolicyTableAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetTransitGatewayPrefixListReferencesPaginator.ts b/clients/client-ec2/src/pagination/GetTransitGatewayPrefixListReferencesPaginator.ts index 057c8204a20d..062803f1fa15 100644 --- a/clients/client-ec2/src/pagination/GetTransitGatewayPrefixListReferencesPaginator.ts +++ b/clients/client-ec2/src/pagination/GetTransitGatewayPrefixListReferencesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetTransitGatewayPrefixListReferencesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTransitGatewayPrefixListReferencesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTransitGatewayPrefixListReferences( +export const paginateGetTransitGatewayPrefixListReferences: ( config: EC2PaginationConfiguration, input: GetTransitGatewayPrefixListReferencesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTransitGatewayPrefixListReferencesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetTransitGatewayPrefixListReferencesCommandInput, + GetTransitGatewayPrefixListReferencesCommandOutput +>(EC2Client, GetTransitGatewayPrefixListReferencesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetTransitGatewayRouteTableAssociationsPaginator.ts b/clients/client-ec2/src/pagination/GetTransitGatewayRouteTableAssociationsPaginator.ts index 00b76cf2f85a..df65bc8dcdb3 100644 --- a/clients/client-ec2/src/pagination/GetTransitGatewayRouteTableAssociationsPaginator.ts +++ b/clients/client-ec2/src/pagination/GetTransitGatewayRouteTableAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetTransitGatewayRouteTableAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTransitGatewayRouteTableAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTransitGatewayRouteTableAssociations( +export const paginateGetTransitGatewayRouteTableAssociations: ( config: EC2PaginationConfiguration, input: GetTransitGatewayRouteTableAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTransitGatewayRouteTableAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetTransitGatewayRouteTableAssociationsCommandInput, + GetTransitGatewayRouteTableAssociationsCommandOutput +>(EC2Client, GetTransitGatewayRouteTableAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetTransitGatewayRouteTablePropagationsPaginator.ts b/clients/client-ec2/src/pagination/GetTransitGatewayRouteTablePropagationsPaginator.ts index 27850a340d9b..d68647c2fd68 100644 --- a/clients/client-ec2/src/pagination/GetTransitGatewayRouteTablePropagationsPaginator.ts +++ b/clients/client-ec2/src/pagination/GetTransitGatewayRouteTablePropagationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetTransitGatewayRouteTablePropagationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTransitGatewayRouteTablePropagationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTransitGatewayRouteTablePropagations( +export const paginateGetTransitGatewayRouteTablePropagations: ( config: EC2PaginationConfiguration, input: GetTransitGatewayRouteTablePropagationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTransitGatewayRouteTablePropagationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetTransitGatewayRouteTablePropagationsCommandInput, + GetTransitGatewayRouteTablePropagationsCommandOutput +>(EC2Client, GetTransitGatewayRouteTablePropagationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/GetVpnConnectionDeviceTypesPaginator.ts b/clients/client-ec2/src/pagination/GetVpnConnectionDeviceTypesPaginator.ts index 5c89b8aaf361..462d1eaa9e71 100644 --- a/clients/client-ec2/src/pagination/GetVpnConnectionDeviceTypesPaginator.ts +++ b/clients/client-ec2/src/pagination/GetVpnConnectionDeviceTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: GetVpnConnectionDeviceTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetVpnConnectionDeviceTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetVpnConnectionDeviceTypes( +export const paginateGetVpnConnectionDeviceTypes: ( config: EC2PaginationConfiguration, input: GetVpnConnectionDeviceTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetVpnConnectionDeviceTypesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + GetVpnConnectionDeviceTypesCommandInput, + GetVpnConnectionDeviceTypesCommandOutput +>(EC2Client, GetVpnConnectionDeviceTypesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/ListImagesInRecycleBinPaginator.ts b/clients/client-ec2/src/pagination/ListImagesInRecycleBinPaginator.ts index ac5520f8f6a3..2b4eb20c74ab 100644 --- a/clients/client-ec2/src/pagination/ListImagesInRecycleBinPaginator.ts +++ b/clients/client-ec2/src/pagination/ListImagesInRecycleBinPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: ListImagesInRecycleBinCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImagesInRecycleBinCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImagesInRecycleBin( +export const paginateListImagesInRecycleBin: ( config: EC2PaginationConfiguration, input: ListImagesInRecycleBinCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImagesInRecycleBinCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + ListImagesInRecycleBinCommandInput, + ListImagesInRecycleBinCommandOutput +>(EC2Client, ListImagesInRecycleBinCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/ListSnapshotsInRecycleBinPaginator.ts b/clients/client-ec2/src/pagination/ListSnapshotsInRecycleBinPaginator.ts index 18e8a20f3c01..d204026db4df 100644 --- a/clients/client-ec2/src/pagination/ListSnapshotsInRecycleBinPaginator.ts +++ b/clients/client-ec2/src/pagination/ListSnapshotsInRecycleBinPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: ListSnapshotsInRecycleBinCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSnapshotsInRecycleBinCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSnapshotsInRecycleBin( +export const paginateListSnapshotsInRecycleBin: ( config: EC2PaginationConfiguration, input: ListSnapshotsInRecycleBinCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSnapshotsInRecycleBinCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + ListSnapshotsInRecycleBinCommandInput, + ListSnapshotsInRecycleBinCommandOutput +>(EC2Client, ListSnapshotsInRecycleBinCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/SearchLocalGatewayRoutesPaginator.ts b/clients/client-ec2/src/pagination/SearchLocalGatewayRoutesPaginator.ts index fe5732ada900..ddffa68ca5c8 100644 --- a/clients/client-ec2/src/pagination/SearchLocalGatewayRoutesPaginator.ts +++ b/clients/client-ec2/src/pagination/SearchLocalGatewayRoutesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: SearchLocalGatewayRoutesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchLocalGatewayRoutesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchLocalGatewayRoutes( +export const paginateSearchLocalGatewayRoutes: ( config: EC2PaginationConfiguration, input: SearchLocalGatewayRoutesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchLocalGatewayRoutesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + SearchLocalGatewayRoutesCommandInput, + SearchLocalGatewayRoutesCommandOutput +>(EC2Client, SearchLocalGatewayRoutesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ec2/src/pagination/SearchTransitGatewayMulticastGroupsPaginator.ts b/clients/client-ec2/src/pagination/SearchTransitGatewayMulticastGroupsPaginator.ts index 1b39c23215fe..c602f5b259d6 100644 --- a/clients/client-ec2/src/pagination/SearchTransitGatewayMulticastGroupsPaginator.ts +++ b/clients/client-ec2/src/pagination/SearchTransitGatewayMulticastGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EC2Client } from "../EC2Client"; import { EC2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EC2Client, - input: SearchTransitGatewayMulticastGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchTransitGatewayMulticastGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchTransitGatewayMulticastGroups( +export const paginateSearchTransitGatewayMulticastGroups: ( config: EC2PaginationConfiguration, input: SearchTransitGatewayMulticastGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchTransitGatewayMulticastGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EC2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EC2 | EC2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EC2PaginationConfiguration, + SearchTransitGatewayMulticastGroupsCommandInput, + SearchTransitGatewayMulticastGroupsCommandOutput +>(EC2Client, SearchTransitGatewayMulticastGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ecr-public/package.json b/clients/client-ecr-public/package.json index c3dbdf0b440a..5f71cd2ef449 100644 --- a/clients/client-ecr-public/package.json +++ b/clients/client-ecr-public/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-ecr-public/src/pagination/DescribeImageTagsPaginator.ts b/clients/client-ecr-public/src/pagination/DescribeImageTagsPaginator.ts index 05cdf3bfc781..3b2754cf22aa 100644 --- a/clients/client-ecr-public/src/pagination/DescribeImageTagsPaginator.ts +++ b/clients/client-ecr-public/src/pagination/DescribeImageTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECRPUBLICClient } from "../ECRPUBLICClient"; import { ECRPUBLICPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECRPUBLICClient, - input: DescribeImageTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeImageTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeImageTags( +export const paginateDescribeImageTags: ( config: ECRPUBLICPaginationConfiguration, input: DescribeImageTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeImageTagsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECRPUBLICClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECRPUBLIC | ECRPUBLICClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECRPUBLICPaginationConfiguration, + DescribeImageTagsCommandInput, + DescribeImageTagsCommandOutput +>(ECRPUBLICClient, DescribeImageTagsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecr-public/src/pagination/DescribeImagesPaginator.ts b/clients/client-ecr-public/src/pagination/DescribeImagesPaginator.ts index cf746016fa59..009dd28f6e67 100644 --- a/clients/client-ecr-public/src/pagination/DescribeImagesPaginator.ts +++ b/clients/client-ecr-public/src/pagination/DescribeImagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECRPUBLICClient } from "../ECRPUBLICClient"; import { ECRPUBLICPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECRPUBLICClient, - input: DescribeImagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeImagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeImages( +export const paginateDescribeImages: ( config: ECRPUBLICPaginationConfiguration, input: DescribeImagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeImagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECRPUBLICClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECRPUBLIC | ECRPUBLICClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECRPUBLICPaginationConfiguration, + DescribeImagesCommandInput, + DescribeImagesCommandOutput +>(ECRPUBLICClient, DescribeImagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecr-public/src/pagination/DescribeRegistriesPaginator.ts b/clients/client-ecr-public/src/pagination/DescribeRegistriesPaginator.ts index a58a6ae24b52..23ce2d03e959 100644 --- a/clients/client-ecr-public/src/pagination/DescribeRegistriesPaginator.ts +++ b/clients/client-ecr-public/src/pagination/DescribeRegistriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECRPUBLICClient } from "../ECRPUBLICClient"; import { ECRPUBLICPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECRPUBLICClient, - input: DescribeRegistriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRegistriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRegistries( +export const paginateDescribeRegistries: ( config: ECRPUBLICPaginationConfiguration, input: DescribeRegistriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRegistriesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECRPUBLICClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECRPUBLIC | ECRPUBLICClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECRPUBLICPaginationConfiguration, + DescribeRegistriesCommandInput, + DescribeRegistriesCommandOutput +>(ECRPUBLICClient, DescribeRegistriesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecr-public/src/pagination/DescribeRepositoriesPaginator.ts b/clients/client-ecr-public/src/pagination/DescribeRepositoriesPaginator.ts index 11feebe6d320..255626bb393c 100644 --- a/clients/client-ecr-public/src/pagination/DescribeRepositoriesPaginator.ts +++ b/clients/client-ecr-public/src/pagination/DescribeRepositoriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECRPUBLICClient } from "../ECRPUBLICClient"; import { ECRPUBLICPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECRPUBLICClient, - input: DescribeRepositoriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRepositoriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRepositories( +export const paginateDescribeRepositories: ( config: ECRPUBLICPaginationConfiguration, input: DescribeRepositoriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRepositoriesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECRPUBLICClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECRPUBLIC | ECRPUBLICClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECRPUBLICPaginationConfiguration, + DescribeRepositoriesCommandInput, + DescribeRepositoriesCommandOutput +>(ECRPUBLICClient, DescribeRepositoriesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecr/package.json b/clients/client-ecr/package.json index b8f51186ed99..b1156f55f35a 100644 --- a/clients/client-ecr/package.json +++ b/clients/client-ecr/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-ecr/src/pagination/DescribeImageScanFindingsPaginator.ts b/clients/client-ecr/src/pagination/DescribeImageScanFindingsPaginator.ts index b13b4fc9062e..f7efee0ca672 100644 --- a/clients/client-ecr/src/pagination/DescribeImageScanFindingsPaginator.ts +++ b/clients/client-ecr/src/pagination/DescribeImageScanFindingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECRClient } from "../ECRClient"; import { ECRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECRClient, - input: DescribeImageScanFindingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeImageScanFindingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeImageScanFindings( +export const paginateDescribeImageScanFindings: ( config: ECRPaginationConfiguration, input: DescribeImageScanFindingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeImageScanFindingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECR | ECRClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECRPaginationConfiguration, + DescribeImageScanFindingsCommandInput, + DescribeImageScanFindingsCommandOutput +>(ECRClient, DescribeImageScanFindingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecr/src/pagination/DescribeImagesPaginator.ts b/clients/client-ecr/src/pagination/DescribeImagesPaginator.ts index a1dca03a7bcb..ea3230722902 100644 --- a/clients/client-ecr/src/pagination/DescribeImagesPaginator.ts +++ b/clients/client-ecr/src/pagination/DescribeImagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECRClient } from "../ECRClient"; import { ECRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECRClient, - input: DescribeImagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeImagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeImages( +export const paginateDescribeImages: ( config: ECRPaginationConfiguration, input: DescribeImagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeImagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECR | ECRClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECRPaginationConfiguration, + DescribeImagesCommandInput, + DescribeImagesCommandOutput +>(ECRClient, DescribeImagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecr/src/pagination/DescribePullThroughCacheRulesPaginator.ts b/clients/client-ecr/src/pagination/DescribePullThroughCacheRulesPaginator.ts index eb506229228e..0b9cb744432a 100644 --- a/clients/client-ecr/src/pagination/DescribePullThroughCacheRulesPaginator.ts +++ b/clients/client-ecr/src/pagination/DescribePullThroughCacheRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECRClient } from "../ECRClient"; import { ECRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECRClient, - input: DescribePullThroughCacheRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePullThroughCacheRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePullThroughCacheRules( +export const paginateDescribePullThroughCacheRules: ( config: ECRPaginationConfiguration, input: DescribePullThroughCacheRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePullThroughCacheRulesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECR | ECRClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECRPaginationConfiguration, + DescribePullThroughCacheRulesCommandInput, + DescribePullThroughCacheRulesCommandOutput +>(ECRClient, DescribePullThroughCacheRulesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecr/src/pagination/DescribeRepositoriesPaginator.ts b/clients/client-ecr/src/pagination/DescribeRepositoriesPaginator.ts index b7b11b1759c4..4658918fc5d4 100644 --- a/clients/client-ecr/src/pagination/DescribeRepositoriesPaginator.ts +++ b/clients/client-ecr/src/pagination/DescribeRepositoriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECRClient } from "../ECRClient"; import { ECRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECRClient, - input: DescribeRepositoriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRepositoriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRepositories( +export const paginateDescribeRepositories: ( config: ECRPaginationConfiguration, input: DescribeRepositoriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRepositoriesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECR | ECRClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECRPaginationConfiguration, + DescribeRepositoriesCommandInput, + DescribeRepositoriesCommandOutput +>(ECRClient, DescribeRepositoriesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecr/src/pagination/GetLifecyclePolicyPreviewPaginator.ts b/clients/client-ecr/src/pagination/GetLifecyclePolicyPreviewPaginator.ts index 41c8658da112..9e7e023ff1e2 100644 --- a/clients/client-ecr/src/pagination/GetLifecyclePolicyPreviewPaginator.ts +++ b/clients/client-ecr/src/pagination/GetLifecyclePolicyPreviewPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECRClient } from "../ECRClient"; import { ECRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECRClient, - input: GetLifecyclePolicyPreviewCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetLifecyclePolicyPreviewCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetLifecyclePolicyPreview( +export const paginateGetLifecyclePolicyPreview: ( config: ECRPaginationConfiguration, input: GetLifecyclePolicyPreviewCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetLifecyclePolicyPreviewCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECR | ECRClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECRPaginationConfiguration, + GetLifecyclePolicyPreviewCommandInput, + GetLifecyclePolicyPreviewCommandOutput +>(ECRClient, GetLifecyclePolicyPreviewCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecr/src/pagination/ListImagesPaginator.ts b/clients/client-ecr/src/pagination/ListImagesPaginator.ts index ab880feff152..d1b47c2842db 100644 --- a/clients/client-ecr/src/pagination/ListImagesPaginator.ts +++ b/clients/client-ecr/src/pagination/ListImagesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListImagesCommand, ListImagesCommandInput, ListImagesCommandOutput } from "../commands/ListImagesCommand"; import { ECRClient } from "../ECRClient"; import { ECRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECRClient, - input: ListImagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImages( +export const paginateListImages: ( config: ECRPaginationConfiguration, input: ListImagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECR | ECRClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECRPaginationConfiguration, + ListImagesCommandInput, + ListImagesCommandOutput +>(ECRClient, ListImagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecs/package.json b/clients/client-ecs/package.json index 3ba86aa9db0b..2caa897185b1 100644 --- a/clients/client-ecs/package.json +++ b/clients/client-ecs/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-ecs/src/pagination/ListAccountSettingsPaginator.ts b/clients/client-ecs/src/pagination/ListAccountSettingsPaginator.ts index f80b5d56bf4c..bcbc6fe8d78d 100644 --- a/clients/client-ecs/src/pagination/ListAccountSettingsPaginator.ts +++ b/clients/client-ecs/src/pagination/ListAccountSettingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECSClient } from "../ECSClient"; import { ECSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECSClient, - input: ListAccountSettingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccountSettingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccountSettings( +export const paginateListAccountSettings: ( config: ECSPaginationConfiguration, input: ListAccountSettingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccountSettingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECS | ECSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECSPaginationConfiguration, + ListAccountSettingsCommandInput, + ListAccountSettingsCommandOutput +>(ECSClient, ListAccountSettingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecs/src/pagination/ListAttributesPaginator.ts b/clients/client-ecs/src/pagination/ListAttributesPaginator.ts index 1298013e9d8f..1906b832318c 100644 --- a/clients/client-ecs/src/pagination/ListAttributesPaginator.ts +++ b/clients/client-ecs/src/pagination/ListAttributesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECSClient } from "../ECSClient"; import { ECSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECSClient, - input: ListAttributesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAttributesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAttributes( +export const paginateListAttributes: ( config: ECSPaginationConfiguration, input: ListAttributesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAttributesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECS | ECSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECSPaginationConfiguration, + ListAttributesCommandInput, + ListAttributesCommandOutput +>(ECSClient, ListAttributesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecs/src/pagination/ListClustersPaginator.ts b/clients/client-ecs/src/pagination/ListClustersPaginator.ts index 4fd0aeba889f..9b1a6ee7e477 100644 --- a/clients/client-ecs/src/pagination/ListClustersPaginator.ts +++ b/clients/client-ecs/src/pagination/ListClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECSClient } from "../ECSClient"; import { ECSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECSClient, - input: ListClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClusters( +export const paginateListClusters: ( config: ECSPaginationConfiguration, input: ListClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClustersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECS | ECSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECSPaginationConfiguration, + ListClustersCommandInput, + ListClustersCommandOutput +>(ECSClient, ListClustersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecs/src/pagination/ListContainerInstancesPaginator.ts b/clients/client-ecs/src/pagination/ListContainerInstancesPaginator.ts index cf854ed02b01..1c8445c17e1f 100644 --- a/clients/client-ecs/src/pagination/ListContainerInstancesPaginator.ts +++ b/clients/client-ecs/src/pagination/ListContainerInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECSClient } from "../ECSClient"; import { ECSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECSClient, - input: ListContainerInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContainerInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContainerInstances( +export const paginateListContainerInstances: ( config: ECSPaginationConfiguration, input: ListContainerInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContainerInstancesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECS | ECSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECSPaginationConfiguration, + ListContainerInstancesCommandInput, + ListContainerInstancesCommandOutput +>(ECSClient, ListContainerInstancesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecs/src/pagination/ListServicesByNamespacePaginator.ts b/clients/client-ecs/src/pagination/ListServicesByNamespacePaginator.ts index e973fac726bc..75e9a1eb2402 100644 --- a/clients/client-ecs/src/pagination/ListServicesByNamespacePaginator.ts +++ b/clients/client-ecs/src/pagination/ListServicesByNamespacePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECSClient } from "../ECSClient"; import { ECSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECSClient, - input: ListServicesByNamespaceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServicesByNamespaceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServicesByNamespace( +export const paginateListServicesByNamespace: ( config: ECSPaginationConfiguration, input: ListServicesByNamespaceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServicesByNamespaceCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECS | ECSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECSPaginationConfiguration, + ListServicesByNamespaceCommandInput, + ListServicesByNamespaceCommandOutput +>(ECSClient, ListServicesByNamespaceCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecs/src/pagination/ListServicesPaginator.ts b/clients/client-ecs/src/pagination/ListServicesPaginator.ts index 854dbb158d96..1f2d20af4cda 100644 --- a/clients/client-ecs/src/pagination/ListServicesPaginator.ts +++ b/clients/client-ecs/src/pagination/ListServicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECSClient } from "../ECSClient"; import { ECSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECSClient, - input: ListServicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServices( +export const paginateListServices: ( config: ECSPaginationConfiguration, input: ListServicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServicesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECS | ECSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECSPaginationConfiguration, + ListServicesCommandInput, + ListServicesCommandOutput +>(ECSClient, ListServicesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecs/src/pagination/ListTaskDefinitionFamiliesPaginator.ts b/clients/client-ecs/src/pagination/ListTaskDefinitionFamiliesPaginator.ts index 7b6f3018e45a..11ec6d9a31cf 100644 --- a/clients/client-ecs/src/pagination/ListTaskDefinitionFamiliesPaginator.ts +++ b/clients/client-ecs/src/pagination/ListTaskDefinitionFamiliesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECSClient } from "../ECSClient"; import { ECSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECSClient, - input: ListTaskDefinitionFamiliesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTaskDefinitionFamiliesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTaskDefinitionFamilies( +export const paginateListTaskDefinitionFamilies: ( config: ECSPaginationConfiguration, input: ListTaskDefinitionFamiliesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTaskDefinitionFamiliesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECS | ECSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECSPaginationConfiguration, + ListTaskDefinitionFamiliesCommandInput, + ListTaskDefinitionFamiliesCommandOutput +>(ECSClient, ListTaskDefinitionFamiliesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecs/src/pagination/ListTaskDefinitionsPaginator.ts b/clients/client-ecs/src/pagination/ListTaskDefinitionsPaginator.ts index 1dec847de6aa..d61567be878e 100644 --- a/clients/client-ecs/src/pagination/ListTaskDefinitionsPaginator.ts +++ b/clients/client-ecs/src/pagination/ListTaskDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ECSClient } from "../ECSClient"; import { ECSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECSClient, - input: ListTaskDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTaskDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTaskDefinitions( +export const paginateListTaskDefinitions: ( config: ECSPaginationConfiguration, input: ListTaskDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTaskDefinitionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECS | ECSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECSPaginationConfiguration, + ListTaskDefinitionsCommandInput, + ListTaskDefinitionsCommandOutput +>(ECSClient, ListTaskDefinitionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ecs/src/pagination/ListTasksPaginator.ts b/clients/client-ecs/src/pagination/ListTasksPaginator.ts index a56470c95e3b..df05a1d15d15 100644 --- a/clients/client-ecs/src/pagination/ListTasksPaginator.ts +++ b/clients/client-ecs/src/pagination/ListTasksPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTasksCommand, ListTasksCommandInput, ListTasksCommandOutput } from "../commands/ListTasksCommand"; import { ECSClient } from "../ECSClient"; import { ECSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ECSClient, - input: ListTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTasks( +export const paginateListTasks: ( config: ECSPaginationConfiguration, input: ListTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTasksCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ECSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ECS | ECSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ECSPaginationConfiguration, + ListTasksCommandInput, + ListTasksCommandOutput +>(ECSClient, ListTasksCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-efs/src/pagination/DescribeAccessPointsPaginator.ts b/clients/client-efs/src/pagination/DescribeAccessPointsPaginator.ts index 5772e3f637cf..6b419a139c0a 100644 --- a/clients/client-efs/src/pagination/DescribeAccessPointsPaginator.ts +++ b/clients/client-efs/src/pagination/DescribeAccessPointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EFSClient } from "../EFSClient"; import { EFSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EFSClient, - input: DescribeAccessPointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAccessPointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAccessPoints( +export const paginateDescribeAccessPoints: ( config: EFSPaginationConfiguration, input: DescribeAccessPointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAccessPointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EFSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EFS | EFSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EFSPaginationConfiguration, + DescribeAccessPointsCommandInput, + DescribeAccessPointsCommandOutput +>(EFSClient, DescribeAccessPointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-efs/src/pagination/DescribeFileSystemsPaginator.ts b/clients/client-efs/src/pagination/DescribeFileSystemsPaginator.ts index f89ec7ce10a6..16783734d10d 100644 --- a/clients/client-efs/src/pagination/DescribeFileSystemsPaginator.ts +++ b/clients/client-efs/src/pagination/DescribeFileSystemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EFSClient } from "../EFSClient"; import { EFSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EFSClient, - input: DescribeFileSystemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFileSystemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFileSystems( +export const paginateDescribeFileSystems: ( config: EFSPaginationConfiguration, input: DescribeFileSystemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFileSystemsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof EFSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EFS | EFSClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EFSPaginationConfiguration, + DescribeFileSystemsCommandInput, + DescribeFileSystemsCommandOutput +>(EFSClient, DescribeFileSystemsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-efs/src/pagination/DescribeMountTargetsPaginator.ts b/clients/client-efs/src/pagination/DescribeMountTargetsPaginator.ts index ac63f7f81b1d..493477d6a628 100644 --- a/clients/client-efs/src/pagination/DescribeMountTargetsPaginator.ts +++ b/clients/client-efs/src/pagination/DescribeMountTargetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EFSClient } from "../EFSClient"; import { EFSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EFSClient, - input: DescribeMountTargetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMountTargetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMountTargets( +export const paginateDescribeMountTargets: ( config: EFSPaginationConfiguration, input: DescribeMountTargetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMountTargetsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof EFSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EFS | EFSClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EFSPaginationConfiguration, + DescribeMountTargetsCommandInput, + DescribeMountTargetsCommandOutput +>(EFSClient, DescribeMountTargetsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-efs/src/pagination/DescribeReplicationConfigurationsPaginator.ts b/clients/client-efs/src/pagination/DescribeReplicationConfigurationsPaginator.ts index 7d304f931d87..7eba0a8481f7 100644 --- a/clients/client-efs/src/pagination/DescribeReplicationConfigurationsPaginator.ts +++ b/clients/client-efs/src/pagination/DescribeReplicationConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EFSClient } from "../EFSClient"; import { EFSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EFSClient, - input: DescribeReplicationConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplicationConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplicationConfigurations( +export const paginateDescribeReplicationConfigurations: ( config: EFSPaginationConfiguration, input: DescribeReplicationConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplicationConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EFSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EFS | EFSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EFSPaginationConfiguration, + DescribeReplicationConfigurationsCommandInput, + DescribeReplicationConfigurationsCommandOutput +>(EFSClient, DescribeReplicationConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-efs/src/pagination/DescribeTagsPaginator.ts b/clients/client-efs/src/pagination/DescribeTagsPaginator.ts index a6192e5db444..d580377ac42b 100644 --- a/clients/client-efs/src/pagination/DescribeTagsPaginator.ts +++ b/clients/client-efs/src/pagination/DescribeTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EFSClient } from "../EFSClient"; import { EFSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EFSClient, - input: DescribeTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTags( +export const paginateDescribeTags: ( config: EFSPaginationConfiguration, input: DescribeTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTagsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof EFSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EFS | EFSClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EFSPaginationConfiguration, + DescribeTagsCommandInput, + DescribeTagsCommandOutput +>(EFSClient, DescribeTagsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-efs/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-efs/src/pagination/ListTagsForResourcePaginator.ts index aa34f8c8addb..4bf4ee209ea3 100644 --- a/clients/client-efs/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-efs/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EFSClient } from "../EFSClient"; import { EFSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EFSClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: EFSPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EFSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EFS | EFSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EFSPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(EFSClient, ListTagsForResourceCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-eks/src/pagination/DescribeAddonVersionsPaginator.ts b/clients/client-eks/src/pagination/DescribeAddonVersionsPaginator.ts index a2a72c6b28bb..9b24937e2d1d 100644 --- a/clients/client-eks/src/pagination/DescribeAddonVersionsPaginator.ts +++ b/clients/client-eks/src/pagination/DescribeAddonVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EKSClient } from "../EKSClient"; import { EKSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EKSClient, - input: DescribeAddonVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAddonVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAddonVersions( +export const paginateDescribeAddonVersions: ( config: EKSPaginationConfiguration, input: DescribeAddonVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAddonVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EKSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EKS | EKSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EKSPaginationConfiguration, + DescribeAddonVersionsCommandInput, + DescribeAddonVersionsCommandOutput +>(EKSClient, DescribeAddonVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-eks/src/pagination/ListAccessEntriesPaginator.ts b/clients/client-eks/src/pagination/ListAccessEntriesPaginator.ts index 6c25594231d3..dc9193142425 100644 --- a/clients/client-eks/src/pagination/ListAccessEntriesPaginator.ts +++ b/clients/client-eks/src/pagination/ListAccessEntriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EKSClient } from "../EKSClient"; import { EKSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EKSClient, - input: ListAccessEntriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessEntriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessEntries( +export const paginateListAccessEntries: ( config: EKSPaginationConfiguration, input: ListAccessEntriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessEntriesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EKSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EKS | EKSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EKSPaginationConfiguration, + ListAccessEntriesCommandInput, + ListAccessEntriesCommandOutput +>(EKSClient, ListAccessEntriesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-eks/src/pagination/ListAccessPoliciesPaginator.ts b/clients/client-eks/src/pagination/ListAccessPoliciesPaginator.ts index b9317fa508a2..3beacca1b8ba 100644 --- a/clients/client-eks/src/pagination/ListAccessPoliciesPaginator.ts +++ b/clients/client-eks/src/pagination/ListAccessPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EKSClient } from "../EKSClient"; import { EKSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EKSClient, - input: ListAccessPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessPolicies( +export const paginateListAccessPolicies: ( config: EKSPaginationConfiguration, input: ListAccessPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessPoliciesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EKSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EKS | EKSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EKSPaginationConfiguration, + ListAccessPoliciesCommandInput, + ListAccessPoliciesCommandOutput +>(EKSClient, ListAccessPoliciesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-eks/src/pagination/ListAddonsPaginator.ts b/clients/client-eks/src/pagination/ListAddonsPaginator.ts index df6955c635a8..dba0ce38d9b4 100644 --- a/clients/client-eks/src/pagination/ListAddonsPaginator.ts +++ b/clients/client-eks/src/pagination/ListAddonsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAddonsCommand, ListAddonsCommandInput, ListAddonsCommandOutput } from "../commands/ListAddonsCommand"; import { EKSClient } from "../EKSClient"; import { EKSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EKSClient, - input: ListAddonsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAddonsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAddons( +export const paginateListAddons: ( config: EKSPaginationConfiguration, input: ListAddonsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAddonsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EKSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EKS | EKSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EKSPaginationConfiguration, + ListAddonsCommandInput, + ListAddonsCommandOutput +>(EKSClient, ListAddonsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-eks/src/pagination/ListAssociatedAccessPoliciesPaginator.ts b/clients/client-eks/src/pagination/ListAssociatedAccessPoliciesPaginator.ts index c6ec6171c459..d6052f3632c9 100644 --- a/clients/client-eks/src/pagination/ListAssociatedAccessPoliciesPaginator.ts +++ b/clients/client-eks/src/pagination/ListAssociatedAccessPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EKSClient } from "../EKSClient"; import { EKSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EKSClient, - input: ListAssociatedAccessPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssociatedAccessPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssociatedAccessPolicies( +export const paginateListAssociatedAccessPolicies: ( config: EKSPaginationConfiguration, input: ListAssociatedAccessPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssociatedAccessPoliciesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EKSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EKS | EKSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EKSPaginationConfiguration, + ListAssociatedAccessPoliciesCommandInput, + ListAssociatedAccessPoliciesCommandOutput +>(EKSClient, ListAssociatedAccessPoliciesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-eks/src/pagination/ListClustersPaginator.ts b/clients/client-eks/src/pagination/ListClustersPaginator.ts index 70f230f91ec5..ee5a88de232d 100644 --- a/clients/client-eks/src/pagination/ListClustersPaginator.ts +++ b/clients/client-eks/src/pagination/ListClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EKSClient } from "../EKSClient"; import { EKSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EKSClient, - input: ListClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClusters( +export const paginateListClusters: ( config: EKSPaginationConfiguration, input: ListClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClustersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EKSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EKS | EKSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EKSPaginationConfiguration, + ListClustersCommandInput, + ListClustersCommandOutput +>(EKSClient, ListClustersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-eks/src/pagination/ListEksAnywhereSubscriptionsPaginator.ts b/clients/client-eks/src/pagination/ListEksAnywhereSubscriptionsPaginator.ts index 9beddaa232e6..7b49ce26a797 100644 --- a/clients/client-eks/src/pagination/ListEksAnywhereSubscriptionsPaginator.ts +++ b/clients/client-eks/src/pagination/ListEksAnywhereSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EKSClient } from "../EKSClient"; import { EKSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EKSClient, - input: ListEksAnywhereSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEksAnywhereSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEksAnywhereSubscriptions( +export const paginateListEksAnywhereSubscriptions: ( config: EKSPaginationConfiguration, input: ListEksAnywhereSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEksAnywhereSubscriptionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EKSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EKS | EKSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EKSPaginationConfiguration, + ListEksAnywhereSubscriptionsCommandInput, + ListEksAnywhereSubscriptionsCommandOutput +>(EKSClient, ListEksAnywhereSubscriptionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-eks/src/pagination/ListFargateProfilesPaginator.ts b/clients/client-eks/src/pagination/ListFargateProfilesPaginator.ts index 3b900339bade..86e2d8a95786 100644 --- a/clients/client-eks/src/pagination/ListFargateProfilesPaginator.ts +++ b/clients/client-eks/src/pagination/ListFargateProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EKSClient } from "../EKSClient"; import { EKSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EKSClient, - input: ListFargateProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFargateProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFargateProfiles( +export const paginateListFargateProfiles: ( config: EKSPaginationConfiguration, input: ListFargateProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFargateProfilesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EKSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EKS | EKSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EKSPaginationConfiguration, + ListFargateProfilesCommandInput, + ListFargateProfilesCommandOutput +>(EKSClient, ListFargateProfilesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-eks/src/pagination/ListIdentityProviderConfigsPaginator.ts b/clients/client-eks/src/pagination/ListIdentityProviderConfigsPaginator.ts index 323b0922b581..f506a45ed428 100644 --- a/clients/client-eks/src/pagination/ListIdentityProviderConfigsPaginator.ts +++ b/clients/client-eks/src/pagination/ListIdentityProviderConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EKSClient } from "../EKSClient"; import { EKSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EKSClient, - input: ListIdentityProviderConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIdentityProviderConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIdentityProviderConfigs( +export const paginateListIdentityProviderConfigs: ( config: EKSPaginationConfiguration, input: ListIdentityProviderConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIdentityProviderConfigsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EKSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EKS | EKSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EKSPaginationConfiguration, + ListIdentityProviderConfigsCommandInput, + ListIdentityProviderConfigsCommandOutput +>(EKSClient, ListIdentityProviderConfigsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-eks/src/pagination/ListNodegroupsPaginator.ts b/clients/client-eks/src/pagination/ListNodegroupsPaginator.ts index 982497504ebd..68d1c742d197 100644 --- a/clients/client-eks/src/pagination/ListNodegroupsPaginator.ts +++ b/clients/client-eks/src/pagination/ListNodegroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EKSClient } from "../EKSClient"; import { EKSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EKSClient, - input: ListNodegroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNodegroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNodegroups( +export const paginateListNodegroups: ( config: EKSPaginationConfiguration, input: ListNodegroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNodegroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EKSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EKS | EKSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EKSPaginationConfiguration, + ListNodegroupsCommandInput, + ListNodegroupsCommandOutput +>(EKSClient, ListNodegroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-eks/src/pagination/ListPodIdentityAssociationsPaginator.ts b/clients/client-eks/src/pagination/ListPodIdentityAssociationsPaginator.ts index cd84fe4060dc..59afc7b627aa 100644 --- a/clients/client-eks/src/pagination/ListPodIdentityAssociationsPaginator.ts +++ b/clients/client-eks/src/pagination/ListPodIdentityAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EKSClient } from "../EKSClient"; import { EKSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EKSClient, - input: ListPodIdentityAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPodIdentityAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPodIdentityAssociations( +export const paginateListPodIdentityAssociations: ( config: EKSPaginationConfiguration, input: ListPodIdentityAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPodIdentityAssociationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EKSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EKS | EKSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EKSPaginationConfiguration, + ListPodIdentityAssociationsCommandInput, + ListPodIdentityAssociationsCommandOutput +>(EKSClient, ListPodIdentityAssociationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-eks/src/pagination/ListUpdatesPaginator.ts b/clients/client-eks/src/pagination/ListUpdatesPaginator.ts index e73c8168b28e..3373a6b835ff 100644 --- a/clients/client-eks/src/pagination/ListUpdatesPaginator.ts +++ b/clients/client-eks/src/pagination/ListUpdatesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListUpdatesCommand, ListUpdatesCommandInput, ListUpdatesCommandOutput } from "../commands/ListUpdatesCommand"; import { EKSClient } from "../EKSClient"; import { EKSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EKSClient, - input: ListUpdatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUpdatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUpdates( +export const paginateListUpdates: ( config: EKSPaginationConfiguration, input: ListUpdatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUpdatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EKSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EKS | EKSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EKSPaginationConfiguration, + ListUpdatesCommandInput, + ListUpdatesCommandOutput +>(EKSClient, ListUpdatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-eks/src/protocols/Aws_restJson1.ts b/clients/client-eks/src/protocols/Aws_restJson1.ts index b54eb50336a2..5f6d059b2841 100644 --- a/clients/client-eks/src/protocols/Aws_restJson1.ts +++ b/clients/client-eks/src/protocols/Aws_restJson1.ts @@ -227,22 +227,13 @@ export const se_AssociateAccessPolicyCommand = async ( input: AssociateAccessPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const b = rb(input, context); const headers: any = { "content-type": "application/json", }; - let resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + - "/clusters/{clusterName}/access-entries/{principalArn}/access-policies"; - resolvedPath = __resolvedPath(resolvedPath, input, "clusterName", () => input.clusterName!, "{clusterName}", false); - resolvedPath = __resolvedPath( - resolvedPath, - input, - "principalArn", - () => input.principalArn!, - "{principalArn}", - false - ); + b.bp("/clusters/{clusterName}/access-entries/{principalArn}/access-policies"); + b.p("clusterName", () => input.clusterName!, "{clusterName}", false); + b.p("principalArn", () => input.principalArn!, "{principalArn}", false); let body: any; body = JSON.stringify( take(input, { @@ -250,15 +241,8 @@ export const se_AssociateAccessPolicyCommand = async ( policyArn: [], }) ); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); + b.m("POST").h(headers).b(body); + return b.build(); }; /** @@ -317,13 +301,12 @@ export const se_CreateAccessEntryCommand = async ( input: CreateAccessEntryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const b = rb(input, context); const headers: any = { "content-type": "application/json", }; - let resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters/{clusterName}/access-entries"; - resolvedPath = __resolvedPath(resolvedPath, input, "clusterName", () => input.clusterName!, "{clusterName}", false); + b.bp("/clusters/{clusterName}/access-entries"); + b.p("clusterName", () => input.clusterName!, "{clusterName}", false); let body: any; body = JSON.stringify( take(input, { @@ -335,15 +318,8 @@ export const se_CreateAccessEntryCommand = async ( username: [], }) ); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); + b.m("POST").h(headers).b(body); + return b.build(); }; /** @@ -536,30 +512,14 @@ export const se_DeleteAccessEntryCommand = async ( input: DeleteAccessEntryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const b = rb(input, context); const headers: any = {}; - let resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + - "/clusters/{clusterName}/access-entries/{principalArn}"; - resolvedPath = __resolvedPath(resolvedPath, input, "clusterName", () => input.clusterName!, "{clusterName}", false); - resolvedPath = __resolvedPath( - resolvedPath, - input, - "principalArn", - () => input.principalArn!, - "{principalArn}", - false - ); + b.bp("/clusters/{clusterName}/access-entries/{principalArn}"); + b.p("clusterName", () => input.clusterName!, "{clusterName}", false); + b.p("principalArn", () => input.principalArn!, "{principalArn}", false); let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "DELETE", - headers, - path: resolvedPath, - body, - }); + b.m("DELETE").h(headers).b(body); + return b.build(); }; /** @@ -688,30 +648,14 @@ export const se_DescribeAccessEntryCommand = async ( input: DescribeAccessEntryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const b = rb(input, context); const headers: any = {}; - let resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + - "/clusters/{clusterName}/access-entries/{principalArn}"; - resolvedPath = __resolvedPath(resolvedPath, input, "clusterName", () => input.clusterName!, "{clusterName}", false); - resolvedPath = __resolvedPath( - resolvedPath, - input, - "principalArn", - () => input.principalArn!, - "{principalArn}", - false - ); + b.bp("/clusters/{clusterName}/access-entries/{principalArn}"); + b.p("clusterName", () => input.clusterName!, "{clusterName}", false); + b.p("principalArn", () => input.principalArn!, "{principalArn}", false); let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - body, - }); + b.m("GET").h(headers).b(body); + return b.build(); }; /** @@ -908,31 +852,15 @@ export const se_DisassociateAccessPolicyCommand = async ( input: DisassociateAccessPolicyCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const b = rb(input, context); const headers: any = {}; - let resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + - "/clusters/{clusterName}/access-entries/{principalArn}/access-policies/{policyArn}"; - resolvedPath = __resolvedPath(resolvedPath, input, "clusterName", () => input.clusterName!, "{clusterName}", false); - resolvedPath = __resolvedPath( - resolvedPath, - input, - "principalArn", - () => input.principalArn!, - "{principalArn}", - false - ); - resolvedPath = __resolvedPath(resolvedPath, input, "policyArn", () => input.policyArn!, "{policyArn}", false); + b.bp("/clusters/{clusterName}/access-entries/{principalArn}/access-policies/{policyArn}"); + b.p("clusterName", () => input.clusterName!, "{clusterName}", false); + b.p("principalArn", () => input.principalArn!, "{principalArn}", false); + b.p("policyArn", () => input.policyArn!, "{policyArn}", false); let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "DELETE", - headers, - path: resolvedPath, - body, - }); + b.m("DELETE").h(headers).b(body); + return b.build(); }; /** @@ -966,27 +894,18 @@ export const se_ListAccessEntriesCommand = async ( input: ListAccessEntriesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const b = rb(input, context); const headers: any = {}; - let resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/clusters/{clusterName}/access-entries"; - resolvedPath = __resolvedPath(resolvedPath, input, "clusterName", () => input.clusterName!, "{clusterName}", false); + b.bp("/clusters/{clusterName}/access-entries"); + b.p("clusterName", () => input.clusterName!, "{clusterName}", false); const query: any = map({ - associatedPolicyArn: [, input.associatedPolicyArn!], - maxResults: [() => input.maxResults !== void 0, () => input.maxResults!.toString()], - nextToken: [, input.nextToken!], + [_aPA]: [, input[_aPA]!], + [_mR]: [() => input.maxResults !== void 0, () => input[_mR]!.toString()], + [_nT]: [, input[_nT]!], }); let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body, - }); + b.m("GET").h(headers).q(query).b(body); + return b.build(); }; /** @@ -996,24 +915,16 @@ export const se_ListAccessPoliciesCommand = async ( input: ListAccessPoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const b = rb(input, context); const headers: any = {}; - const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/access-policies"; + b.bp("/access-policies"); const query: any = map({ - maxResults: [() => input.maxResults !== void 0, () => input.maxResults!.toString()], - nextToken: [, input.nextToken!], + [_mR]: [() => input.maxResults !== void 0, () => input[_mR]!.toString()], + [_nT]: [, input[_nT]!], }); let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body, - }); + b.m("GET").h(headers).q(query).b(body); + return b.build(); }; /** @@ -1043,35 +954,18 @@ export const se_ListAssociatedAccessPoliciesCommand = async ( input: ListAssociatedAccessPoliciesCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const b = rb(input, context); const headers: any = {}; - let resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + - "/clusters/{clusterName}/access-entries/{principalArn}/access-policies"; - resolvedPath = __resolvedPath(resolvedPath, input, "clusterName", () => input.clusterName!, "{clusterName}", false); - resolvedPath = __resolvedPath( - resolvedPath, - input, - "principalArn", - () => input.principalArn!, - "{principalArn}", - false - ); + b.bp("/clusters/{clusterName}/access-entries/{principalArn}/access-policies"); + b.p("clusterName", () => input.clusterName!, "{clusterName}", false); + b.p("principalArn", () => input.principalArn!, "{principalArn}", false); const query: any = map({ - maxResults: [() => input.maxResults !== void 0, () => input.maxResults!.toString()], - nextToken: [, input.nextToken!], + [_mR]: [() => input.maxResults !== void 0, () => input[_mR]!.toString()], + [_nT]: [, input[_nT]!], }); let body: any; - return new __HttpRequest({ - protocol, - hostname, - port, - method: "GET", - headers, - path: resolvedPath, - query, - body, - }); + b.m("GET").h(headers).q(query).b(body); + return b.build(); }; /** @@ -1311,22 +1205,13 @@ export const se_UpdateAccessEntryCommand = async ( input: UpdateAccessEntryCommandInput, context: __SerdeContext ): Promise<__HttpRequest> => { - const { hostname, protocol = "https", port, path: basePath } = await context.endpoint(); + const b = rb(input, context); const headers: any = { "content-type": "application/json", }; - let resolvedPath = - `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + - "/clusters/{clusterName}/access-entries/{principalArn}"; - resolvedPath = __resolvedPath(resolvedPath, input, "clusterName", () => input.clusterName!, "{clusterName}", false); - resolvedPath = __resolvedPath( - resolvedPath, - input, - "principalArn", - () => input.principalArn!, - "{principalArn}", - false - ); + b.bp("/clusters/{clusterName}/access-entries/{principalArn}"); + b.p("clusterName", () => input.clusterName!, "{clusterName}", false); + b.p("principalArn", () => input.principalArn!, "{principalArn}", false); let body: any; body = JSON.stringify( take(input, { @@ -1335,15 +1220,8 @@ export const se_UpdateAccessEntryCommand = async ( username: [], }) ); - return new __HttpRequest({ - protocol, - hostname, - port, - method: "POST", - headers, - path: resolvedPath, - body, - }); + b.m("POST").h(headers).b(body); + return b.build(); }; /** @@ -5361,6 +5239,7 @@ const isSerializableHeaderValue = (value: any): boolean => (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0); const _aN = "addonName"; +const _aPA = "associatedPolicyArn"; const _aV = "addonVersion"; const _i = "include"; const _iS = "includeStatus"; diff --git a/clients/client-elastic-beanstalk/package.json b/clients/client-elastic-beanstalk/package.json index ef508c7fcffa..2047544d86ef 100644 --- a/clients/client-elastic-beanstalk/package.json +++ b/clients/client-elastic-beanstalk/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-elastic-beanstalk/src/pagination/DescribeEnvironmentManagedActionHistoryPaginator.ts b/clients/client-elastic-beanstalk/src/pagination/DescribeEnvironmentManagedActionHistoryPaginator.ts index c027f0d737a7..85b52d3a59c3 100644 --- a/clients/client-elastic-beanstalk/src/pagination/DescribeEnvironmentManagedActionHistoryPaginator.ts +++ b/clients/client-elastic-beanstalk/src/pagination/DescribeEnvironmentManagedActionHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticBeanstalkClient } from "../ElasticBeanstalkClient"; import { ElasticBeanstalkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticBeanstalkClient, - input: DescribeEnvironmentManagedActionHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEnvironmentManagedActionHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEnvironmentManagedActionHistory( +export const paginateDescribeEnvironmentManagedActionHistory: ( config: ElasticBeanstalkPaginationConfiguration, input: DescribeEnvironmentManagedActionHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEnvironmentManagedActionHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof ElasticBeanstalkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticBeanstalk | ElasticBeanstalkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticBeanstalkPaginationConfiguration, + DescribeEnvironmentManagedActionHistoryCommandInput, + DescribeEnvironmentManagedActionHistoryCommandOutput +>(ElasticBeanstalkClient, DescribeEnvironmentManagedActionHistoryCommand, "NextToken", "NextToken", "MaxItems"); diff --git a/clients/client-elastic-beanstalk/src/pagination/DescribeEventsPaginator.ts b/clients/client-elastic-beanstalk/src/pagination/DescribeEventsPaginator.ts index e2552360d543..8c991af10bd7 100644 --- a/clients/client-elastic-beanstalk/src/pagination/DescribeEventsPaginator.ts +++ b/clients/client-elastic-beanstalk/src/pagination/DescribeEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticBeanstalkClient } from "../ElasticBeanstalkClient"; import { ElasticBeanstalkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticBeanstalkClient, - input: DescribeEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEvents( +export const paginateDescribeEvents: ( config: ElasticBeanstalkPaginationConfiguration, input: DescribeEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElasticBeanstalkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticBeanstalk | ElasticBeanstalkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticBeanstalkPaginationConfiguration, + DescribeEventsCommandInput, + DescribeEventsCommandOutput +>(ElasticBeanstalkClient, DescribeEventsCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-elastic-beanstalk/src/pagination/ListPlatformBranchesPaginator.ts b/clients/client-elastic-beanstalk/src/pagination/ListPlatformBranchesPaginator.ts index 9914e97bf808..5cd7b5413521 100644 --- a/clients/client-elastic-beanstalk/src/pagination/ListPlatformBranchesPaginator.ts +++ b/clients/client-elastic-beanstalk/src/pagination/ListPlatformBranchesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticBeanstalkClient } from "../ElasticBeanstalkClient"; import { ElasticBeanstalkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticBeanstalkClient, - input: ListPlatformBranchesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPlatformBranchesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPlatformBranches( +export const paginateListPlatformBranches: ( config: ElasticBeanstalkPaginationConfiguration, input: ListPlatformBranchesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPlatformBranchesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElasticBeanstalkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticBeanstalk | ElasticBeanstalkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticBeanstalkPaginationConfiguration, + ListPlatformBranchesCommandInput, + ListPlatformBranchesCommandOutput +>(ElasticBeanstalkClient, ListPlatformBranchesCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-elastic-beanstalk/src/pagination/ListPlatformVersionsPaginator.ts b/clients/client-elastic-beanstalk/src/pagination/ListPlatformVersionsPaginator.ts index d1f80896d622..672db979631c 100644 --- a/clients/client-elastic-beanstalk/src/pagination/ListPlatformVersionsPaginator.ts +++ b/clients/client-elastic-beanstalk/src/pagination/ListPlatformVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticBeanstalkClient } from "../ElasticBeanstalkClient"; import { ElasticBeanstalkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticBeanstalkClient, - input: ListPlatformVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPlatformVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPlatformVersions( +export const paginateListPlatformVersions: ( config: ElasticBeanstalkPaginationConfiguration, input: ListPlatformVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPlatformVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElasticBeanstalkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticBeanstalk | ElasticBeanstalkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticBeanstalkPaginationConfiguration, + ListPlatformVersionsCommandInput, + ListPlatformVersionsCommandOutput +>(ElasticBeanstalkClient, ListPlatformVersionsCommand, "NextToken", "NextToken", "MaxRecords"); diff --git a/clients/client-elastic-inference/src/pagination/DescribeAcceleratorsPaginator.ts b/clients/client-elastic-inference/src/pagination/DescribeAcceleratorsPaginator.ts index 329abbff4369..09bced91c95d 100644 --- a/clients/client-elastic-inference/src/pagination/DescribeAcceleratorsPaginator.ts +++ b/clients/client-elastic-inference/src/pagination/DescribeAcceleratorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticInferenceClient } from "../ElasticInferenceClient"; import { ElasticInferencePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticInferenceClient, - input: DescribeAcceleratorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAcceleratorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAccelerators( +export const paginateDescribeAccelerators: ( config: ElasticInferencePaginationConfiguration, input: DescribeAcceleratorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAcceleratorsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ElasticInferenceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticInference | ElasticInferenceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticInferencePaginationConfiguration, + DescribeAcceleratorsCommandInput, + DescribeAcceleratorsCommandOutput +>(ElasticInferenceClient, DescribeAcceleratorsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-elastic-load-balancing-v2/package.json b/clients/client-elastic-load-balancing-v2/package.json index c7b55438d100..c60679b41a6b 100644 --- a/clients/client-elastic-load-balancing-v2/package.json +++ b/clients/client-elastic-load-balancing-v2/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-elastic-load-balancing-v2/src/pagination/DescribeListenersPaginator.ts b/clients/client-elastic-load-balancing-v2/src/pagination/DescribeListenersPaginator.ts index f82e16ad3ed8..2f93db7a8dfd 100644 --- a/clients/client-elastic-load-balancing-v2/src/pagination/DescribeListenersPaginator.ts +++ b/clients/client-elastic-load-balancing-v2/src/pagination/DescribeListenersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ElasticLoadBalancingV2Client } from "../ElasticLoadBalancingV2Client"; import { ElasticLoadBalancingV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticLoadBalancingV2Client, - input: DescribeListenersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeListenersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeListeners( +export const paginateDescribeListeners: ( config: ElasticLoadBalancingV2PaginationConfiguration, input: DescribeListenersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeListenersCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof ElasticLoadBalancingV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticLoadBalancingV2 | ElasticLoadBalancingV2Client"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticLoadBalancingV2PaginationConfiguration, + DescribeListenersCommandInput, + DescribeListenersCommandOutput +>(ElasticLoadBalancingV2Client, DescribeListenersCommand, "Marker", "NextMarker", ""); diff --git a/clients/client-elastic-load-balancing-v2/src/pagination/DescribeLoadBalancersPaginator.ts b/clients/client-elastic-load-balancing-v2/src/pagination/DescribeLoadBalancersPaginator.ts index 3c08591783ba..409075ee28cc 100644 --- a/clients/client-elastic-load-balancing-v2/src/pagination/DescribeLoadBalancersPaginator.ts +++ b/clients/client-elastic-load-balancing-v2/src/pagination/DescribeLoadBalancersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ElasticLoadBalancingV2Client } from "../ElasticLoadBalancingV2Client"; import { ElasticLoadBalancingV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticLoadBalancingV2Client, - input: DescribeLoadBalancersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLoadBalancersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLoadBalancers( +export const paginateDescribeLoadBalancers: ( config: ElasticLoadBalancingV2PaginationConfiguration, input: DescribeLoadBalancersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLoadBalancersCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof ElasticLoadBalancingV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticLoadBalancingV2 | ElasticLoadBalancingV2Client"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticLoadBalancingV2PaginationConfiguration, + DescribeLoadBalancersCommandInput, + DescribeLoadBalancersCommandOutput +>(ElasticLoadBalancingV2Client, DescribeLoadBalancersCommand, "Marker", "NextMarker", ""); diff --git a/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTargetGroupsPaginator.ts b/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTargetGroupsPaginator.ts index 0178e7024c0b..86151bbbaa1c 100644 --- a/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTargetGroupsPaginator.ts +++ b/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTargetGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ElasticLoadBalancingV2Client } from "../ElasticLoadBalancingV2Client"; import { ElasticLoadBalancingV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticLoadBalancingV2Client, - input: DescribeTargetGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTargetGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTargetGroups( +export const paginateDescribeTargetGroups: ( config: ElasticLoadBalancingV2PaginationConfiguration, input: DescribeTargetGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTargetGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof ElasticLoadBalancingV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticLoadBalancingV2 | ElasticLoadBalancingV2Client"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticLoadBalancingV2PaginationConfiguration, + DescribeTargetGroupsCommandInput, + DescribeTargetGroupsCommandOutput +>(ElasticLoadBalancingV2Client, DescribeTargetGroupsCommand, "Marker", "NextMarker", ""); diff --git a/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTrustStoreAssociationsPaginator.ts b/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTrustStoreAssociationsPaginator.ts index bb1bb1676033..e0a863a2f315 100644 --- a/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTrustStoreAssociationsPaginator.ts +++ b/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTrustStoreAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticLoadBalancingV2Client } from "../ElasticLoadBalancingV2Client"; import { ElasticLoadBalancingV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticLoadBalancingV2Client, - input: DescribeTrustStoreAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTrustStoreAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTrustStoreAssociations( +export const paginateDescribeTrustStoreAssociations: ( config: ElasticLoadBalancingV2PaginationConfiguration, input: DescribeTrustStoreAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTrustStoreAssociationsCommandOutput; - while (hasNext) { - input.Marker = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ElasticLoadBalancingV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticLoadBalancingV2 | ElasticLoadBalancingV2Client"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticLoadBalancingV2PaginationConfiguration, + DescribeTrustStoreAssociationsCommandInput, + DescribeTrustStoreAssociationsCommandOutput +>(ElasticLoadBalancingV2Client, DescribeTrustStoreAssociationsCommand, "Marker", "NextMarker", "PageSize"); diff --git a/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTrustStoreRevocationsPaginator.ts b/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTrustStoreRevocationsPaginator.ts index 39f6ea3cd030..27d2700d532d 100644 --- a/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTrustStoreRevocationsPaginator.ts +++ b/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTrustStoreRevocationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticLoadBalancingV2Client } from "../ElasticLoadBalancingV2Client"; import { ElasticLoadBalancingV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticLoadBalancingV2Client, - input: DescribeTrustStoreRevocationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTrustStoreRevocationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTrustStoreRevocations( +export const paginateDescribeTrustStoreRevocations: ( config: ElasticLoadBalancingV2PaginationConfiguration, input: DescribeTrustStoreRevocationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTrustStoreRevocationsCommandOutput; - while (hasNext) { - input.Marker = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ElasticLoadBalancingV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticLoadBalancingV2 | ElasticLoadBalancingV2Client"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticLoadBalancingV2PaginationConfiguration, + DescribeTrustStoreRevocationsCommandInput, + DescribeTrustStoreRevocationsCommandOutput +>(ElasticLoadBalancingV2Client, DescribeTrustStoreRevocationsCommand, "Marker", "NextMarker", "PageSize"); diff --git a/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTrustStoresPaginator.ts b/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTrustStoresPaginator.ts index 7c42e509acb8..491429106a10 100644 --- a/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTrustStoresPaginator.ts +++ b/clients/client-elastic-load-balancing-v2/src/pagination/DescribeTrustStoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticLoadBalancingV2Client } from "../ElasticLoadBalancingV2Client"; import { ElasticLoadBalancingV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticLoadBalancingV2Client, - input: DescribeTrustStoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTrustStoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTrustStores( +export const paginateDescribeTrustStores: ( config: ElasticLoadBalancingV2PaginationConfiguration, input: DescribeTrustStoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTrustStoresCommandOutput; - while (hasNext) { - input.Marker = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ElasticLoadBalancingV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticLoadBalancingV2 | ElasticLoadBalancingV2Client"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticLoadBalancingV2PaginationConfiguration, + DescribeTrustStoresCommandInput, + DescribeTrustStoresCommandOutput +>(ElasticLoadBalancingV2Client, DescribeTrustStoresCommand, "Marker", "NextMarker", "PageSize"); diff --git a/clients/client-elastic-load-balancing/package.json b/clients/client-elastic-load-balancing/package.json index 539c85fa947d..5ea70a8fc431 100644 --- a/clients/client-elastic-load-balancing/package.json +++ b/clients/client-elastic-load-balancing/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-elastic-load-balancing/src/pagination/DescribeLoadBalancersPaginator.ts b/clients/client-elastic-load-balancing/src/pagination/DescribeLoadBalancersPaginator.ts index 24193705eae9..d26b7854380f 100644 --- a/clients/client-elastic-load-balancing/src/pagination/DescribeLoadBalancersPaginator.ts +++ b/clients/client-elastic-load-balancing/src/pagination/DescribeLoadBalancersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ElasticLoadBalancingClient } from "../ElasticLoadBalancingClient"; import { ElasticLoadBalancingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticLoadBalancingClient, - input: DescribeLoadBalancersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLoadBalancersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLoadBalancers( +export const paginateDescribeLoadBalancers: ( config: ElasticLoadBalancingPaginationConfiguration, input: DescribeLoadBalancersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLoadBalancersCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof ElasticLoadBalancingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticLoadBalancing | ElasticLoadBalancingClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticLoadBalancingPaginationConfiguration, + DescribeLoadBalancersCommandInput, + DescribeLoadBalancersCommandOutput +>(ElasticLoadBalancingClient, DescribeLoadBalancersCommand, "Marker", "NextMarker", ""); diff --git a/clients/client-elastic-transcoder/src/pagination/ListJobsByPipelinePaginator.ts b/clients/client-elastic-transcoder/src/pagination/ListJobsByPipelinePaginator.ts index 5372172e84c8..f78b6d8c9b94 100644 --- a/clients/client-elastic-transcoder/src/pagination/ListJobsByPipelinePaginator.ts +++ b/clients/client-elastic-transcoder/src/pagination/ListJobsByPipelinePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ElasticTranscoderClient } from "../ElasticTranscoderClient"; import { ElasticTranscoderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticTranscoderClient, - input: ListJobsByPipelineCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobsByPipelineCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobsByPipeline( +export const paginateListJobsByPipeline: ( config: ElasticTranscoderPaginationConfiguration, input: ListJobsByPipelineCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobsByPipelineCommandOutput; - while (hasNext) { - input.PageToken = token; - if (config.client instanceof ElasticTranscoderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticTranscoder | ElasticTranscoderClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticTranscoderPaginationConfiguration, + ListJobsByPipelineCommandInput, + ListJobsByPipelineCommandOutput +>(ElasticTranscoderClient, ListJobsByPipelineCommand, "PageToken", "NextPageToken", ""); diff --git a/clients/client-elastic-transcoder/src/pagination/ListJobsByStatusPaginator.ts b/clients/client-elastic-transcoder/src/pagination/ListJobsByStatusPaginator.ts index b8b538a08e2a..a2befa86471e 100644 --- a/clients/client-elastic-transcoder/src/pagination/ListJobsByStatusPaginator.ts +++ b/clients/client-elastic-transcoder/src/pagination/ListJobsByStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ElasticTranscoderClient } from "../ElasticTranscoderClient"; import { ElasticTranscoderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticTranscoderClient, - input: ListJobsByStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobsByStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobsByStatus( +export const paginateListJobsByStatus: ( config: ElasticTranscoderPaginationConfiguration, input: ListJobsByStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobsByStatusCommandOutput; - while (hasNext) { - input.PageToken = token; - if (config.client instanceof ElasticTranscoderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticTranscoder | ElasticTranscoderClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticTranscoderPaginationConfiguration, + ListJobsByStatusCommandInput, + ListJobsByStatusCommandOutput +>(ElasticTranscoderClient, ListJobsByStatusCommand, "PageToken", "NextPageToken", ""); diff --git a/clients/client-elastic-transcoder/src/pagination/ListPipelinesPaginator.ts b/clients/client-elastic-transcoder/src/pagination/ListPipelinesPaginator.ts index 0e823cab4a2c..dd9c2b545301 100644 --- a/clients/client-elastic-transcoder/src/pagination/ListPipelinesPaginator.ts +++ b/clients/client-elastic-transcoder/src/pagination/ListPipelinesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ElasticTranscoderClient } from "../ElasticTranscoderClient"; import { ElasticTranscoderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticTranscoderClient, - input: ListPipelinesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPipelinesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPipelines( +export const paginateListPipelines: ( config: ElasticTranscoderPaginationConfiguration, input: ListPipelinesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPipelinesCommandOutput; - while (hasNext) { - input.PageToken = token; - if (config.client instanceof ElasticTranscoderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticTranscoder | ElasticTranscoderClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticTranscoderPaginationConfiguration, + ListPipelinesCommandInput, + ListPipelinesCommandOutput +>(ElasticTranscoderClient, ListPipelinesCommand, "PageToken", "NextPageToken", ""); diff --git a/clients/client-elastic-transcoder/src/pagination/ListPresetsPaginator.ts b/clients/client-elastic-transcoder/src/pagination/ListPresetsPaginator.ts index 1ff6d0f131a1..d51f09f83aee 100644 --- a/clients/client-elastic-transcoder/src/pagination/ListPresetsPaginator.ts +++ b/clients/client-elastic-transcoder/src/pagination/ListPresetsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListPresetsCommand, ListPresetsCommandInput, ListPresetsCommandOutput } from "../commands/ListPresetsCommand"; import { ElasticTranscoderClient } from "../ElasticTranscoderClient"; import { ElasticTranscoderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticTranscoderClient, - input: ListPresetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPresetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPresets( +export const paginateListPresets: ( config: ElasticTranscoderPaginationConfiguration, input: ListPresetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPresetsCommandOutput; - while (hasNext) { - input.PageToken = token; - if (config.client instanceof ElasticTranscoderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticTranscoder | ElasticTranscoderClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticTranscoderPaginationConfiguration, + ListPresetsCommandInput, + ListPresetsCommandOutput +>(ElasticTranscoderClient, ListPresetsCommand, "PageToken", "NextPageToken", ""); diff --git a/clients/client-elasticache/package.json b/clients/client-elasticache/package.json index d8d7dcc5a97c..cafde99418b4 100644 --- a/clients/client-elasticache/package.json +++ b/clients/client-elasticache/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-elasticache/src/pagination/DescribeCacheClustersPaginator.ts b/clients/client-elasticache/src/pagination/DescribeCacheClustersPaginator.ts index 57773a399c6c..5c1a60702c8b 100644 --- a/clients/client-elasticache/src/pagination/DescribeCacheClustersPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeCacheClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeCacheClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCacheClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCacheClusters( +export const paginateDescribeCacheClusters: ( config: ElastiCachePaginationConfiguration, input: DescribeCacheClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCacheClustersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeCacheClustersCommandInput, + DescribeCacheClustersCommandOutput +>(ElastiCacheClient, DescribeCacheClustersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeCacheEngineVersionsPaginator.ts b/clients/client-elasticache/src/pagination/DescribeCacheEngineVersionsPaginator.ts index 83861f90779c..cfd516dc7790 100644 --- a/clients/client-elasticache/src/pagination/DescribeCacheEngineVersionsPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeCacheEngineVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeCacheEngineVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCacheEngineVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCacheEngineVersions( +export const paginateDescribeCacheEngineVersions: ( config: ElastiCachePaginationConfiguration, input: DescribeCacheEngineVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCacheEngineVersionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeCacheEngineVersionsCommandInput, + DescribeCacheEngineVersionsCommandOutput +>(ElastiCacheClient, DescribeCacheEngineVersionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeCacheParameterGroupsPaginator.ts b/clients/client-elasticache/src/pagination/DescribeCacheParameterGroupsPaginator.ts index c14697fc4797..d2171540b050 100644 --- a/clients/client-elasticache/src/pagination/DescribeCacheParameterGroupsPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeCacheParameterGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeCacheParameterGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCacheParameterGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCacheParameterGroups( +export const paginateDescribeCacheParameterGroups: ( config: ElastiCachePaginationConfiguration, input: DescribeCacheParameterGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCacheParameterGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeCacheParameterGroupsCommandInput, + DescribeCacheParameterGroupsCommandOutput +>(ElastiCacheClient, DescribeCacheParameterGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeCacheParametersPaginator.ts b/clients/client-elasticache/src/pagination/DescribeCacheParametersPaginator.ts index a1ab32530dce..f6c504078cc8 100644 --- a/clients/client-elasticache/src/pagination/DescribeCacheParametersPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeCacheParametersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeCacheParametersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCacheParametersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCacheParameters( +export const paginateDescribeCacheParameters: ( config: ElastiCachePaginationConfiguration, input: DescribeCacheParametersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCacheParametersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeCacheParametersCommandInput, + DescribeCacheParametersCommandOutput +>(ElastiCacheClient, DescribeCacheParametersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeCacheSecurityGroupsPaginator.ts b/clients/client-elasticache/src/pagination/DescribeCacheSecurityGroupsPaginator.ts index 4f41e8c5b8cd..f12601df83ba 100644 --- a/clients/client-elasticache/src/pagination/DescribeCacheSecurityGroupsPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeCacheSecurityGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeCacheSecurityGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCacheSecurityGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCacheSecurityGroups( +export const paginateDescribeCacheSecurityGroups: ( config: ElastiCachePaginationConfiguration, input: DescribeCacheSecurityGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCacheSecurityGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeCacheSecurityGroupsCommandInput, + DescribeCacheSecurityGroupsCommandOutput +>(ElastiCacheClient, DescribeCacheSecurityGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeCacheSubnetGroupsPaginator.ts b/clients/client-elasticache/src/pagination/DescribeCacheSubnetGroupsPaginator.ts index 2a44fef9b4fb..0aac943f5e41 100644 --- a/clients/client-elasticache/src/pagination/DescribeCacheSubnetGroupsPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeCacheSubnetGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeCacheSubnetGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCacheSubnetGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCacheSubnetGroups( +export const paginateDescribeCacheSubnetGroups: ( config: ElastiCachePaginationConfiguration, input: DescribeCacheSubnetGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCacheSubnetGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeCacheSubnetGroupsCommandInput, + DescribeCacheSubnetGroupsCommandOutput +>(ElastiCacheClient, DescribeCacheSubnetGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeEngineDefaultParametersPaginator.ts b/clients/client-elasticache/src/pagination/DescribeEngineDefaultParametersPaginator.ts index 5e55d36c905f..514ff23e5f8c 100644 --- a/clients/client-elasticache/src/pagination/DescribeEngineDefaultParametersPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeEngineDefaultParametersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeEngineDefaultParametersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEngineDefaultParametersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEngineDefaultParameters( +export const paginateDescribeEngineDefaultParameters: ( config: ElastiCachePaginationConfiguration, input: DescribeEngineDefaultParametersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEngineDefaultParametersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.EngineDefaults!.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeEngineDefaultParametersCommandInput, + DescribeEngineDefaultParametersCommandOutput +>(ElastiCacheClient, DescribeEngineDefaultParametersCommand, "Marker", "EngineDefaults.Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeEventsPaginator.ts b/clients/client-elasticache/src/pagination/DescribeEventsPaginator.ts index 17ba2138a471..544436b01e45 100644 --- a/clients/client-elasticache/src/pagination/DescribeEventsPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEvents( +export const paginateDescribeEvents: ( config: ElastiCachePaginationConfiguration, input: DescribeEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeEventsCommandInput, + DescribeEventsCommandOutput +>(ElastiCacheClient, DescribeEventsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeGlobalReplicationGroupsPaginator.ts b/clients/client-elasticache/src/pagination/DescribeGlobalReplicationGroupsPaginator.ts index 76814656d07c..d334c153f364 100644 --- a/clients/client-elasticache/src/pagination/DescribeGlobalReplicationGroupsPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeGlobalReplicationGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeGlobalReplicationGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeGlobalReplicationGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeGlobalReplicationGroups( +export const paginateDescribeGlobalReplicationGroups: ( config: ElastiCachePaginationConfiguration, input: DescribeGlobalReplicationGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeGlobalReplicationGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeGlobalReplicationGroupsCommandInput, + DescribeGlobalReplicationGroupsCommandOutput +>(ElastiCacheClient, DescribeGlobalReplicationGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeReplicationGroupsPaginator.ts b/clients/client-elasticache/src/pagination/DescribeReplicationGroupsPaginator.ts index 168d4f81b707..3dd63001d2a1 100644 --- a/clients/client-elasticache/src/pagination/DescribeReplicationGroupsPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeReplicationGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeReplicationGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplicationGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplicationGroups( +export const paginateDescribeReplicationGroups: ( config: ElastiCachePaginationConfiguration, input: DescribeReplicationGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplicationGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeReplicationGroupsCommandInput, + DescribeReplicationGroupsCommandOutput +>(ElastiCacheClient, DescribeReplicationGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeReservedCacheNodesOfferingsPaginator.ts b/clients/client-elasticache/src/pagination/DescribeReservedCacheNodesOfferingsPaginator.ts index 31cece987a11..3418787512da 100644 --- a/clients/client-elasticache/src/pagination/DescribeReservedCacheNodesOfferingsPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeReservedCacheNodesOfferingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeReservedCacheNodesOfferingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedCacheNodesOfferingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedCacheNodesOfferings( +export const paginateDescribeReservedCacheNodesOfferings: ( config: ElastiCachePaginationConfiguration, input: DescribeReservedCacheNodesOfferingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedCacheNodesOfferingsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeReservedCacheNodesOfferingsCommandInput, + DescribeReservedCacheNodesOfferingsCommandOutput +>(ElastiCacheClient, DescribeReservedCacheNodesOfferingsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeReservedCacheNodesPaginator.ts b/clients/client-elasticache/src/pagination/DescribeReservedCacheNodesPaginator.ts index 51b8a9863a3e..e2bfa6a81d2b 100644 --- a/clients/client-elasticache/src/pagination/DescribeReservedCacheNodesPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeReservedCacheNodesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeReservedCacheNodesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedCacheNodesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedCacheNodes( +export const paginateDescribeReservedCacheNodes: ( config: ElastiCachePaginationConfiguration, input: DescribeReservedCacheNodesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedCacheNodesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeReservedCacheNodesCommandInput, + DescribeReservedCacheNodesCommandOutput +>(ElastiCacheClient, DescribeReservedCacheNodesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeServerlessCacheSnapshotsPaginator.ts b/clients/client-elasticache/src/pagination/DescribeServerlessCacheSnapshotsPaginator.ts index 8950c989b80b..8017ba94b101 100644 --- a/clients/client-elasticache/src/pagination/DescribeServerlessCacheSnapshotsPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeServerlessCacheSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeServerlessCacheSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeServerlessCacheSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeServerlessCacheSnapshots( +export const paginateDescribeServerlessCacheSnapshots: ( config: ElastiCachePaginationConfiguration, input: DescribeServerlessCacheSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeServerlessCacheSnapshotsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeServerlessCacheSnapshotsCommandInput, + DescribeServerlessCacheSnapshotsCommandOutput +>(ElastiCacheClient, DescribeServerlessCacheSnapshotsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-elasticache/src/pagination/DescribeServerlessCachesPaginator.ts b/clients/client-elasticache/src/pagination/DescribeServerlessCachesPaginator.ts index 5fdcfcb739f1..838526f758fa 100644 --- a/clients/client-elasticache/src/pagination/DescribeServerlessCachesPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeServerlessCachesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeServerlessCachesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeServerlessCachesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeServerlessCaches( +export const paginateDescribeServerlessCaches: ( config: ElastiCachePaginationConfiguration, input: DescribeServerlessCachesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeServerlessCachesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeServerlessCachesCommandInput, + DescribeServerlessCachesCommandOutput +>(ElastiCacheClient, DescribeServerlessCachesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-elasticache/src/pagination/DescribeServiceUpdatesPaginator.ts b/clients/client-elasticache/src/pagination/DescribeServiceUpdatesPaginator.ts index 28632be1ff1d..f554820e5299 100644 --- a/clients/client-elasticache/src/pagination/DescribeServiceUpdatesPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeServiceUpdatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeServiceUpdatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeServiceUpdatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeServiceUpdates( +export const paginateDescribeServiceUpdates: ( config: ElastiCachePaginationConfiguration, input: DescribeServiceUpdatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeServiceUpdatesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeServiceUpdatesCommandInput, + DescribeServiceUpdatesCommandOutput +>(ElastiCacheClient, DescribeServiceUpdatesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeSnapshotsPaginator.ts b/clients/client-elasticache/src/pagination/DescribeSnapshotsPaginator.ts index 939dd4d348cc..78797de2f2a5 100644 --- a/clients/client-elasticache/src/pagination/DescribeSnapshotsPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSnapshots( +export const paginateDescribeSnapshots: ( config: ElastiCachePaginationConfiguration, input: DescribeSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSnapshotsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeSnapshotsCommandInput, + DescribeSnapshotsCommandOutput +>(ElastiCacheClient, DescribeSnapshotsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeUpdateActionsPaginator.ts b/clients/client-elasticache/src/pagination/DescribeUpdateActionsPaginator.ts index fc4a40ca5013..326933d1b007 100644 --- a/clients/client-elasticache/src/pagination/DescribeUpdateActionsPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeUpdateActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeUpdateActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeUpdateActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeUpdateActions( +export const paginateDescribeUpdateActions: ( config: ElastiCachePaginationConfiguration, input: DescribeUpdateActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeUpdateActionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeUpdateActionsCommandInput, + DescribeUpdateActionsCommandOutput +>(ElastiCacheClient, DescribeUpdateActionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeUserGroupsPaginator.ts b/clients/client-elasticache/src/pagination/DescribeUserGroupsPaginator.ts index f7af6b7e8379..46fe92635629 100644 --- a/clients/client-elasticache/src/pagination/DescribeUserGroupsPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeUserGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeUserGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeUserGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeUserGroups( +export const paginateDescribeUserGroups: ( config: ElastiCachePaginationConfiguration, input: DescribeUserGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeUserGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeUserGroupsCommandInput, + DescribeUserGroupsCommandOutput +>(ElastiCacheClient, DescribeUserGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticache/src/pagination/DescribeUsersPaginator.ts b/clients/client-elasticache/src/pagination/DescribeUsersPaginator.ts index d9ba087b50e4..2e86f6e03806 100644 --- a/clients/client-elasticache/src/pagination/DescribeUsersPaginator.ts +++ b/clients/client-elasticache/src/pagination/DescribeUsersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElastiCacheClient } from "../ElastiCacheClient"; import { ElastiCachePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElastiCacheClient, - input: DescribeUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeUsers( +export const paginateDescribeUsers: ( config: ElastiCachePaginationConfiguration, input: DescribeUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeUsersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof ElastiCacheClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElastiCache | ElastiCacheClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElastiCachePaginationConfiguration, + DescribeUsersCommandInput, + DescribeUsersCommandOutput +>(ElastiCacheClient, DescribeUsersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-elasticsearch-service/src/pagination/DescribeDomainAutoTunesPaginator.ts b/clients/client-elasticsearch-service/src/pagination/DescribeDomainAutoTunesPaginator.ts index fa7cd6c67b63..e436621e4257 100644 --- a/clients/client-elasticsearch-service/src/pagination/DescribeDomainAutoTunesPaginator.ts +++ b/clients/client-elasticsearch-service/src/pagination/DescribeDomainAutoTunesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticsearchServiceClient } from "../ElasticsearchServiceClient"; import { ElasticsearchServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticsearchServiceClient, - input: DescribeDomainAutoTunesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDomainAutoTunesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDomainAutoTunes( +export const paginateDescribeDomainAutoTunes: ( config: ElasticsearchServicePaginationConfiguration, input: DescribeDomainAutoTunesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDomainAutoTunesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ElasticsearchServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticsearchService | ElasticsearchServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticsearchServicePaginationConfiguration, + DescribeDomainAutoTunesCommandInput, + DescribeDomainAutoTunesCommandOutput +>(ElasticsearchServiceClient, DescribeDomainAutoTunesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-elasticsearch-service/src/pagination/DescribeInboundCrossClusterSearchConnectionsPaginator.ts b/clients/client-elasticsearch-service/src/pagination/DescribeInboundCrossClusterSearchConnectionsPaginator.ts index 66af510da75c..df08304776a8 100644 --- a/clients/client-elasticsearch-service/src/pagination/DescribeInboundCrossClusterSearchConnectionsPaginator.ts +++ b/clients/client-elasticsearch-service/src/pagination/DescribeInboundCrossClusterSearchConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,21 @@ import { import { ElasticsearchServiceClient } from "../ElasticsearchServiceClient"; import { ElasticsearchServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticsearchServiceClient, - input: DescribeInboundCrossClusterSearchConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInboundCrossClusterSearchConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInboundCrossClusterSearchConnections( +export const paginateDescribeInboundCrossClusterSearchConnections: ( config: ElasticsearchServicePaginationConfiguration, input: DescribeInboundCrossClusterSearchConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInboundCrossClusterSearchConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ElasticsearchServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticsearchService | ElasticsearchServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticsearchServicePaginationConfiguration, + DescribeInboundCrossClusterSearchConnectionsCommandInput, + DescribeInboundCrossClusterSearchConnectionsCommandOutput +>( + ElasticsearchServiceClient, + DescribeInboundCrossClusterSearchConnectionsCommand, + "NextToken", + "NextToken", + "MaxResults" +); diff --git a/clients/client-elasticsearch-service/src/pagination/DescribeOutboundCrossClusterSearchConnectionsPaginator.ts b/clients/client-elasticsearch-service/src/pagination/DescribeOutboundCrossClusterSearchConnectionsPaginator.ts index f8b4b37a2d92..5edfce4de42f 100644 --- a/clients/client-elasticsearch-service/src/pagination/DescribeOutboundCrossClusterSearchConnectionsPaginator.ts +++ b/clients/client-elasticsearch-service/src/pagination/DescribeOutboundCrossClusterSearchConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,21 @@ import { import { ElasticsearchServiceClient } from "../ElasticsearchServiceClient"; import { ElasticsearchServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticsearchServiceClient, - input: DescribeOutboundCrossClusterSearchConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOutboundCrossClusterSearchConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOutboundCrossClusterSearchConnections( +export const paginateDescribeOutboundCrossClusterSearchConnections: ( config: ElasticsearchServicePaginationConfiguration, input: DescribeOutboundCrossClusterSearchConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOutboundCrossClusterSearchConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ElasticsearchServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticsearchService | ElasticsearchServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticsearchServicePaginationConfiguration, + DescribeOutboundCrossClusterSearchConnectionsCommandInput, + DescribeOutboundCrossClusterSearchConnectionsCommandOutput +>( + ElasticsearchServiceClient, + DescribeOutboundCrossClusterSearchConnectionsCommand, + "NextToken", + "NextToken", + "MaxResults" +); diff --git a/clients/client-elasticsearch-service/src/pagination/DescribePackagesPaginator.ts b/clients/client-elasticsearch-service/src/pagination/DescribePackagesPaginator.ts index 71ea36107d5a..0f8f72bb38c1 100644 --- a/clients/client-elasticsearch-service/src/pagination/DescribePackagesPaginator.ts +++ b/clients/client-elasticsearch-service/src/pagination/DescribePackagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticsearchServiceClient } from "../ElasticsearchServiceClient"; import { ElasticsearchServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticsearchServiceClient, - input: DescribePackagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePackagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePackages( +export const paginateDescribePackages: ( config: ElasticsearchServicePaginationConfiguration, input: DescribePackagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePackagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ElasticsearchServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticsearchService | ElasticsearchServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticsearchServicePaginationConfiguration, + DescribePackagesCommandInput, + DescribePackagesCommandOutput +>(ElasticsearchServiceClient, DescribePackagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-elasticsearch-service/src/pagination/DescribeReservedElasticsearchInstanceOfferingsPaginator.ts b/clients/client-elasticsearch-service/src/pagination/DescribeReservedElasticsearchInstanceOfferingsPaginator.ts index 7ae1f6a0d429..74142816dc20 100644 --- a/clients/client-elasticsearch-service/src/pagination/DescribeReservedElasticsearchInstanceOfferingsPaginator.ts +++ b/clients/client-elasticsearch-service/src/pagination/DescribeReservedElasticsearchInstanceOfferingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,21 @@ import { import { ElasticsearchServiceClient } from "../ElasticsearchServiceClient"; import { ElasticsearchServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticsearchServiceClient, - input: DescribeReservedElasticsearchInstanceOfferingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedElasticsearchInstanceOfferingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedElasticsearchInstanceOfferings( +export const paginateDescribeReservedElasticsearchInstanceOfferings: ( config: ElasticsearchServicePaginationConfiguration, input: DescribeReservedElasticsearchInstanceOfferingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedElasticsearchInstanceOfferingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ElasticsearchServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticsearchService | ElasticsearchServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticsearchServicePaginationConfiguration, + DescribeReservedElasticsearchInstanceOfferingsCommandInput, + DescribeReservedElasticsearchInstanceOfferingsCommandOutput +>( + ElasticsearchServiceClient, + DescribeReservedElasticsearchInstanceOfferingsCommand, + "NextToken", + "NextToken", + "MaxResults" +); diff --git a/clients/client-elasticsearch-service/src/pagination/DescribeReservedElasticsearchInstancesPaginator.ts b/clients/client-elasticsearch-service/src/pagination/DescribeReservedElasticsearchInstancesPaginator.ts index 2a60e048acb0..66dce21c3eab 100644 --- a/clients/client-elasticsearch-service/src/pagination/DescribeReservedElasticsearchInstancesPaginator.ts +++ b/clients/client-elasticsearch-service/src/pagination/DescribeReservedElasticsearchInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticsearchServiceClient } from "../ElasticsearchServiceClient"; import { ElasticsearchServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticsearchServiceClient, - input: DescribeReservedElasticsearchInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedElasticsearchInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedElasticsearchInstances( +export const paginateDescribeReservedElasticsearchInstances: ( config: ElasticsearchServicePaginationConfiguration, input: DescribeReservedElasticsearchInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedElasticsearchInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ElasticsearchServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticsearchService | ElasticsearchServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticsearchServicePaginationConfiguration, + DescribeReservedElasticsearchInstancesCommandInput, + DescribeReservedElasticsearchInstancesCommandOutput +>(ElasticsearchServiceClient, DescribeReservedElasticsearchInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-elasticsearch-service/src/pagination/GetPackageVersionHistoryPaginator.ts b/clients/client-elasticsearch-service/src/pagination/GetPackageVersionHistoryPaginator.ts index 9806549591dc..b8734e2327b7 100644 --- a/clients/client-elasticsearch-service/src/pagination/GetPackageVersionHistoryPaginator.ts +++ b/clients/client-elasticsearch-service/src/pagination/GetPackageVersionHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticsearchServiceClient } from "../ElasticsearchServiceClient"; import { ElasticsearchServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticsearchServiceClient, - input: GetPackageVersionHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetPackageVersionHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetPackageVersionHistory( +export const paginateGetPackageVersionHistory: ( config: ElasticsearchServicePaginationConfiguration, input: GetPackageVersionHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetPackageVersionHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ElasticsearchServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticsearchService | ElasticsearchServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticsearchServicePaginationConfiguration, + GetPackageVersionHistoryCommandInput, + GetPackageVersionHistoryCommandOutput +>(ElasticsearchServiceClient, GetPackageVersionHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-elasticsearch-service/src/pagination/GetUpgradeHistoryPaginator.ts b/clients/client-elasticsearch-service/src/pagination/GetUpgradeHistoryPaginator.ts index bd53ad9ec078..abeb976fca6d 100644 --- a/clients/client-elasticsearch-service/src/pagination/GetUpgradeHistoryPaginator.ts +++ b/clients/client-elasticsearch-service/src/pagination/GetUpgradeHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticsearchServiceClient } from "../ElasticsearchServiceClient"; import { ElasticsearchServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticsearchServiceClient, - input: GetUpgradeHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetUpgradeHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetUpgradeHistory( +export const paginateGetUpgradeHistory: ( config: ElasticsearchServicePaginationConfiguration, input: GetUpgradeHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetUpgradeHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ElasticsearchServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticsearchService | ElasticsearchServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticsearchServicePaginationConfiguration, + GetUpgradeHistoryCommandInput, + GetUpgradeHistoryCommandOutput +>(ElasticsearchServiceClient, GetUpgradeHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-elasticsearch-service/src/pagination/ListDomainsForPackagePaginator.ts b/clients/client-elasticsearch-service/src/pagination/ListDomainsForPackagePaginator.ts index 9380d849ab64..04d45f1a801f 100644 --- a/clients/client-elasticsearch-service/src/pagination/ListDomainsForPackagePaginator.ts +++ b/clients/client-elasticsearch-service/src/pagination/ListDomainsForPackagePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticsearchServiceClient } from "../ElasticsearchServiceClient"; import { ElasticsearchServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticsearchServiceClient, - input: ListDomainsForPackageCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainsForPackageCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomainsForPackage( +export const paginateListDomainsForPackage: ( config: ElasticsearchServicePaginationConfiguration, input: ListDomainsForPackageCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainsForPackageCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ElasticsearchServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticsearchService | ElasticsearchServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticsearchServicePaginationConfiguration, + ListDomainsForPackageCommandInput, + ListDomainsForPackageCommandOutput +>(ElasticsearchServiceClient, ListDomainsForPackageCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-elasticsearch-service/src/pagination/ListElasticsearchInstanceTypesPaginator.ts b/clients/client-elasticsearch-service/src/pagination/ListElasticsearchInstanceTypesPaginator.ts index 3ec6b078c2e5..54e98782336f 100644 --- a/clients/client-elasticsearch-service/src/pagination/ListElasticsearchInstanceTypesPaginator.ts +++ b/clients/client-elasticsearch-service/src/pagination/ListElasticsearchInstanceTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticsearchServiceClient } from "../ElasticsearchServiceClient"; import { ElasticsearchServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticsearchServiceClient, - input: ListElasticsearchInstanceTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListElasticsearchInstanceTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListElasticsearchInstanceTypes( +export const paginateListElasticsearchInstanceTypes: ( config: ElasticsearchServicePaginationConfiguration, input: ListElasticsearchInstanceTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListElasticsearchInstanceTypesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ElasticsearchServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticsearchService | ElasticsearchServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticsearchServicePaginationConfiguration, + ListElasticsearchInstanceTypesCommandInput, + ListElasticsearchInstanceTypesCommandOutput +>(ElasticsearchServiceClient, ListElasticsearchInstanceTypesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-elasticsearch-service/src/pagination/ListElasticsearchVersionsPaginator.ts b/clients/client-elasticsearch-service/src/pagination/ListElasticsearchVersionsPaginator.ts index 14ea690ea2bd..61bf6d7f3d7b 100644 --- a/clients/client-elasticsearch-service/src/pagination/ListElasticsearchVersionsPaginator.ts +++ b/clients/client-elasticsearch-service/src/pagination/ListElasticsearchVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticsearchServiceClient } from "../ElasticsearchServiceClient"; import { ElasticsearchServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticsearchServiceClient, - input: ListElasticsearchVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListElasticsearchVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListElasticsearchVersions( +export const paginateListElasticsearchVersions: ( config: ElasticsearchServicePaginationConfiguration, input: ListElasticsearchVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListElasticsearchVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ElasticsearchServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticsearchService | ElasticsearchServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticsearchServicePaginationConfiguration, + ListElasticsearchVersionsCommandInput, + ListElasticsearchVersionsCommandOutput +>(ElasticsearchServiceClient, ListElasticsearchVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-elasticsearch-service/src/pagination/ListPackagesForDomainPaginator.ts b/clients/client-elasticsearch-service/src/pagination/ListPackagesForDomainPaginator.ts index 496c975a3764..cea5636000b6 100644 --- a/clients/client-elasticsearch-service/src/pagination/ListPackagesForDomainPaginator.ts +++ b/clients/client-elasticsearch-service/src/pagination/ListPackagesForDomainPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ElasticsearchServiceClient } from "../ElasticsearchServiceClient"; import { ElasticsearchServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ElasticsearchServiceClient, - input: ListPackagesForDomainCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPackagesForDomainCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPackagesForDomain( +export const paginateListPackagesForDomain: ( config: ElasticsearchServicePaginationConfiguration, input: ListPackagesForDomainCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPackagesForDomainCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ElasticsearchServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ElasticsearchService | ElasticsearchServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ElasticsearchServicePaginationConfiguration, + ListPackagesForDomainCommandInput, + ListPackagesForDomainCommandOutput +>(ElasticsearchServiceClient, ListPackagesForDomainCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-emr-containers/src/pagination/ListJobRunsPaginator.ts b/clients/client-emr-containers/src/pagination/ListJobRunsPaginator.ts index c08d478c7747..098a634f8029 100644 --- a/clients/client-emr-containers/src/pagination/ListJobRunsPaginator.ts +++ b/clients/client-emr-containers/src/pagination/ListJobRunsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListJobRunsCommand, ListJobRunsCommandInput, ListJobRunsCommandOutput } from "../commands/ListJobRunsCommand"; import { EMRContainersClient } from "../EMRContainersClient"; import { EMRContainersPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRContainersClient, - input: ListJobRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobRuns( +export const paginateListJobRuns: ( config: EMRContainersPaginationConfiguration, input: ListJobRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobRunsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EMRContainersClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMRContainers | EMRContainersClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRContainersPaginationConfiguration, + ListJobRunsCommandInput, + ListJobRunsCommandOutput +>(EMRContainersClient, ListJobRunsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-emr-containers/src/pagination/ListJobTemplatesPaginator.ts b/clients/client-emr-containers/src/pagination/ListJobTemplatesPaginator.ts index a99dc7660f44..9f72ef92bcb0 100644 --- a/clients/client-emr-containers/src/pagination/ListJobTemplatesPaginator.ts +++ b/clients/client-emr-containers/src/pagination/ListJobTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EMRContainersClient } from "../EMRContainersClient"; import { EMRContainersPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRContainersClient, - input: ListJobTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobTemplates( +export const paginateListJobTemplates: ( config: EMRContainersPaginationConfiguration, input: ListJobTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EMRContainersClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMRContainers | EMRContainersClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRContainersPaginationConfiguration, + ListJobTemplatesCommandInput, + ListJobTemplatesCommandOutput +>(EMRContainersClient, ListJobTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-emr-containers/src/pagination/ListManagedEndpointsPaginator.ts b/clients/client-emr-containers/src/pagination/ListManagedEndpointsPaginator.ts index d7e9d5730416..02eaafc5710a 100644 --- a/clients/client-emr-containers/src/pagination/ListManagedEndpointsPaginator.ts +++ b/clients/client-emr-containers/src/pagination/ListManagedEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EMRContainersClient } from "../EMRContainersClient"; import { EMRContainersPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRContainersClient, - input: ListManagedEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListManagedEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListManagedEndpoints( +export const paginateListManagedEndpoints: ( config: EMRContainersPaginationConfiguration, input: ListManagedEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListManagedEndpointsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EMRContainersClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMRContainers | EMRContainersClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRContainersPaginationConfiguration, + ListManagedEndpointsCommandInput, + ListManagedEndpointsCommandOutput +>(EMRContainersClient, ListManagedEndpointsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-emr-containers/src/pagination/ListVirtualClustersPaginator.ts b/clients/client-emr-containers/src/pagination/ListVirtualClustersPaginator.ts index 21c742fea09b..0f86e1e5d0b7 100644 --- a/clients/client-emr-containers/src/pagination/ListVirtualClustersPaginator.ts +++ b/clients/client-emr-containers/src/pagination/ListVirtualClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EMRContainersClient } from "../EMRContainersClient"; import { EMRContainersPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRContainersClient, - input: ListVirtualClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVirtualClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVirtualClusters( +export const paginateListVirtualClusters: ( config: EMRContainersPaginationConfiguration, input: ListVirtualClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVirtualClustersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EMRContainersClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMRContainers | EMRContainersClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRContainersPaginationConfiguration, + ListVirtualClustersCommandInput, + ListVirtualClustersCommandOutput +>(EMRContainersClient, ListVirtualClustersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-emr-serverless/src/pagination/ListApplicationsPaginator.ts b/clients/client-emr-serverless/src/pagination/ListApplicationsPaginator.ts index 9a33c2dead3d..ae56bb5750de 100644 --- a/clients/client-emr-serverless/src/pagination/ListApplicationsPaginator.ts +++ b/clients/client-emr-serverless/src/pagination/ListApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EMRServerlessClient } from "../EMRServerlessClient"; import { EMRServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRServerlessClient, - input: ListApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplications( +export const paginateListApplications: ( config: EMRServerlessPaginationConfiguration, input: ListApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EMRServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMRServerless | EMRServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRServerlessPaginationConfiguration, + ListApplicationsCommandInput, + ListApplicationsCommandOutput +>(EMRServerlessClient, ListApplicationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-emr-serverless/src/pagination/ListJobRunsPaginator.ts b/clients/client-emr-serverless/src/pagination/ListJobRunsPaginator.ts index 405a61f2e92c..ca93eee0b6aa 100644 --- a/clients/client-emr-serverless/src/pagination/ListJobRunsPaginator.ts +++ b/clients/client-emr-serverless/src/pagination/ListJobRunsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListJobRunsCommand, ListJobRunsCommandInput, ListJobRunsCommandOutput } from "../commands/ListJobRunsCommand"; import { EMRServerlessClient } from "../EMRServerlessClient"; import { EMRServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRServerlessClient, - input: ListJobRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobRuns( +export const paginateListJobRuns: ( config: EMRServerlessPaginationConfiguration, input: ListJobRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobRunsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EMRServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMRServerless | EMRServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRServerlessPaginationConfiguration, + ListJobRunsCommandInput, + ListJobRunsCommandOutput +>(EMRServerlessClient, ListJobRunsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-emr/package.json b/clients/client-emr/package.json index e3922a721543..f034d8a47d4c 100644 --- a/clients/client-emr/package.json +++ b/clients/client-emr/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-emr/src/pagination/ListBootstrapActionsPaginator.ts b/clients/client-emr/src/pagination/ListBootstrapActionsPaginator.ts index e1a118e8f445..e1050ca524aa 100644 --- a/clients/client-emr/src/pagination/ListBootstrapActionsPaginator.ts +++ b/clients/client-emr/src/pagination/ListBootstrapActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { EMRClient } from "../EMRClient"; import { EMRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRClient, - input: ListBootstrapActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBootstrapActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBootstrapActions( +export const paginateListBootstrapActions: ( config: EMRPaginationConfiguration, input: ListBootstrapActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBootstrapActionsCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof EMRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMR | EMRClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRPaginationConfiguration, + ListBootstrapActionsCommandInput, + ListBootstrapActionsCommandOutput +>(EMRClient, ListBootstrapActionsCommand, "Marker", "Marker", ""); diff --git a/clients/client-emr/src/pagination/ListClustersPaginator.ts b/clients/client-emr/src/pagination/ListClustersPaginator.ts index 8b0ababdab94..9aa1fd9b181a 100644 --- a/clients/client-emr/src/pagination/ListClustersPaginator.ts +++ b/clients/client-emr/src/pagination/ListClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { EMRClient } from "../EMRClient"; import { EMRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRClient, - input: ListClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClusters( +export const paginateListClusters: ( config: EMRPaginationConfiguration, input: ListClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClustersCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof EMRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMR | EMRClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRPaginationConfiguration, + ListClustersCommandInput, + ListClustersCommandOutput +>(EMRClient, ListClustersCommand, "Marker", "Marker", ""); diff --git a/clients/client-emr/src/pagination/ListInstanceFleetsPaginator.ts b/clients/client-emr/src/pagination/ListInstanceFleetsPaginator.ts index 8699a61db48d..e2bd606e70d8 100644 --- a/clients/client-emr/src/pagination/ListInstanceFleetsPaginator.ts +++ b/clients/client-emr/src/pagination/ListInstanceFleetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { EMRClient } from "../EMRClient"; import { EMRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRClient, - input: ListInstanceFleetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInstanceFleetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInstanceFleets( +export const paginateListInstanceFleets: ( config: EMRPaginationConfiguration, input: ListInstanceFleetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInstanceFleetsCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof EMRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMR | EMRClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRPaginationConfiguration, + ListInstanceFleetsCommandInput, + ListInstanceFleetsCommandOutput +>(EMRClient, ListInstanceFleetsCommand, "Marker", "Marker", ""); diff --git a/clients/client-emr/src/pagination/ListInstanceGroupsPaginator.ts b/clients/client-emr/src/pagination/ListInstanceGroupsPaginator.ts index 86d6ca0c3339..5980f8421d7c 100644 --- a/clients/client-emr/src/pagination/ListInstanceGroupsPaginator.ts +++ b/clients/client-emr/src/pagination/ListInstanceGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { EMRClient } from "../EMRClient"; import { EMRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRClient, - input: ListInstanceGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInstanceGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInstanceGroups( +export const paginateListInstanceGroups: ( config: EMRPaginationConfiguration, input: ListInstanceGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInstanceGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof EMRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMR | EMRClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRPaginationConfiguration, + ListInstanceGroupsCommandInput, + ListInstanceGroupsCommandOutput +>(EMRClient, ListInstanceGroupsCommand, "Marker", "Marker", ""); diff --git a/clients/client-emr/src/pagination/ListInstancesPaginator.ts b/clients/client-emr/src/pagination/ListInstancesPaginator.ts index 759bcd235e4f..c617ceac8a57 100644 --- a/clients/client-emr/src/pagination/ListInstancesPaginator.ts +++ b/clients/client-emr/src/pagination/ListInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { EMRClient } from "../EMRClient"; import { EMRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRClient, - input: ListInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInstances( +export const paginateListInstances: ( config: EMRPaginationConfiguration, input: ListInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInstancesCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof EMRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMR | EMRClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRPaginationConfiguration, + ListInstancesCommandInput, + ListInstancesCommandOutput +>(EMRClient, ListInstancesCommand, "Marker", "Marker", ""); diff --git a/clients/client-emr/src/pagination/ListNotebookExecutionsPaginator.ts b/clients/client-emr/src/pagination/ListNotebookExecutionsPaginator.ts index d8cf734948c2..4e01018d1ff2 100644 --- a/clients/client-emr/src/pagination/ListNotebookExecutionsPaginator.ts +++ b/clients/client-emr/src/pagination/ListNotebookExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { EMRClient } from "../EMRClient"; import { EMRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRClient, - input: ListNotebookExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNotebookExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNotebookExecutions( +export const paginateListNotebookExecutions: ( config: EMRPaginationConfiguration, input: ListNotebookExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNotebookExecutionsCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof EMRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMR | EMRClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRPaginationConfiguration, + ListNotebookExecutionsCommandInput, + ListNotebookExecutionsCommandOutput +>(EMRClient, ListNotebookExecutionsCommand, "Marker", "Marker", ""); diff --git a/clients/client-emr/src/pagination/ListReleaseLabelsPaginator.ts b/clients/client-emr/src/pagination/ListReleaseLabelsPaginator.ts index 0b3c33694cb5..dd664519b408 100644 --- a/clients/client-emr/src/pagination/ListReleaseLabelsPaginator.ts +++ b/clients/client-emr/src/pagination/ListReleaseLabelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EMRClient } from "../EMRClient"; import { EMRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRClient, - input: ListReleaseLabelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReleaseLabelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReleaseLabels( +export const paginateListReleaseLabels: ( config: EMRPaginationConfiguration, input: ListReleaseLabelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReleaseLabelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof EMRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMR | EMRClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRPaginationConfiguration, + ListReleaseLabelsCommandInput, + ListReleaseLabelsCommandOutput +>(EMRClient, ListReleaseLabelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-emr/src/pagination/ListSecurityConfigurationsPaginator.ts b/clients/client-emr/src/pagination/ListSecurityConfigurationsPaginator.ts index 39791adbbf7e..0db03906052d 100644 --- a/clients/client-emr/src/pagination/ListSecurityConfigurationsPaginator.ts +++ b/clients/client-emr/src/pagination/ListSecurityConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { EMRClient } from "../EMRClient"; import { EMRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRClient, - input: ListSecurityConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSecurityConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSecurityConfigurations( +export const paginateListSecurityConfigurations: ( config: EMRPaginationConfiguration, input: ListSecurityConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSecurityConfigurationsCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof EMRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMR | EMRClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRPaginationConfiguration, + ListSecurityConfigurationsCommandInput, + ListSecurityConfigurationsCommandOutput +>(EMRClient, ListSecurityConfigurationsCommand, "Marker", "Marker", ""); diff --git a/clients/client-emr/src/pagination/ListStepsPaginator.ts b/clients/client-emr/src/pagination/ListStepsPaginator.ts index 6fb7bdb3d89d..2f1904ddc402 100644 --- a/clients/client-emr/src/pagination/ListStepsPaginator.ts +++ b/clients/client-emr/src/pagination/ListStepsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListStepsCommand, ListStepsCommandInput, ListStepsCommandOutput } from "../commands/ListStepsCommand"; import { EMRClient } from "../EMRClient"; import { EMRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRClient, - input: ListStepsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStepsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSteps( +export const paginateListSteps: ( config: EMRPaginationConfiguration, input: ListStepsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStepsCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof EMRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMR | EMRClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRPaginationConfiguration, + ListStepsCommandInput, + ListStepsCommandOutput +>(EMRClient, ListStepsCommand, "Marker", "Marker", ""); diff --git a/clients/client-emr/src/pagination/ListStudioSessionMappingsPaginator.ts b/clients/client-emr/src/pagination/ListStudioSessionMappingsPaginator.ts index d53e1eb6fd22..1e93f8f9b713 100644 --- a/clients/client-emr/src/pagination/ListStudioSessionMappingsPaginator.ts +++ b/clients/client-emr/src/pagination/ListStudioSessionMappingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { EMRClient } from "../EMRClient"; import { EMRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRClient, - input: ListStudioSessionMappingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStudioSessionMappingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStudioSessionMappings( +export const paginateListStudioSessionMappings: ( config: EMRPaginationConfiguration, input: ListStudioSessionMappingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStudioSessionMappingsCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof EMRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMR | EMRClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRPaginationConfiguration, + ListStudioSessionMappingsCommandInput, + ListStudioSessionMappingsCommandOutput +>(EMRClient, ListStudioSessionMappingsCommand, "Marker", "Marker", ""); diff --git a/clients/client-emr/src/pagination/ListStudiosPaginator.ts b/clients/client-emr/src/pagination/ListStudiosPaginator.ts index 786befc18685..e86967e0d5c6 100644 --- a/clients/client-emr/src/pagination/ListStudiosPaginator.ts +++ b/clients/client-emr/src/pagination/ListStudiosPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListStudiosCommand, ListStudiosCommandInput, ListStudiosCommandOutput } from "../commands/ListStudiosCommand"; import { EMRClient } from "../EMRClient"; import { EMRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRClient, - input: ListStudiosCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStudiosCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStudios( +export const paginateListStudios: ( config: EMRPaginationConfiguration, input: ListStudiosCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStudiosCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof EMRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMR | EMRClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRPaginationConfiguration, + ListStudiosCommandInput, + ListStudiosCommandOutput +>(EMRClient, ListStudiosCommand, "Marker", "Marker", ""); diff --git a/clients/client-emr/src/pagination/ListSupportedInstanceTypesPaginator.ts b/clients/client-emr/src/pagination/ListSupportedInstanceTypesPaginator.ts index 24938765d94f..0c03c0442ff2 100644 --- a/clients/client-emr/src/pagination/ListSupportedInstanceTypesPaginator.ts +++ b/clients/client-emr/src/pagination/ListSupportedInstanceTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { EMRClient } from "../EMRClient"; import { EMRPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EMRClient, - input: ListSupportedInstanceTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSupportedInstanceTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSupportedInstanceTypes( +export const paginateListSupportedInstanceTypes: ( config: EMRPaginationConfiguration, input: ListSupportedInstanceTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSupportedInstanceTypesCommandOutput; - while (hasNext) { - input.Marker = token; - if (config.client instanceof EMRClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EMR | EMRClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EMRPaginationConfiguration, + ListSupportedInstanceTypesCommandInput, + ListSupportedInstanceTypesCommandOutput +>(EMRClient, ListSupportedInstanceTypesCommand, "Marker", "Marker", ""); diff --git a/clients/client-entityresolution/src/pagination/ListIdMappingJobsPaginator.ts b/clients/client-entityresolution/src/pagination/ListIdMappingJobsPaginator.ts index 02a73c891719..415376c854ee 100644 --- a/clients/client-entityresolution/src/pagination/ListIdMappingJobsPaginator.ts +++ b/clients/client-entityresolution/src/pagination/ListIdMappingJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EntityResolutionClient } from "../EntityResolutionClient"; import { EntityResolutionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EntityResolutionClient, - input: ListIdMappingJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIdMappingJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIdMappingJobs( +export const paginateListIdMappingJobs: ( config: EntityResolutionPaginationConfiguration, input: ListIdMappingJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIdMappingJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EntityResolutionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EntityResolution | EntityResolutionClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EntityResolutionPaginationConfiguration, + ListIdMappingJobsCommandInput, + ListIdMappingJobsCommandOutput +>(EntityResolutionClient, ListIdMappingJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-entityresolution/src/pagination/ListIdMappingWorkflowsPaginator.ts b/clients/client-entityresolution/src/pagination/ListIdMappingWorkflowsPaginator.ts index 1c2bcc172d95..5bdd6826e757 100644 --- a/clients/client-entityresolution/src/pagination/ListIdMappingWorkflowsPaginator.ts +++ b/clients/client-entityresolution/src/pagination/ListIdMappingWorkflowsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EntityResolutionClient } from "../EntityResolutionClient"; import { EntityResolutionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EntityResolutionClient, - input: ListIdMappingWorkflowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIdMappingWorkflowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIdMappingWorkflows( +export const paginateListIdMappingWorkflows: ( config: EntityResolutionPaginationConfiguration, input: ListIdMappingWorkflowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIdMappingWorkflowsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EntityResolutionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EntityResolution | EntityResolutionClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EntityResolutionPaginationConfiguration, + ListIdMappingWorkflowsCommandInput, + ListIdMappingWorkflowsCommandOutput +>(EntityResolutionClient, ListIdMappingWorkflowsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-entityresolution/src/pagination/ListMatchingJobsPaginator.ts b/clients/client-entityresolution/src/pagination/ListMatchingJobsPaginator.ts index 7619910764c5..9069bf4b082f 100644 --- a/clients/client-entityresolution/src/pagination/ListMatchingJobsPaginator.ts +++ b/clients/client-entityresolution/src/pagination/ListMatchingJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EntityResolutionClient } from "../EntityResolutionClient"; import { EntityResolutionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EntityResolutionClient, - input: ListMatchingJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMatchingJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMatchingJobs( +export const paginateListMatchingJobs: ( config: EntityResolutionPaginationConfiguration, input: ListMatchingJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMatchingJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EntityResolutionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EntityResolution | EntityResolutionClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EntityResolutionPaginationConfiguration, + ListMatchingJobsCommandInput, + ListMatchingJobsCommandOutput +>(EntityResolutionClient, ListMatchingJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-entityresolution/src/pagination/ListMatchingWorkflowsPaginator.ts b/clients/client-entityresolution/src/pagination/ListMatchingWorkflowsPaginator.ts index 544988f76ccd..dd5fdf3cd04d 100644 --- a/clients/client-entityresolution/src/pagination/ListMatchingWorkflowsPaginator.ts +++ b/clients/client-entityresolution/src/pagination/ListMatchingWorkflowsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EntityResolutionClient } from "../EntityResolutionClient"; import { EntityResolutionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EntityResolutionClient, - input: ListMatchingWorkflowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMatchingWorkflowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMatchingWorkflows( +export const paginateListMatchingWorkflows: ( config: EntityResolutionPaginationConfiguration, input: ListMatchingWorkflowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMatchingWorkflowsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EntityResolutionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EntityResolution | EntityResolutionClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EntityResolutionPaginationConfiguration, + ListMatchingWorkflowsCommandInput, + ListMatchingWorkflowsCommandOutput +>(EntityResolutionClient, ListMatchingWorkflowsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-entityresolution/src/pagination/ListProviderServicesPaginator.ts b/clients/client-entityresolution/src/pagination/ListProviderServicesPaginator.ts index 85de45fc8a51..f9371df404e6 100644 --- a/clients/client-entityresolution/src/pagination/ListProviderServicesPaginator.ts +++ b/clients/client-entityresolution/src/pagination/ListProviderServicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EntityResolutionClient } from "../EntityResolutionClient"; import { EntityResolutionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EntityResolutionClient, - input: ListProviderServicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProviderServicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProviderServices( +export const paginateListProviderServices: ( config: EntityResolutionPaginationConfiguration, input: ListProviderServicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProviderServicesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EntityResolutionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EntityResolution | EntityResolutionClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EntityResolutionPaginationConfiguration, + ListProviderServicesCommandInput, + ListProviderServicesCommandOutput +>(EntityResolutionClient, ListProviderServicesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-entityresolution/src/pagination/ListSchemaMappingsPaginator.ts b/clients/client-entityresolution/src/pagination/ListSchemaMappingsPaginator.ts index 1557a405301e..39eb1d23eee9 100644 --- a/clients/client-entityresolution/src/pagination/ListSchemaMappingsPaginator.ts +++ b/clients/client-entityresolution/src/pagination/ListSchemaMappingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EntityResolutionClient } from "../EntityResolutionClient"; import { EntityResolutionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EntityResolutionClient, - input: ListSchemaMappingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSchemaMappingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSchemaMappings( +export const paginateListSchemaMappings: ( config: EntityResolutionPaginationConfiguration, input: ListSchemaMappingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSchemaMappingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EntityResolutionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected EntityResolution | EntityResolutionClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EntityResolutionPaginationConfiguration, + ListSchemaMappingsCommandInput, + ListSchemaMappingsCommandOutput +>(EntityResolutionClient, ListSchemaMappingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-evidently/src/pagination/ListExperimentsPaginator.ts b/clients/client-evidently/src/pagination/ListExperimentsPaginator.ts index bc2744a75c6f..9d4597ccabd0 100644 --- a/clients/client-evidently/src/pagination/ListExperimentsPaginator.ts +++ b/clients/client-evidently/src/pagination/ListExperimentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EvidentlyClient } from "../EvidentlyClient"; import { EvidentlyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EvidentlyClient, - input: ListExperimentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExperimentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExperiments( +export const paginateListExperiments: ( config: EvidentlyPaginationConfiguration, input: ListExperimentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExperimentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EvidentlyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Evidently | EvidentlyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EvidentlyPaginationConfiguration, + ListExperimentsCommandInput, + ListExperimentsCommandOutput +>(EvidentlyClient, ListExperimentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-evidently/src/pagination/ListFeaturesPaginator.ts b/clients/client-evidently/src/pagination/ListFeaturesPaginator.ts index 07088eb40a1d..44ed9ece56a4 100644 --- a/clients/client-evidently/src/pagination/ListFeaturesPaginator.ts +++ b/clients/client-evidently/src/pagination/ListFeaturesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EvidentlyClient } from "../EvidentlyClient"; import { EvidentlyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EvidentlyClient, - input: ListFeaturesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFeaturesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFeatures( +export const paginateListFeatures: ( config: EvidentlyPaginationConfiguration, input: ListFeaturesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFeaturesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EvidentlyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Evidently | EvidentlyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EvidentlyPaginationConfiguration, + ListFeaturesCommandInput, + ListFeaturesCommandOutput +>(EvidentlyClient, ListFeaturesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-evidently/src/pagination/ListLaunchesPaginator.ts b/clients/client-evidently/src/pagination/ListLaunchesPaginator.ts index 3c1dabe624cd..bbe762aad0cd 100644 --- a/clients/client-evidently/src/pagination/ListLaunchesPaginator.ts +++ b/clients/client-evidently/src/pagination/ListLaunchesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EvidentlyClient } from "../EvidentlyClient"; import { EvidentlyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EvidentlyClient, - input: ListLaunchesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLaunchesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLaunches( +export const paginateListLaunches: ( config: EvidentlyPaginationConfiguration, input: ListLaunchesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLaunchesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EvidentlyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Evidently | EvidentlyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EvidentlyPaginationConfiguration, + ListLaunchesCommandInput, + ListLaunchesCommandOutput +>(EvidentlyClient, ListLaunchesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-evidently/src/pagination/ListProjectsPaginator.ts b/clients/client-evidently/src/pagination/ListProjectsPaginator.ts index 23941a8137be..bf0dac142c19 100644 --- a/clients/client-evidently/src/pagination/ListProjectsPaginator.ts +++ b/clients/client-evidently/src/pagination/ListProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EvidentlyClient } from "../EvidentlyClient"; import { EvidentlyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EvidentlyClient, - input: ListProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProjects( +export const paginateListProjects: ( config: EvidentlyPaginationConfiguration, input: ListProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProjectsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EvidentlyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Evidently | EvidentlyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EvidentlyPaginationConfiguration, + ListProjectsCommandInput, + ListProjectsCommandOutput +>(EvidentlyClient, ListProjectsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-evidently/src/pagination/ListSegmentReferencesPaginator.ts b/clients/client-evidently/src/pagination/ListSegmentReferencesPaginator.ts index 56de659917c3..6b6ae9c6ef57 100644 --- a/clients/client-evidently/src/pagination/ListSegmentReferencesPaginator.ts +++ b/clients/client-evidently/src/pagination/ListSegmentReferencesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EvidentlyClient } from "../EvidentlyClient"; import { EvidentlyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EvidentlyClient, - input: ListSegmentReferencesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSegmentReferencesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSegmentReferences( +export const paginateListSegmentReferences: ( config: EvidentlyPaginationConfiguration, input: ListSegmentReferencesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSegmentReferencesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EvidentlyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Evidently | EvidentlyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EvidentlyPaginationConfiguration, + ListSegmentReferencesCommandInput, + ListSegmentReferencesCommandOutput +>(EvidentlyClient, ListSegmentReferencesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-evidently/src/pagination/ListSegmentsPaginator.ts b/clients/client-evidently/src/pagination/ListSegmentsPaginator.ts index 93374ea73dbe..a84b8a3318cc 100644 --- a/clients/client-evidently/src/pagination/ListSegmentsPaginator.ts +++ b/clients/client-evidently/src/pagination/ListSegmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { EvidentlyClient } from "../EvidentlyClient"; import { EvidentlyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: EvidentlyClient, - input: ListSegmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSegmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSegments( +export const paginateListSegments: ( config: EvidentlyPaginationConfiguration, input: ListSegmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSegmentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof EvidentlyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Evidently | EvidentlyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + EvidentlyPaginationConfiguration, + ListSegmentsCommandInput, + ListSegmentsCommandOutput +>(EvidentlyClient, ListSegmentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-finspace-data/src/pagination/ListChangesetsPaginator.ts b/clients/client-finspace-data/src/pagination/ListChangesetsPaginator.ts index aa4ff92e6ca3..6fcb25e171aa 100644 --- a/clients/client-finspace-data/src/pagination/ListChangesetsPaginator.ts +++ b/clients/client-finspace-data/src/pagination/ListChangesetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FinspaceDataClient } from "../FinspaceDataClient"; import { FinspaceDataPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FinspaceDataClient, - input: ListChangesetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChangesetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChangesets( +export const paginateListChangesets: ( config: FinspaceDataPaginationConfiguration, input: ListChangesetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChangesetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FinspaceDataClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FinspaceData | FinspaceDataClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FinspaceDataPaginationConfiguration, + ListChangesetsCommandInput, + ListChangesetsCommandOutput +>(FinspaceDataClient, ListChangesetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-finspace-data/src/pagination/ListDataViewsPaginator.ts b/clients/client-finspace-data/src/pagination/ListDataViewsPaginator.ts index 5084d1882598..5b0c2dcfd5bd 100644 --- a/clients/client-finspace-data/src/pagination/ListDataViewsPaginator.ts +++ b/clients/client-finspace-data/src/pagination/ListDataViewsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FinspaceDataClient } from "../FinspaceDataClient"; import { FinspaceDataPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FinspaceDataClient, - input: ListDataViewsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataViewsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataViews( +export const paginateListDataViews: ( config: FinspaceDataPaginationConfiguration, input: ListDataViewsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataViewsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FinspaceDataClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FinspaceData | FinspaceDataClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FinspaceDataPaginationConfiguration, + ListDataViewsCommandInput, + ListDataViewsCommandOutput +>(FinspaceDataClient, ListDataViewsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-finspace-data/src/pagination/ListDatasetsPaginator.ts b/clients/client-finspace-data/src/pagination/ListDatasetsPaginator.ts index da9e35413af0..ea45d82f483b 100644 --- a/clients/client-finspace-data/src/pagination/ListDatasetsPaginator.ts +++ b/clients/client-finspace-data/src/pagination/ListDatasetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FinspaceDataClient } from "../FinspaceDataClient"; import { FinspaceDataPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FinspaceDataClient, - input: ListDatasetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasets( +export const paginateListDatasets: ( config: FinspaceDataPaginationConfiguration, input: ListDatasetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FinspaceDataClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FinspaceData | FinspaceDataClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FinspaceDataPaginationConfiguration, + ListDatasetsCommandInput, + ListDatasetsCommandOutput +>(FinspaceDataClient, ListDatasetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-finspace-data/src/pagination/ListPermissionGroupsPaginator.ts b/clients/client-finspace-data/src/pagination/ListPermissionGroupsPaginator.ts index dd6a2f5a9d6d..3e816326f6da 100644 --- a/clients/client-finspace-data/src/pagination/ListPermissionGroupsPaginator.ts +++ b/clients/client-finspace-data/src/pagination/ListPermissionGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FinspaceDataClient } from "../FinspaceDataClient"; import { FinspaceDataPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FinspaceDataClient, - input: ListPermissionGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPermissionGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPermissionGroups( +export const paginateListPermissionGroups: ( config: FinspaceDataPaginationConfiguration, input: ListPermissionGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPermissionGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FinspaceDataClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FinspaceData | FinspaceDataClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FinspaceDataPaginationConfiguration, + ListPermissionGroupsCommandInput, + ListPermissionGroupsCommandOutput +>(FinspaceDataClient, ListPermissionGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-finspace-data/src/pagination/ListUsersPaginator.ts b/clients/client-finspace-data/src/pagination/ListUsersPaginator.ts index 7623bb70628f..0d7f7f31e478 100644 --- a/clients/client-finspace-data/src/pagination/ListUsersPaginator.ts +++ b/clients/client-finspace-data/src/pagination/ListUsersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListUsersCommand, ListUsersCommandInput, ListUsersCommandOutput } from "../commands/ListUsersCommand"; import { FinspaceDataClient } from "../FinspaceDataClient"; import { FinspaceDataPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FinspaceDataClient, - input: ListUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUsers( +export const paginateListUsers: ( config: FinspaceDataPaginationConfiguration, input: ListUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUsersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FinspaceDataClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FinspaceData | FinspaceDataClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FinspaceDataPaginationConfiguration, + ListUsersCommandInput, + ListUsersCommandOutput +>(FinspaceDataClient, ListUsersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-finspace/src/pagination/ListKxChangesetsPaginator.ts b/clients/client-finspace/src/pagination/ListKxChangesetsPaginator.ts index 4383bc9e0b7a..8cd583a85489 100644 --- a/clients/client-finspace/src/pagination/ListKxChangesetsPaginator.ts +++ b/clients/client-finspace/src/pagination/ListKxChangesetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FinspaceClient } from "../FinspaceClient"; import { FinspacePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FinspaceClient, - input: ListKxChangesetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKxChangesetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKxChangesets( +export const paginateListKxChangesets: ( config: FinspacePaginationConfiguration, input: ListKxChangesetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKxChangesetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FinspaceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Finspace | FinspaceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FinspacePaginationConfiguration, + ListKxChangesetsCommandInput, + ListKxChangesetsCommandOutput +>(FinspaceClient, ListKxChangesetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-finspace/src/pagination/ListKxClusterNodesPaginator.ts b/clients/client-finspace/src/pagination/ListKxClusterNodesPaginator.ts index 683f1ab5bd3b..a859563d1a12 100644 --- a/clients/client-finspace/src/pagination/ListKxClusterNodesPaginator.ts +++ b/clients/client-finspace/src/pagination/ListKxClusterNodesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FinspaceClient } from "../FinspaceClient"; import { FinspacePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FinspaceClient, - input: ListKxClusterNodesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKxClusterNodesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKxClusterNodes( +export const paginateListKxClusterNodes: ( config: FinspacePaginationConfiguration, input: ListKxClusterNodesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKxClusterNodesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FinspaceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Finspace | FinspaceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FinspacePaginationConfiguration, + ListKxClusterNodesCommandInput, + ListKxClusterNodesCommandOutput +>(FinspaceClient, ListKxClusterNodesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-finspace/src/pagination/ListKxDatabasesPaginator.ts b/clients/client-finspace/src/pagination/ListKxDatabasesPaginator.ts index 22effd7e4478..c0b56d5ce62a 100644 --- a/clients/client-finspace/src/pagination/ListKxDatabasesPaginator.ts +++ b/clients/client-finspace/src/pagination/ListKxDatabasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FinspaceClient } from "../FinspaceClient"; import { FinspacePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FinspaceClient, - input: ListKxDatabasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKxDatabasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKxDatabases( +export const paginateListKxDatabases: ( config: FinspacePaginationConfiguration, input: ListKxDatabasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKxDatabasesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FinspaceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Finspace | FinspaceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FinspacePaginationConfiguration, + ListKxDatabasesCommandInput, + ListKxDatabasesCommandOutput +>(FinspaceClient, ListKxDatabasesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-finspace/src/pagination/ListKxDataviewsPaginator.ts b/clients/client-finspace/src/pagination/ListKxDataviewsPaginator.ts index 307306127699..61619934b112 100644 --- a/clients/client-finspace/src/pagination/ListKxDataviewsPaginator.ts +++ b/clients/client-finspace/src/pagination/ListKxDataviewsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FinspaceClient } from "../FinspaceClient"; import { FinspacePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FinspaceClient, - input: ListKxDataviewsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKxDataviewsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKxDataviews( +export const paginateListKxDataviews: ( config: FinspacePaginationConfiguration, input: ListKxDataviewsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKxDataviewsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FinspaceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Finspace | FinspaceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FinspacePaginationConfiguration, + ListKxDataviewsCommandInput, + ListKxDataviewsCommandOutput +>(FinspaceClient, ListKxDataviewsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-finspace/src/pagination/ListKxEnvironmentsPaginator.ts b/clients/client-finspace/src/pagination/ListKxEnvironmentsPaginator.ts index da76d9355e99..673183f04f25 100644 --- a/clients/client-finspace/src/pagination/ListKxEnvironmentsPaginator.ts +++ b/clients/client-finspace/src/pagination/ListKxEnvironmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FinspaceClient } from "../FinspaceClient"; import { FinspacePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FinspaceClient, - input: ListKxEnvironmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKxEnvironmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKxEnvironments( +export const paginateListKxEnvironments: ( config: FinspacePaginationConfiguration, input: ListKxEnvironmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKxEnvironmentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FinspaceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Finspace | FinspaceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FinspacePaginationConfiguration, + ListKxEnvironmentsCommandInput, + ListKxEnvironmentsCommandOutput +>(FinspaceClient, ListKxEnvironmentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-finspace/src/pagination/ListKxScalingGroupsPaginator.ts b/clients/client-finspace/src/pagination/ListKxScalingGroupsPaginator.ts index 2ccef2e372f6..d70bad090476 100644 --- a/clients/client-finspace/src/pagination/ListKxScalingGroupsPaginator.ts +++ b/clients/client-finspace/src/pagination/ListKxScalingGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FinspaceClient } from "../FinspaceClient"; import { FinspacePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FinspaceClient, - input: ListKxScalingGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKxScalingGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKxScalingGroups( +export const paginateListKxScalingGroups: ( config: FinspacePaginationConfiguration, input: ListKxScalingGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKxScalingGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FinspaceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Finspace | FinspaceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FinspacePaginationConfiguration, + ListKxScalingGroupsCommandInput, + ListKxScalingGroupsCommandOutput +>(FinspaceClient, ListKxScalingGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-fis/src/pagination/ListActionsPaginator.ts b/clients/client-fis/src/pagination/ListActionsPaginator.ts index c6d3e1b3570f..b076ee4f346d 100644 --- a/clients/client-fis/src/pagination/ListActionsPaginator.ts +++ b/clients/client-fis/src/pagination/ListActionsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListActionsCommand, ListActionsCommandInput, ListActionsCommandOutput } from "../commands/ListActionsCommand"; import { FisClient } from "../FisClient"; import { FisPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FisClient, - input: ListActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListActions( +export const paginateListActions: ( config: FisPaginationConfiguration, input: ListActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListActionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FisClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Fis | FisClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FisPaginationConfiguration, + ListActionsCommandInput, + ListActionsCommandOutput +>(FisClient, ListActionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-fis/src/pagination/ListExperimentResolvedTargetsPaginator.ts b/clients/client-fis/src/pagination/ListExperimentResolvedTargetsPaginator.ts index bacf77c18a63..7d7a92d00e4f 100644 --- a/clients/client-fis/src/pagination/ListExperimentResolvedTargetsPaginator.ts +++ b/clients/client-fis/src/pagination/ListExperimentResolvedTargetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FisClient } from "../FisClient"; import { FisPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FisClient, - input: ListExperimentResolvedTargetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExperimentResolvedTargetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExperimentResolvedTargets( +export const paginateListExperimentResolvedTargets: ( config: FisPaginationConfiguration, input: ListExperimentResolvedTargetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExperimentResolvedTargetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FisClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Fis | FisClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FisPaginationConfiguration, + ListExperimentResolvedTargetsCommandInput, + ListExperimentResolvedTargetsCommandOutput +>(FisClient, ListExperimentResolvedTargetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-fis/src/pagination/ListExperimentTemplatesPaginator.ts b/clients/client-fis/src/pagination/ListExperimentTemplatesPaginator.ts index cd156df94856..55d1f2582b1a 100644 --- a/clients/client-fis/src/pagination/ListExperimentTemplatesPaginator.ts +++ b/clients/client-fis/src/pagination/ListExperimentTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FisClient } from "../FisClient"; import { FisPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FisClient, - input: ListExperimentTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExperimentTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExperimentTemplates( +export const paginateListExperimentTemplates: ( config: FisPaginationConfiguration, input: ListExperimentTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExperimentTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FisClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Fis | FisClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FisPaginationConfiguration, + ListExperimentTemplatesCommandInput, + ListExperimentTemplatesCommandOutput +>(FisClient, ListExperimentTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-fis/src/pagination/ListExperimentsPaginator.ts b/clients/client-fis/src/pagination/ListExperimentsPaginator.ts index 211d55cc29fb..f0cb7e5ff1fa 100644 --- a/clients/client-fis/src/pagination/ListExperimentsPaginator.ts +++ b/clients/client-fis/src/pagination/ListExperimentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FisClient } from "../FisClient"; import { FisPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FisClient, - input: ListExperimentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExperimentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExperiments( +export const paginateListExperiments: ( config: FisPaginationConfiguration, input: ListExperimentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExperimentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FisClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Fis | FisClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FisPaginationConfiguration, + ListExperimentsCommandInput, + ListExperimentsCommandOutput +>(FisClient, ListExperimentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-fis/src/pagination/ListTargetAccountConfigurationsPaginator.ts b/clients/client-fis/src/pagination/ListTargetAccountConfigurationsPaginator.ts index 99154d8cec89..65b26d0703b3 100644 --- a/clients/client-fis/src/pagination/ListTargetAccountConfigurationsPaginator.ts +++ b/clients/client-fis/src/pagination/ListTargetAccountConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FisClient } from "../FisClient"; import { FisPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FisClient, - input: ListTargetAccountConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTargetAccountConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTargetAccountConfigurations( +export const paginateListTargetAccountConfigurations: ( config: FisPaginationConfiguration, input: ListTargetAccountConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTargetAccountConfigurationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FisClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Fis | FisClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FisPaginationConfiguration, + ListTargetAccountConfigurationsCommandInput, + ListTargetAccountConfigurationsCommandOutput +>(FisClient, ListTargetAccountConfigurationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-fis/src/pagination/ListTargetResourceTypesPaginator.ts b/clients/client-fis/src/pagination/ListTargetResourceTypesPaginator.ts index 3a4d9688a1af..ff88fca54e87 100644 --- a/clients/client-fis/src/pagination/ListTargetResourceTypesPaginator.ts +++ b/clients/client-fis/src/pagination/ListTargetResourceTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FisClient } from "../FisClient"; import { FisPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FisClient, - input: ListTargetResourceTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTargetResourceTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTargetResourceTypes( +export const paginateListTargetResourceTypes: ( config: FisPaginationConfiguration, input: ListTargetResourceTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTargetResourceTypesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FisClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Fis | FisClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FisPaginationConfiguration, + ListTargetResourceTypesCommandInput, + ListTargetResourceTypesCommandOutput +>(FisClient, ListTargetResourceTypesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-fms/package.json b/clients/client-fms/package.json index 3667c6fce188..31a115018796 100644 --- a/clients/client-fms/package.json +++ b/clients/client-fms/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-fms/src/pagination/ListAdminAccountsForOrganizationPaginator.ts b/clients/client-fms/src/pagination/ListAdminAccountsForOrganizationPaginator.ts index e1c6e81b5e37..83b5770d91f1 100644 --- a/clients/client-fms/src/pagination/ListAdminAccountsForOrganizationPaginator.ts +++ b/clients/client-fms/src/pagination/ListAdminAccountsForOrganizationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FMSClient } from "../FMSClient"; import { FMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FMSClient, - input: ListAdminAccountsForOrganizationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAdminAccountsForOrganizationCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAdminAccountsForOrganization( +export const paginateListAdminAccountsForOrganization: ( config: FMSPaginationConfiguration, input: ListAdminAccountsForOrganizationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAdminAccountsForOrganizationCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FMS | FMSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FMSPaginationConfiguration, + ListAdminAccountsForOrganizationCommandInput, + ListAdminAccountsForOrganizationCommandOutput +>(FMSClient, ListAdminAccountsForOrganizationCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fms/src/pagination/ListAdminsManagingAccountPaginator.ts b/clients/client-fms/src/pagination/ListAdminsManagingAccountPaginator.ts index 7cc1e812c376..3960ba562399 100644 --- a/clients/client-fms/src/pagination/ListAdminsManagingAccountPaginator.ts +++ b/clients/client-fms/src/pagination/ListAdminsManagingAccountPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FMSClient } from "../FMSClient"; import { FMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FMSClient, - input: ListAdminsManagingAccountCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAdminsManagingAccountCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAdminsManagingAccount( +export const paginateListAdminsManagingAccount: ( config: FMSPaginationConfiguration, input: ListAdminsManagingAccountCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAdminsManagingAccountCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FMS | FMSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FMSPaginationConfiguration, + ListAdminsManagingAccountCommandInput, + ListAdminsManagingAccountCommandOutput +>(FMSClient, ListAdminsManagingAccountCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fms/src/pagination/ListAppsListsPaginator.ts b/clients/client-fms/src/pagination/ListAppsListsPaginator.ts index 0660d9a4b5df..a5b0fb622233 100644 --- a/clients/client-fms/src/pagination/ListAppsListsPaginator.ts +++ b/clients/client-fms/src/pagination/ListAppsListsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FMSClient } from "../FMSClient"; import { FMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FMSClient, - input: ListAppsListsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppsListsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppsLists( +export const paginateListAppsLists: ( config: FMSPaginationConfiguration, input: ListAppsListsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppsListsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FMS | FMSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FMSPaginationConfiguration, + ListAppsListsCommandInput, + ListAppsListsCommandOutput +>(FMSClient, ListAppsListsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fms/src/pagination/ListComplianceStatusPaginator.ts b/clients/client-fms/src/pagination/ListComplianceStatusPaginator.ts index 970d7ecde7a1..93785f8e94d0 100644 --- a/clients/client-fms/src/pagination/ListComplianceStatusPaginator.ts +++ b/clients/client-fms/src/pagination/ListComplianceStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FMSClient } from "../FMSClient"; import { FMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FMSClient, - input: ListComplianceStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComplianceStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComplianceStatus( +export const paginateListComplianceStatus: ( config: FMSPaginationConfiguration, input: ListComplianceStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComplianceStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FMS | FMSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FMSPaginationConfiguration, + ListComplianceStatusCommandInput, + ListComplianceStatusCommandOutput +>(FMSClient, ListComplianceStatusCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fms/src/pagination/ListMemberAccountsPaginator.ts b/clients/client-fms/src/pagination/ListMemberAccountsPaginator.ts index 58d31c57f3df..db7e96e9f1df 100644 --- a/clients/client-fms/src/pagination/ListMemberAccountsPaginator.ts +++ b/clients/client-fms/src/pagination/ListMemberAccountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FMSClient } from "../FMSClient"; import { FMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FMSClient, - input: ListMemberAccountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMemberAccountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMemberAccounts( +export const paginateListMemberAccounts: ( config: FMSPaginationConfiguration, input: ListMemberAccountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMemberAccountsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FMS | FMSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FMSPaginationConfiguration, + ListMemberAccountsCommandInput, + ListMemberAccountsCommandOutput +>(FMSClient, ListMemberAccountsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fms/src/pagination/ListPoliciesPaginator.ts b/clients/client-fms/src/pagination/ListPoliciesPaginator.ts index 33b14014b630..1bda63c29179 100644 --- a/clients/client-fms/src/pagination/ListPoliciesPaginator.ts +++ b/clients/client-fms/src/pagination/ListPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FMSClient } from "../FMSClient"; import { FMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FMSClient, - input: ListPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPolicies( +export const paginateListPolicies: ( config: FMSPaginationConfiguration, input: ListPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPoliciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FMS | FMSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FMSPaginationConfiguration, + ListPoliciesCommandInput, + ListPoliciesCommandOutput +>(FMSClient, ListPoliciesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fms/src/pagination/ListProtocolsListsPaginator.ts b/clients/client-fms/src/pagination/ListProtocolsListsPaginator.ts index 76b4e0ad2abf..4c43d9cc4a58 100644 --- a/clients/client-fms/src/pagination/ListProtocolsListsPaginator.ts +++ b/clients/client-fms/src/pagination/ListProtocolsListsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FMSClient } from "../FMSClient"; import { FMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FMSClient, - input: ListProtocolsListsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProtocolsListsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProtocolsLists( +export const paginateListProtocolsLists: ( config: FMSPaginationConfiguration, input: ListProtocolsListsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProtocolsListsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FMS | FMSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FMSPaginationConfiguration, + ListProtocolsListsCommandInput, + ListProtocolsListsCommandOutput +>(FMSClient, ListProtocolsListsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fms/src/pagination/ListThirdPartyFirewallFirewallPoliciesPaginator.ts b/clients/client-fms/src/pagination/ListThirdPartyFirewallFirewallPoliciesPaginator.ts index 2633ece73c60..a59c9944f93b 100644 --- a/clients/client-fms/src/pagination/ListThirdPartyFirewallFirewallPoliciesPaginator.ts +++ b/clients/client-fms/src/pagination/ListThirdPartyFirewallFirewallPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FMSClient } from "../FMSClient"; import { FMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FMSClient, - input: ListThirdPartyFirewallFirewallPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThirdPartyFirewallFirewallPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThirdPartyFirewallFirewallPolicies( +export const paginateListThirdPartyFirewallFirewallPolicies: ( config: FMSPaginationConfiguration, input: ListThirdPartyFirewallFirewallPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThirdPartyFirewallFirewallPoliciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FMS | FMSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FMSPaginationConfiguration, + ListThirdPartyFirewallFirewallPoliciesCommandInput, + ListThirdPartyFirewallFirewallPoliciesCommandOutput +>(FMSClient, ListThirdPartyFirewallFirewallPoliciesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-forecast/package.json b/clients/client-forecast/package.json index b8c83a87b8e8..98011b606181 100644 --- a/clients/client-forecast/package.json +++ b/clients/client-forecast/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-forecast/src/pagination/ListDatasetGroupsPaginator.ts b/clients/client-forecast/src/pagination/ListDatasetGroupsPaginator.ts index c5772ab63287..0f117a6dc55e 100644 --- a/clients/client-forecast/src/pagination/ListDatasetGroupsPaginator.ts +++ b/clients/client-forecast/src/pagination/ListDatasetGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ForecastClient } from "../ForecastClient"; import { ForecastPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ForecastClient, - input: ListDatasetGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasetGroups( +export const paginateListDatasetGroups: ( config: ForecastPaginationConfiguration, input: ListDatasetGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ForecastClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Forecast | ForecastClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ForecastPaginationConfiguration, + ListDatasetGroupsCommandInput, + ListDatasetGroupsCommandOutput +>(ForecastClient, ListDatasetGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-forecast/src/pagination/ListDatasetImportJobsPaginator.ts b/clients/client-forecast/src/pagination/ListDatasetImportJobsPaginator.ts index b3dd64b68779..2524db0d67f1 100644 --- a/clients/client-forecast/src/pagination/ListDatasetImportJobsPaginator.ts +++ b/clients/client-forecast/src/pagination/ListDatasetImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ForecastClient } from "../ForecastClient"; import { ForecastPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ForecastClient, - input: ListDatasetImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasetImportJobs( +export const paginateListDatasetImportJobs: ( config: ForecastPaginationConfiguration, input: ListDatasetImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetImportJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ForecastClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Forecast | ForecastClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ForecastPaginationConfiguration, + ListDatasetImportJobsCommandInput, + ListDatasetImportJobsCommandOutput +>(ForecastClient, ListDatasetImportJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-forecast/src/pagination/ListDatasetsPaginator.ts b/clients/client-forecast/src/pagination/ListDatasetsPaginator.ts index a17bb84cac56..766e6599989a 100644 --- a/clients/client-forecast/src/pagination/ListDatasetsPaginator.ts +++ b/clients/client-forecast/src/pagination/ListDatasetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ForecastClient } from "../ForecastClient"; import { ForecastPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ForecastClient, - input: ListDatasetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasets( +export const paginateListDatasets: ( config: ForecastPaginationConfiguration, input: ListDatasetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ForecastClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Forecast | ForecastClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ForecastPaginationConfiguration, + ListDatasetsCommandInput, + ListDatasetsCommandOutput +>(ForecastClient, ListDatasetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-forecast/src/pagination/ListExplainabilitiesPaginator.ts b/clients/client-forecast/src/pagination/ListExplainabilitiesPaginator.ts index c9c227708ad3..159a2807b975 100644 --- a/clients/client-forecast/src/pagination/ListExplainabilitiesPaginator.ts +++ b/clients/client-forecast/src/pagination/ListExplainabilitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ForecastClient } from "../ForecastClient"; import { ForecastPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ForecastClient, - input: ListExplainabilitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExplainabilitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExplainabilities( +export const paginateListExplainabilities: ( config: ForecastPaginationConfiguration, input: ListExplainabilitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExplainabilitiesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ForecastClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Forecast | ForecastClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ForecastPaginationConfiguration, + ListExplainabilitiesCommandInput, + ListExplainabilitiesCommandOutput +>(ForecastClient, ListExplainabilitiesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-forecast/src/pagination/ListExplainabilityExportsPaginator.ts b/clients/client-forecast/src/pagination/ListExplainabilityExportsPaginator.ts index ae1165be2ca0..02ab5b38a0f7 100644 --- a/clients/client-forecast/src/pagination/ListExplainabilityExportsPaginator.ts +++ b/clients/client-forecast/src/pagination/ListExplainabilityExportsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ForecastClient } from "../ForecastClient"; import { ForecastPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ForecastClient, - input: ListExplainabilityExportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExplainabilityExportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExplainabilityExports( +export const paginateListExplainabilityExports: ( config: ForecastPaginationConfiguration, input: ListExplainabilityExportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExplainabilityExportsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ForecastClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Forecast | ForecastClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ForecastPaginationConfiguration, + ListExplainabilityExportsCommandInput, + ListExplainabilityExportsCommandOutput +>(ForecastClient, ListExplainabilityExportsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-forecast/src/pagination/ListForecastExportJobsPaginator.ts b/clients/client-forecast/src/pagination/ListForecastExportJobsPaginator.ts index 8c3f410bfee6..79eee172a092 100644 --- a/clients/client-forecast/src/pagination/ListForecastExportJobsPaginator.ts +++ b/clients/client-forecast/src/pagination/ListForecastExportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ForecastClient } from "../ForecastClient"; import { ForecastPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ForecastClient, - input: ListForecastExportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListForecastExportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListForecastExportJobs( +export const paginateListForecastExportJobs: ( config: ForecastPaginationConfiguration, input: ListForecastExportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListForecastExportJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ForecastClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Forecast | ForecastClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ForecastPaginationConfiguration, + ListForecastExportJobsCommandInput, + ListForecastExportJobsCommandOutput +>(ForecastClient, ListForecastExportJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-forecast/src/pagination/ListForecastsPaginator.ts b/clients/client-forecast/src/pagination/ListForecastsPaginator.ts index 2c3d996c121e..ca70799492c5 100644 --- a/clients/client-forecast/src/pagination/ListForecastsPaginator.ts +++ b/clients/client-forecast/src/pagination/ListForecastsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ForecastClient } from "../ForecastClient"; import { ForecastPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ForecastClient, - input: ListForecastsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListForecastsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListForecasts( +export const paginateListForecasts: ( config: ForecastPaginationConfiguration, input: ListForecastsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListForecastsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ForecastClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Forecast | ForecastClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ForecastPaginationConfiguration, + ListForecastsCommandInput, + ListForecastsCommandOutput +>(ForecastClient, ListForecastsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-forecast/src/pagination/ListMonitorEvaluationsPaginator.ts b/clients/client-forecast/src/pagination/ListMonitorEvaluationsPaginator.ts index 9d590917434b..60e8737b23ee 100644 --- a/clients/client-forecast/src/pagination/ListMonitorEvaluationsPaginator.ts +++ b/clients/client-forecast/src/pagination/ListMonitorEvaluationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ForecastClient } from "../ForecastClient"; import { ForecastPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ForecastClient, - input: ListMonitorEvaluationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMonitorEvaluationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMonitorEvaluations( +export const paginateListMonitorEvaluations: ( config: ForecastPaginationConfiguration, input: ListMonitorEvaluationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMonitorEvaluationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ForecastClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Forecast | ForecastClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ForecastPaginationConfiguration, + ListMonitorEvaluationsCommandInput, + ListMonitorEvaluationsCommandOutput +>(ForecastClient, ListMonitorEvaluationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-forecast/src/pagination/ListMonitorsPaginator.ts b/clients/client-forecast/src/pagination/ListMonitorsPaginator.ts index d404809ddb8d..a8f1796db1a1 100644 --- a/clients/client-forecast/src/pagination/ListMonitorsPaginator.ts +++ b/clients/client-forecast/src/pagination/ListMonitorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ForecastClient } from "../ForecastClient"; import { ForecastPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ForecastClient, - input: ListMonitorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMonitorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMonitors( +export const paginateListMonitors: ( config: ForecastPaginationConfiguration, input: ListMonitorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMonitorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ForecastClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Forecast | ForecastClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ForecastPaginationConfiguration, + ListMonitorsCommandInput, + ListMonitorsCommandOutput +>(ForecastClient, ListMonitorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-forecast/src/pagination/ListPredictorBacktestExportJobsPaginator.ts b/clients/client-forecast/src/pagination/ListPredictorBacktestExportJobsPaginator.ts index b4b6f102f268..c4a0c0b6f292 100644 --- a/clients/client-forecast/src/pagination/ListPredictorBacktestExportJobsPaginator.ts +++ b/clients/client-forecast/src/pagination/ListPredictorBacktestExportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ForecastClient } from "../ForecastClient"; import { ForecastPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ForecastClient, - input: ListPredictorBacktestExportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPredictorBacktestExportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPredictorBacktestExportJobs( +export const paginateListPredictorBacktestExportJobs: ( config: ForecastPaginationConfiguration, input: ListPredictorBacktestExportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPredictorBacktestExportJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ForecastClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Forecast | ForecastClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ForecastPaginationConfiguration, + ListPredictorBacktestExportJobsCommandInput, + ListPredictorBacktestExportJobsCommandOutput +>(ForecastClient, ListPredictorBacktestExportJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-forecast/src/pagination/ListPredictorsPaginator.ts b/clients/client-forecast/src/pagination/ListPredictorsPaginator.ts index e300a417cbfd..1596415e15be 100644 --- a/clients/client-forecast/src/pagination/ListPredictorsPaginator.ts +++ b/clients/client-forecast/src/pagination/ListPredictorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ForecastClient } from "../ForecastClient"; import { ForecastPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ForecastClient, - input: ListPredictorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPredictorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPredictors( +export const paginateListPredictors: ( config: ForecastPaginationConfiguration, input: ListPredictorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPredictorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ForecastClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Forecast | ForecastClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ForecastPaginationConfiguration, + ListPredictorsCommandInput, + ListPredictorsCommandOutput +>(ForecastClient, ListPredictorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-forecast/src/pagination/ListWhatIfAnalysesPaginator.ts b/clients/client-forecast/src/pagination/ListWhatIfAnalysesPaginator.ts index bad6131eb197..c599b61a453c 100644 --- a/clients/client-forecast/src/pagination/ListWhatIfAnalysesPaginator.ts +++ b/clients/client-forecast/src/pagination/ListWhatIfAnalysesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ForecastClient } from "../ForecastClient"; import { ForecastPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ForecastClient, - input: ListWhatIfAnalysesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWhatIfAnalysesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWhatIfAnalyses( +export const paginateListWhatIfAnalyses: ( config: ForecastPaginationConfiguration, input: ListWhatIfAnalysesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWhatIfAnalysesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ForecastClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Forecast | ForecastClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ForecastPaginationConfiguration, + ListWhatIfAnalysesCommandInput, + ListWhatIfAnalysesCommandOutput +>(ForecastClient, ListWhatIfAnalysesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-forecast/src/pagination/ListWhatIfForecastExportsPaginator.ts b/clients/client-forecast/src/pagination/ListWhatIfForecastExportsPaginator.ts index f2419d9c4a40..5e03267f5a5f 100644 --- a/clients/client-forecast/src/pagination/ListWhatIfForecastExportsPaginator.ts +++ b/clients/client-forecast/src/pagination/ListWhatIfForecastExportsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ForecastClient } from "../ForecastClient"; import { ForecastPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ForecastClient, - input: ListWhatIfForecastExportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWhatIfForecastExportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWhatIfForecastExports( +export const paginateListWhatIfForecastExports: ( config: ForecastPaginationConfiguration, input: ListWhatIfForecastExportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWhatIfForecastExportsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ForecastClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Forecast | ForecastClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ForecastPaginationConfiguration, + ListWhatIfForecastExportsCommandInput, + ListWhatIfForecastExportsCommandOutput +>(ForecastClient, ListWhatIfForecastExportsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-forecast/src/pagination/ListWhatIfForecastsPaginator.ts b/clients/client-forecast/src/pagination/ListWhatIfForecastsPaginator.ts index 720c2946c380..9b12e035bf77 100644 --- a/clients/client-forecast/src/pagination/ListWhatIfForecastsPaginator.ts +++ b/clients/client-forecast/src/pagination/ListWhatIfForecastsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ForecastClient } from "../ForecastClient"; import { ForecastPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ForecastClient, - input: ListWhatIfForecastsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWhatIfForecastsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWhatIfForecasts( +export const paginateListWhatIfForecasts: ( config: ForecastPaginationConfiguration, input: ListWhatIfForecastsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWhatIfForecastsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ForecastClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Forecast | ForecastClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ForecastPaginationConfiguration, + ListWhatIfForecastsCommandInput, + ListWhatIfForecastsCommandOutput +>(ForecastClient, ListWhatIfForecastsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-frauddetector/package.json b/clients/client-frauddetector/package.json index ef2bcf16d8c2..928258117713 100644 --- a/clients/client-frauddetector/package.json +++ b/clients/client-frauddetector/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-frauddetector/src/pagination/DescribeModelVersionsPaginator.ts b/clients/client-frauddetector/src/pagination/DescribeModelVersionsPaginator.ts index 3b727da9ddf0..80572265e094 100644 --- a/clients/client-frauddetector/src/pagination/DescribeModelVersionsPaginator.ts +++ b/clients/client-frauddetector/src/pagination/DescribeModelVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: DescribeModelVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeModelVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeModelVersions( +export const paginateDescribeModelVersions: ( config: FraudDetectorPaginationConfiguration, input: DescribeModelVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeModelVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + DescribeModelVersionsCommandInput, + DescribeModelVersionsCommandOutput +>(FraudDetectorClient, DescribeModelVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/GetBatchImportJobsPaginator.ts b/clients/client-frauddetector/src/pagination/GetBatchImportJobsPaginator.ts index 84abfaf87fbc..a6c9f232c157 100644 --- a/clients/client-frauddetector/src/pagination/GetBatchImportJobsPaginator.ts +++ b/clients/client-frauddetector/src/pagination/GetBatchImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: GetBatchImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetBatchImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetBatchImportJobs( +export const paginateGetBatchImportJobs: ( config: FraudDetectorPaginationConfiguration, input: GetBatchImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetBatchImportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + GetBatchImportJobsCommandInput, + GetBatchImportJobsCommandOutput +>(FraudDetectorClient, GetBatchImportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/GetBatchPredictionJobsPaginator.ts b/clients/client-frauddetector/src/pagination/GetBatchPredictionJobsPaginator.ts index 2dd2d00cdc93..e7cedcbeb22b 100644 --- a/clients/client-frauddetector/src/pagination/GetBatchPredictionJobsPaginator.ts +++ b/clients/client-frauddetector/src/pagination/GetBatchPredictionJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: GetBatchPredictionJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetBatchPredictionJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetBatchPredictionJobs( +export const paginateGetBatchPredictionJobs: ( config: FraudDetectorPaginationConfiguration, input: GetBatchPredictionJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetBatchPredictionJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + GetBatchPredictionJobsCommandInput, + GetBatchPredictionJobsCommandOutput +>(FraudDetectorClient, GetBatchPredictionJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/GetDetectorsPaginator.ts b/clients/client-frauddetector/src/pagination/GetDetectorsPaginator.ts index a2ed7ec83c18..98616fcee904 100644 --- a/clients/client-frauddetector/src/pagination/GetDetectorsPaginator.ts +++ b/clients/client-frauddetector/src/pagination/GetDetectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: GetDetectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetDetectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetDetectors( +export const paginateGetDetectors: ( config: FraudDetectorPaginationConfiguration, input: GetDetectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetDetectorsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + GetDetectorsCommandInput, + GetDetectorsCommandOutput +>(FraudDetectorClient, GetDetectorsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/GetEntityTypesPaginator.ts b/clients/client-frauddetector/src/pagination/GetEntityTypesPaginator.ts index 7396ef3626c3..6830a64a4fdb 100644 --- a/clients/client-frauddetector/src/pagination/GetEntityTypesPaginator.ts +++ b/clients/client-frauddetector/src/pagination/GetEntityTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: GetEntityTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetEntityTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetEntityTypes( +export const paginateGetEntityTypes: ( config: FraudDetectorPaginationConfiguration, input: GetEntityTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetEntityTypesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + GetEntityTypesCommandInput, + GetEntityTypesCommandOutput +>(FraudDetectorClient, GetEntityTypesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/GetEventTypesPaginator.ts b/clients/client-frauddetector/src/pagination/GetEventTypesPaginator.ts index 6056eec47594..c795a46568ec 100644 --- a/clients/client-frauddetector/src/pagination/GetEventTypesPaginator.ts +++ b/clients/client-frauddetector/src/pagination/GetEventTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: GetEventTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetEventTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetEventTypes( +export const paginateGetEventTypes: ( config: FraudDetectorPaginationConfiguration, input: GetEventTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetEventTypesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + GetEventTypesCommandInput, + GetEventTypesCommandOutput +>(FraudDetectorClient, GetEventTypesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/GetExternalModelsPaginator.ts b/clients/client-frauddetector/src/pagination/GetExternalModelsPaginator.ts index fcd893d00ecf..9a927025fe6c 100644 --- a/clients/client-frauddetector/src/pagination/GetExternalModelsPaginator.ts +++ b/clients/client-frauddetector/src/pagination/GetExternalModelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: GetExternalModelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetExternalModelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetExternalModels( +export const paginateGetExternalModels: ( config: FraudDetectorPaginationConfiguration, input: GetExternalModelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetExternalModelsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + GetExternalModelsCommandInput, + GetExternalModelsCommandOutput +>(FraudDetectorClient, GetExternalModelsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/GetLabelsPaginator.ts b/clients/client-frauddetector/src/pagination/GetLabelsPaginator.ts index b0ba69c1de30..59a7b8149d51 100644 --- a/clients/client-frauddetector/src/pagination/GetLabelsPaginator.ts +++ b/clients/client-frauddetector/src/pagination/GetLabelsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetLabelsCommand, GetLabelsCommandInput, GetLabelsCommandOutput } from "../commands/GetLabelsCommand"; import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: GetLabelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetLabelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetLabels( +export const paginateGetLabels: ( config: FraudDetectorPaginationConfiguration, input: GetLabelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetLabelsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + GetLabelsCommandInput, + GetLabelsCommandOutput +>(FraudDetectorClient, GetLabelsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/GetListElementsPaginator.ts b/clients/client-frauddetector/src/pagination/GetListElementsPaginator.ts index 5c469ea4ef4d..1f8619d4e75a 100644 --- a/clients/client-frauddetector/src/pagination/GetListElementsPaginator.ts +++ b/clients/client-frauddetector/src/pagination/GetListElementsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: GetListElementsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetListElementsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetListElements( +export const paginateGetListElements: ( config: FraudDetectorPaginationConfiguration, input: GetListElementsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetListElementsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + GetListElementsCommandInput, + GetListElementsCommandOutput +>(FraudDetectorClient, GetListElementsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/GetListsMetadataPaginator.ts b/clients/client-frauddetector/src/pagination/GetListsMetadataPaginator.ts index 8114226337b4..ea93c9518581 100644 --- a/clients/client-frauddetector/src/pagination/GetListsMetadataPaginator.ts +++ b/clients/client-frauddetector/src/pagination/GetListsMetadataPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: GetListsMetadataCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetListsMetadataCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetListsMetadata( +export const paginateGetListsMetadata: ( config: FraudDetectorPaginationConfiguration, input: GetListsMetadataCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetListsMetadataCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + GetListsMetadataCommandInput, + GetListsMetadataCommandOutput +>(FraudDetectorClient, GetListsMetadataCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/GetModelsPaginator.ts b/clients/client-frauddetector/src/pagination/GetModelsPaginator.ts index 790a79e0e19e..cc4a54c365bb 100644 --- a/clients/client-frauddetector/src/pagination/GetModelsPaginator.ts +++ b/clients/client-frauddetector/src/pagination/GetModelsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetModelsCommand, GetModelsCommandInput, GetModelsCommandOutput } from "../commands/GetModelsCommand"; import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: GetModelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetModelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetModels( +export const paginateGetModels: ( config: FraudDetectorPaginationConfiguration, input: GetModelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetModelsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + GetModelsCommandInput, + GetModelsCommandOutput +>(FraudDetectorClient, GetModelsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/GetOutcomesPaginator.ts b/clients/client-frauddetector/src/pagination/GetOutcomesPaginator.ts index aa75fe205816..89cd2737ccac 100644 --- a/clients/client-frauddetector/src/pagination/GetOutcomesPaginator.ts +++ b/clients/client-frauddetector/src/pagination/GetOutcomesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetOutcomesCommand, GetOutcomesCommandInput, GetOutcomesCommandOutput } from "../commands/GetOutcomesCommand"; import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: GetOutcomesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetOutcomesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetOutcomes( +export const paginateGetOutcomes: ( config: FraudDetectorPaginationConfiguration, input: GetOutcomesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetOutcomesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + GetOutcomesCommandInput, + GetOutcomesCommandOutput +>(FraudDetectorClient, GetOutcomesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/GetRulesPaginator.ts b/clients/client-frauddetector/src/pagination/GetRulesPaginator.ts index e8dc2c67a078..e7042d3da680 100644 --- a/clients/client-frauddetector/src/pagination/GetRulesPaginator.ts +++ b/clients/client-frauddetector/src/pagination/GetRulesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetRulesCommand, GetRulesCommandInput, GetRulesCommandOutput } from "../commands/GetRulesCommand"; import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: GetRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetRules( +export const paginateGetRules: ( config: FraudDetectorPaginationConfiguration, input: GetRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetRulesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + GetRulesCommandInput, + GetRulesCommandOutput +>(FraudDetectorClient, GetRulesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/GetVariablesPaginator.ts b/clients/client-frauddetector/src/pagination/GetVariablesPaginator.ts index dab1520f7927..623bb152d1cd 100644 --- a/clients/client-frauddetector/src/pagination/GetVariablesPaginator.ts +++ b/clients/client-frauddetector/src/pagination/GetVariablesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: GetVariablesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetVariablesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetVariables( +export const paginateGetVariables: ( config: FraudDetectorPaginationConfiguration, input: GetVariablesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetVariablesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + GetVariablesCommandInput, + GetVariablesCommandOutput +>(FraudDetectorClient, GetVariablesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/ListEventPredictionsPaginator.ts b/clients/client-frauddetector/src/pagination/ListEventPredictionsPaginator.ts index 8b72f072bca7..9a418e867b3a 100644 --- a/clients/client-frauddetector/src/pagination/ListEventPredictionsPaginator.ts +++ b/clients/client-frauddetector/src/pagination/ListEventPredictionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: ListEventPredictionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEventPredictionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEventPredictions( +export const paginateListEventPredictions: ( config: FraudDetectorPaginationConfiguration, input: ListEventPredictionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEventPredictionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + ListEventPredictionsCommandInput, + ListEventPredictionsCommandOutput +>(FraudDetectorClient, ListEventPredictionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-frauddetector/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-frauddetector/src/pagination/ListTagsForResourcePaginator.ts index 46509a29f73f..e1a1653adffb 100644 --- a/clients/client-frauddetector/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-frauddetector/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FraudDetectorClient } from "../FraudDetectorClient"; import { FraudDetectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FraudDetectorClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: FraudDetectorPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FraudDetectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FraudDetector | FraudDetectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FraudDetectorPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(FraudDetectorClient, ListTagsForResourceCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-freetier/package.json b/clients/client-freetier/package.json index 7d433499eb8c..b88db05cd58b 100644 --- a/clients/client-freetier/package.json +++ b/clients/client-freetier/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-freetier/src/pagination/GetFreeTierUsagePaginator.ts b/clients/client-freetier/src/pagination/GetFreeTierUsagePaginator.ts index 5104e364e50d..912233efae3e 100644 --- a/clients/client-freetier/src/pagination/GetFreeTierUsagePaginator.ts +++ b/clients/client-freetier/src/pagination/GetFreeTierUsagePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FreeTierClient } from "../FreeTierClient"; import { FreeTierPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FreeTierClient, - input: GetFreeTierUsageCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetFreeTierUsageCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetFreeTierUsage( +export const paginateGetFreeTierUsage: ( config: FreeTierPaginationConfiguration, input: GetFreeTierUsageCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetFreeTierUsageCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof FreeTierClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FreeTier | FreeTierClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FreeTierPaginationConfiguration, + GetFreeTierUsageCommandInput, + GetFreeTierUsageCommandOutput +>(FreeTierClient, GetFreeTierUsageCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-fsx/package.json b/clients/client-fsx/package.json index a29cbd97f509..f4cccfd0b0bf 100644 --- a/clients/client-fsx/package.json +++ b/clients/client-fsx/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-fsx/src/pagination/DescribeBackupsPaginator.ts b/clients/client-fsx/src/pagination/DescribeBackupsPaginator.ts index 49dfdd44b143..94429c7e32d6 100644 --- a/clients/client-fsx/src/pagination/DescribeBackupsPaginator.ts +++ b/clients/client-fsx/src/pagination/DescribeBackupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FSxClient } from "../FSxClient"; import { FSxPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FSxClient, - input: DescribeBackupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeBackupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeBackups( +export const paginateDescribeBackups: ( config: FSxPaginationConfiguration, input: DescribeBackupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeBackupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FSxClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FSx | FSxClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FSxPaginationConfiguration, + DescribeBackupsCommandInput, + DescribeBackupsCommandOutput +>(FSxClient, DescribeBackupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fsx/src/pagination/DescribeDataRepositoryAssociationsPaginator.ts b/clients/client-fsx/src/pagination/DescribeDataRepositoryAssociationsPaginator.ts index 19a5ae2a8280..20419275002f 100644 --- a/clients/client-fsx/src/pagination/DescribeDataRepositoryAssociationsPaginator.ts +++ b/clients/client-fsx/src/pagination/DescribeDataRepositoryAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FSxClient } from "../FSxClient"; import { FSxPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FSxClient, - input: DescribeDataRepositoryAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDataRepositoryAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDataRepositoryAssociations( +export const paginateDescribeDataRepositoryAssociations: ( config: FSxPaginationConfiguration, input: DescribeDataRepositoryAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDataRepositoryAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FSxClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FSx | FSxClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FSxPaginationConfiguration, + DescribeDataRepositoryAssociationsCommandInput, + DescribeDataRepositoryAssociationsCommandOutput +>(FSxClient, DescribeDataRepositoryAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fsx/src/pagination/DescribeDataRepositoryTasksPaginator.ts b/clients/client-fsx/src/pagination/DescribeDataRepositoryTasksPaginator.ts index 521a6763c93f..1aa96e7f697c 100644 --- a/clients/client-fsx/src/pagination/DescribeDataRepositoryTasksPaginator.ts +++ b/clients/client-fsx/src/pagination/DescribeDataRepositoryTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FSxClient } from "../FSxClient"; import { FSxPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FSxClient, - input: DescribeDataRepositoryTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDataRepositoryTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDataRepositoryTasks( +export const paginateDescribeDataRepositoryTasks: ( config: FSxPaginationConfiguration, input: DescribeDataRepositoryTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDataRepositoryTasksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FSxClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FSx | FSxClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FSxPaginationConfiguration, + DescribeDataRepositoryTasksCommandInput, + DescribeDataRepositoryTasksCommandOutput +>(FSxClient, DescribeDataRepositoryTasksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fsx/src/pagination/DescribeFileCachesPaginator.ts b/clients/client-fsx/src/pagination/DescribeFileCachesPaginator.ts index 9b4db8ddb454..bc53c11a4fb1 100644 --- a/clients/client-fsx/src/pagination/DescribeFileCachesPaginator.ts +++ b/clients/client-fsx/src/pagination/DescribeFileCachesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FSxClient } from "../FSxClient"; import { FSxPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FSxClient, - input: DescribeFileCachesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFileCachesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFileCaches( +export const paginateDescribeFileCaches: ( config: FSxPaginationConfiguration, input: DescribeFileCachesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFileCachesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FSxClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FSx | FSxClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FSxPaginationConfiguration, + DescribeFileCachesCommandInput, + DescribeFileCachesCommandOutput +>(FSxClient, DescribeFileCachesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fsx/src/pagination/DescribeFileSystemAliasesPaginator.ts b/clients/client-fsx/src/pagination/DescribeFileSystemAliasesPaginator.ts index 9e49ffc04921..7dbcb551d0e2 100644 --- a/clients/client-fsx/src/pagination/DescribeFileSystemAliasesPaginator.ts +++ b/clients/client-fsx/src/pagination/DescribeFileSystemAliasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FSxClient } from "../FSxClient"; import { FSxPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FSxClient, - input: DescribeFileSystemAliasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFileSystemAliasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFileSystemAliases( +export const paginateDescribeFileSystemAliases: ( config: FSxPaginationConfiguration, input: DescribeFileSystemAliasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFileSystemAliasesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FSxClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FSx | FSxClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FSxPaginationConfiguration, + DescribeFileSystemAliasesCommandInput, + DescribeFileSystemAliasesCommandOutput +>(FSxClient, DescribeFileSystemAliasesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fsx/src/pagination/DescribeFileSystemsPaginator.ts b/clients/client-fsx/src/pagination/DescribeFileSystemsPaginator.ts index 079db6e5a061..9c62209c3dda 100644 --- a/clients/client-fsx/src/pagination/DescribeFileSystemsPaginator.ts +++ b/clients/client-fsx/src/pagination/DescribeFileSystemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FSxClient } from "../FSxClient"; import { FSxPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FSxClient, - input: DescribeFileSystemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFileSystemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFileSystems( +export const paginateDescribeFileSystems: ( config: FSxPaginationConfiguration, input: DescribeFileSystemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFileSystemsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FSxClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FSx | FSxClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FSxPaginationConfiguration, + DescribeFileSystemsCommandInput, + DescribeFileSystemsCommandOutput +>(FSxClient, DescribeFileSystemsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fsx/src/pagination/DescribeSnapshotsPaginator.ts b/clients/client-fsx/src/pagination/DescribeSnapshotsPaginator.ts index 3bbd05f8c3cc..b9b4f8e4f499 100644 --- a/clients/client-fsx/src/pagination/DescribeSnapshotsPaginator.ts +++ b/clients/client-fsx/src/pagination/DescribeSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FSxClient } from "../FSxClient"; import { FSxPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FSxClient, - input: DescribeSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSnapshots( +export const paginateDescribeSnapshots: ( config: FSxPaginationConfiguration, input: DescribeSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSnapshotsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FSxClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FSx | FSxClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FSxPaginationConfiguration, + DescribeSnapshotsCommandInput, + DescribeSnapshotsCommandOutput +>(FSxClient, DescribeSnapshotsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fsx/src/pagination/DescribeStorageVirtualMachinesPaginator.ts b/clients/client-fsx/src/pagination/DescribeStorageVirtualMachinesPaginator.ts index a65785e3d049..596ef23bb007 100644 --- a/clients/client-fsx/src/pagination/DescribeStorageVirtualMachinesPaginator.ts +++ b/clients/client-fsx/src/pagination/DescribeStorageVirtualMachinesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FSxClient } from "../FSxClient"; import { FSxPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FSxClient, - input: DescribeStorageVirtualMachinesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeStorageVirtualMachinesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeStorageVirtualMachines( +export const paginateDescribeStorageVirtualMachines: ( config: FSxPaginationConfiguration, input: DescribeStorageVirtualMachinesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeStorageVirtualMachinesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FSxClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FSx | FSxClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FSxPaginationConfiguration, + DescribeStorageVirtualMachinesCommandInput, + DescribeStorageVirtualMachinesCommandOutput +>(FSxClient, DescribeStorageVirtualMachinesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fsx/src/pagination/DescribeVolumesPaginator.ts b/clients/client-fsx/src/pagination/DescribeVolumesPaginator.ts index 1e8fde9d751b..d4c28a6502ed 100644 --- a/clients/client-fsx/src/pagination/DescribeVolumesPaginator.ts +++ b/clients/client-fsx/src/pagination/DescribeVolumesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FSxClient } from "../FSxClient"; import { FSxPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FSxClient, - input: DescribeVolumesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVolumesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVolumes( +export const paginateDescribeVolumes: ( config: FSxPaginationConfiguration, input: DescribeVolumesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVolumesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FSxClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FSx | FSxClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FSxPaginationConfiguration, + DescribeVolumesCommandInput, + DescribeVolumesCommandOutput +>(FSxClient, DescribeVolumesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-fsx/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-fsx/src/pagination/ListTagsForResourcePaginator.ts index 6b0f4c044441..3a65a6c2cb2c 100644 --- a/clients/client-fsx/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-fsx/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { FSxClient } from "../FSxClient"; import { FSxPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: FSxClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: FSxPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof FSxClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected FSx | FSxClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + FSxPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(FSxClient, ListTagsForResourceCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-gamelift/package.json b/clients/client-gamelift/package.json index 77830a4d37c8..4f3848c293cd 100644 --- a/clients/client-gamelift/package.json +++ b/clients/client-gamelift/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-gamelift/src/pagination/DescribeFleetAttributesPaginator.ts b/clients/client-gamelift/src/pagination/DescribeFleetAttributesPaginator.ts index 13ec12e458ea..02bfcdb6c760 100644 --- a/clients/client-gamelift/src/pagination/DescribeFleetAttributesPaginator.ts +++ b/clients/client-gamelift/src/pagination/DescribeFleetAttributesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: DescribeFleetAttributesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFleetAttributesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFleetAttributes( +export const paginateDescribeFleetAttributes: ( config: GameLiftPaginationConfiguration, input: DescribeFleetAttributesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFleetAttributesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + DescribeFleetAttributesCommandInput, + DescribeFleetAttributesCommandOutput +>(GameLiftClient, DescribeFleetAttributesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/DescribeFleetCapacityPaginator.ts b/clients/client-gamelift/src/pagination/DescribeFleetCapacityPaginator.ts index 7c14329e59d7..0dbbac7fe209 100644 --- a/clients/client-gamelift/src/pagination/DescribeFleetCapacityPaginator.ts +++ b/clients/client-gamelift/src/pagination/DescribeFleetCapacityPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: DescribeFleetCapacityCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFleetCapacityCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFleetCapacity( +export const paginateDescribeFleetCapacity: ( config: GameLiftPaginationConfiguration, input: DescribeFleetCapacityCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFleetCapacityCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + DescribeFleetCapacityCommandInput, + DescribeFleetCapacityCommandOutput +>(GameLiftClient, DescribeFleetCapacityCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/DescribeFleetEventsPaginator.ts b/clients/client-gamelift/src/pagination/DescribeFleetEventsPaginator.ts index 7855dccec749..234c4bd0b3ad 100644 --- a/clients/client-gamelift/src/pagination/DescribeFleetEventsPaginator.ts +++ b/clients/client-gamelift/src/pagination/DescribeFleetEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: DescribeFleetEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFleetEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFleetEvents( +export const paginateDescribeFleetEvents: ( config: GameLiftPaginationConfiguration, input: DescribeFleetEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFleetEventsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + DescribeFleetEventsCommandInput, + DescribeFleetEventsCommandOutput +>(GameLiftClient, DescribeFleetEventsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/DescribeFleetLocationAttributesPaginator.ts b/clients/client-gamelift/src/pagination/DescribeFleetLocationAttributesPaginator.ts index ec09d34e5b55..54410b53944f 100644 --- a/clients/client-gamelift/src/pagination/DescribeFleetLocationAttributesPaginator.ts +++ b/clients/client-gamelift/src/pagination/DescribeFleetLocationAttributesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: DescribeFleetLocationAttributesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFleetLocationAttributesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFleetLocationAttributes( +export const paginateDescribeFleetLocationAttributes: ( config: GameLiftPaginationConfiguration, input: DescribeFleetLocationAttributesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFleetLocationAttributesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + DescribeFleetLocationAttributesCommandInput, + DescribeFleetLocationAttributesCommandOutput +>(GameLiftClient, DescribeFleetLocationAttributesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/DescribeFleetUtilizationPaginator.ts b/clients/client-gamelift/src/pagination/DescribeFleetUtilizationPaginator.ts index 6a11ee707331..ec404c442c1b 100644 --- a/clients/client-gamelift/src/pagination/DescribeFleetUtilizationPaginator.ts +++ b/clients/client-gamelift/src/pagination/DescribeFleetUtilizationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: DescribeFleetUtilizationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFleetUtilizationCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFleetUtilization( +export const paginateDescribeFleetUtilization: ( config: GameLiftPaginationConfiguration, input: DescribeFleetUtilizationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFleetUtilizationCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + DescribeFleetUtilizationCommandInput, + DescribeFleetUtilizationCommandOutput +>(GameLiftClient, DescribeFleetUtilizationCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/DescribeGameServerInstancesPaginator.ts b/clients/client-gamelift/src/pagination/DescribeGameServerInstancesPaginator.ts index cf03fd3be777..da06653ce4e7 100644 --- a/clients/client-gamelift/src/pagination/DescribeGameServerInstancesPaginator.ts +++ b/clients/client-gamelift/src/pagination/DescribeGameServerInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: DescribeGameServerInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeGameServerInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeGameServerInstances( +export const paginateDescribeGameServerInstances: ( config: GameLiftPaginationConfiguration, input: DescribeGameServerInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeGameServerInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + DescribeGameServerInstancesCommandInput, + DescribeGameServerInstancesCommandOutput +>(GameLiftClient, DescribeGameServerInstancesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/DescribeGameSessionDetailsPaginator.ts b/clients/client-gamelift/src/pagination/DescribeGameSessionDetailsPaginator.ts index 027e9e0165ef..79084ded2f44 100644 --- a/clients/client-gamelift/src/pagination/DescribeGameSessionDetailsPaginator.ts +++ b/clients/client-gamelift/src/pagination/DescribeGameSessionDetailsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: DescribeGameSessionDetailsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeGameSessionDetailsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeGameSessionDetails( +export const paginateDescribeGameSessionDetails: ( config: GameLiftPaginationConfiguration, input: DescribeGameSessionDetailsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeGameSessionDetailsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + DescribeGameSessionDetailsCommandInput, + DescribeGameSessionDetailsCommandOutput +>(GameLiftClient, DescribeGameSessionDetailsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/DescribeGameSessionQueuesPaginator.ts b/clients/client-gamelift/src/pagination/DescribeGameSessionQueuesPaginator.ts index 55581cff35d8..97441781759b 100644 --- a/clients/client-gamelift/src/pagination/DescribeGameSessionQueuesPaginator.ts +++ b/clients/client-gamelift/src/pagination/DescribeGameSessionQueuesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: DescribeGameSessionQueuesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeGameSessionQueuesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeGameSessionQueues( +export const paginateDescribeGameSessionQueues: ( config: GameLiftPaginationConfiguration, input: DescribeGameSessionQueuesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeGameSessionQueuesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + DescribeGameSessionQueuesCommandInput, + DescribeGameSessionQueuesCommandOutput +>(GameLiftClient, DescribeGameSessionQueuesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/DescribeGameSessionsPaginator.ts b/clients/client-gamelift/src/pagination/DescribeGameSessionsPaginator.ts index d87fca71b8aa..851e6c7e5a4b 100644 --- a/clients/client-gamelift/src/pagination/DescribeGameSessionsPaginator.ts +++ b/clients/client-gamelift/src/pagination/DescribeGameSessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: DescribeGameSessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeGameSessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeGameSessions( +export const paginateDescribeGameSessions: ( config: GameLiftPaginationConfiguration, input: DescribeGameSessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeGameSessionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + DescribeGameSessionsCommandInput, + DescribeGameSessionsCommandOutput +>(GameLiftClient, DescribeGameSessionsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/DescribeInstancesPaginator.ts b/clients/client-gamelift/src/pagination/DescribeInstancesPaginator.ts index cbd427047017..5fcdad8316c0 100644 --- a/clients/client-gamelift/src/pagination/DescribeInstancesPaginator.ts +++ b/clients/client-gamelift/src/pagination/DescribeInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: DescribeInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstances( +export const paginateDescribeInstances: ( config: GameLiftPaginationConfiguration, input: DescribeInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + DescribeInstancesCommandInput, + DescribeInstancesCommandOutput +>(GameLiftClient, DescribeInstancesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/DescribeMatchmakingConfigurationsPaginator.ts b/clients/client-gamelift/src/pagination/DescribeMatchmakingConfigurationsPaginator.ts index 361898b70946..9a58355d3cb9 100644 --- a/clients/client-gamelift/src/pagination/DescribeMatchmakingConfigurationsPaginator.ts +++ b/clients/client-gamelift/src/pagination/DescribeMatchmakingConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: DescribeMatchmakingConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMatchmakingConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMatchmakingConfigurations( +export const paginateDescribeMatchmakingConfigurations: ( config: GameLiftPaginationConfiguration, input: DescribeMatchmakingConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMatchmakingConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + DescribeMatchmakingConfigurationsCommandInput, + DescribeMatchmakingConfigurationsCommandOutput +>(GameLiftClient, DescribeMatchmakingConfigurationsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/DescribeMatchmakingRuleSetsPaginator.ts b/clients/client-gamelift/src/pagination/DescribeMatchmakingRuleSetsPaginator.ts index ca6d99b81448..10fabd033367 100644 --- a/clients/client-gamelift/src/pagination/DescribeMatchmakingRuleSetsPaginator.ts +++ b/clients/client-gamelift/src/pagination/DescribeMatchmakingRuleSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: DescribeMatchmakingRuleSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMatchmakingRuleSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMatchmakingRuleSets( +export const paginateDescribeMatchmakingRuleSets: ( config: GameLiftPaginationConfiguration, input: DescribeMatchmakingRuleSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMatchmakingRuleSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + DescribeMatchmakingRuleSetsCommandInput, + DescribeMatchmakingRuleSetsCommandOutput +>(GameLiftClient, DescribeMatchmakingRuleSetsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/DescribePlayerSessionsPaginator.ts b/clients/client-gamelift/src/pagination/DescribePlayerSessionsPaginator.ts index 3e30a96bf67f..9ff20f3b0e23 100644 --- a/clients/client-gamelift/src/pagination/DescribePlayerSessionsPaginator.ts +++ b/clients/client-gamelift/src/pagination/DescribePlayerSessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: DescribePlayerSessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePlayerSessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePlayerSessions( +export const paginateDescribePlayerSessions: ( config: GameLiftPaginationConfiguration, input: DescribePlayerSessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePlayerSessionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + DescribePlayerSessionsCommandInput, + DescribePlayerSessionsCommandOutput +>(GameLiftClient, DescribePlayerSessionsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/DescribeScalingPoliciesPaginator.ts b/clients/client-gamelift/src/pagination/DescribeScalingPoliciesPaginator.ts index 5b06a0d3db4c..b3a453ca0257 100644 --- a/clients/client-gamelift/src/pagination/DescribeScalingPoliciesPaginator.ts +++ b/clients/client-gamelift/src/pagination/DescribeScalingPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: DescribeScalingPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeScalingPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeScalingPolicies( +export const paginateDescribeScalingPolicies: ( config: GameLiftPaginationConfiguration, input: DescribeScalingPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeScalingPoliciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + DescribeScalingPoliciesCommandInput, + DescribeScalingPoliciesCommandOutput +>(GameLiftClient, DescribeScalingPoliciesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/ListAliasesPaginator.ts b/clients/client-gamelift/src/pagination/ListAliasesPaginator.ts index f628c9008c83..03af6e94f7ad 100644 --- a/clients/client-gamelift/src/pagination/ListAliasesPaginator.ts +++ b/clients/client-gamelift/src/pagination/ListAliasesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAliasesCommand, ListAliasesCommandInput, ListAliasesCommandOutput } from "../commands/ListAliasesCommand"; import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: ListAliasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAliasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAliases( +export const paginateListAliases: ( config: GameLiftPaginationConfiguration, input: ListAliasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAliasesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + ListAliasesCommandInput, + ListAliasesCommandOutput +>(GameLiftClient, ListAliasesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/ListBuildsPaginator.ts b/clients/client-gamelift/src/pagination/ListBuildsPaginator.ts index 9beba5005d6c..2039443266ae 100644 --- a/clients/client-gamelift/src/pagination/ListBuildsPaginator.ts +++ b/clients/client-gamelift/src/pagination/ListBuildsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListBuildsCommand, ListBuildsCommandInput, ListBuildsCommandOutput } from "../commands/ListBuildsCommand"; import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: ListBuildsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBuildsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBuilds( +export const paginateListBuilds: ( config: GameLiftPaginationConfiguration, input: ListBuildsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBuildsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + ListBuildsCommandInput, + ListBuildsCommandOutput +>(GameLiftClient, ListBuildsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/ListComputePaginator.ts b/clients/client-gamelift/src/pagination/ListComputePaginator.ts index b33266cf6bef..ed1973d00706 100644 --- a/clients/client-gamelift/src/pagination/ListComputePaginator.ts +++ b/clients/client-gamelift/src/pagination/ListComputePaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListComputeCommand, ListComputeCommandInput, ListComputeCommandOutput } from "../commands/ListComputeCommand"; import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: ListComputeCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComputeCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCompute( +export const paginateListCompute: ( config: GameLiftPaginationConfiguration, input: ListComputeCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComputeCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + ListComputeCommandInput, + ListComputeCommandOutput +>(GameLiftClient, ListComputeCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/ListFleetsPaginator.ts b/clients/client-gamelift/src/pagination/ListFleetsPaginator.ts index 65199959cb45..62cc93e544fb 100644 --- a/clients/client-gamelift/src/pagination/ListFleetsPaginator.ts +++ b/clients/client-gamelift/src/pagination/ListFleetsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListFleetsCommand, ListFleetsCommandInput, ListFleetsCommandOutput } from "../commands/ListFleetsCommand"; import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: ListFleetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFleetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFleets( +export const paginateListFleets: ( config: GameLiftPaginationConfiguration, input: ListFleetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFleetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + ListFleetsCommandInput, + ListFleetsCommandOutput +>(GameLiftClient, ListFleetsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/ListGameServerGroupsPaginator.ts b/clients/client-gamelift/src/pagination/ListGameServerGroupsPaginator.ts index 93791eb64176..dc61883d8b32 100644 --- a/clients/client-gamelift/src/pagination/ListGameServerGroupsPaginator.ts +++ b/clients/client-gamelift/src/pagination/ListGameServerGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: ListGameServerGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGameServerGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGameServerGroups( +export const paginateListGameServerGroups: ( config: GameLiftPaginationConfiguration, input: ListGameServerGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGameServerGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + ListGameServerGroupsCommandInput, + ListGameServerGroupsCommandOutput +>(GameLiftClient, ListGameServerGroupsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/ListGameServersPaginator.ts b/clients/client-gamelift/src/pagination/ListGameServersPaginator.ts index 87548f1897d3..ea0c3d832930 100644 --- a/clients/client-gamelift/src/pagination/ListGameServersPaginator.ts +++ b/clients/client-gamelift/src/pagination/ListGameServersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: ListGameServersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGameServersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGameServers( +export const paginateListGameServers: ( config: GameLiftPaginationConfiguration, input: ListGameServersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGameServersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + ListGameServersCommandInput, + ListGameServersCommandOutput +>(GameLiftClient, ListGameServersCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/ListLocationsPaginator.ts b/clients/client-gamelift/src/pagination/ListLocationsPaginator.ts index f7d0e002a18c..3b4d791dcce1 100644 --- a/clients/client-gamelift/src/pagination/ListLocationsPaginator.ts +++ b/clients/client-gamelift/src/pagination/ListLocationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: ListLocationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLocationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLocations( +export const paginateListLocations: ( config: GameLiftPaginationConfiguration, input: ListLocationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLocationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + ListLocationsCommandInput, + ListLocationsCommandOutput +>(GameLiftClient, ListLocationsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/ListScriptsPaginator.ts b/clients/client-gamelift/src/pagination/ListScriptsPaginator.ts index 05a289c09aaa..2fb9b9a9ffb6 100644 --- a/clients/client-gamelift/src/pagination/ListScriptsPaginator.ts +++ b/clients/client-gamelift/src/pagination/ListScriptsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListScriptsCommand, ListScriptsCommandInput, ListScriptsCommandOutput } from "../commands/ListScriptsCommand"; import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: ListScriptsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListScriptsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListScripts( +export const paginateListScripts: ( config: GameLiftPaginationConfiguration, input: ListScriptsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListScriptsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + ListScriptsCommandInput, + ListScriptsCommandOutput +>(GameLiftClient, ListScriptsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-gamelift/src/pagination/SearchGameSessionsPaginator.ts b/clients/client-gamelift/src/pagination/SearchGameSessionsPaginator.ts index 9ce39a81c45e..4a01966acfa2 100644 --- a/clients/client-gamelift/src/pagination/SearchGameSessionsPaginator.ts +++ b/clients/client-gamelift/src/pagination/SearchGameSessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GameLiftClient } from "../GameLiftClient"; import { GameLiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GameLiftClient, - input: SearchGameSessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchGameSessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchGameSessions( +export const paginateSearchGameSessions: ( config: GameLiftPaginationConfiguration, input: SearchGameSessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchGameSessionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof GameLiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GameLift | GameLiftClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GameLiftPaginationConfiguration, + SearchGameSessionsCommandInput, + SearchGameSessionsCommandOutput +>(GameLiftClient, SearchGameSessionsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-glacier/src/pagination/ListJobsPaginator.ts b/clients/client-glacier/src/pagination/ListJobsPaginator.ts index 6919c00f21f0..483583cd1c9c 100644 --- a/clients/client-glacier/src/pagination/ListJobsPaginator.ts +++ b/clients/client-glacier/src/pagination/ListJobsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListJobsCommand, ListJobsCommandInput, ListJobsCommandOutput } from "../commands/ListJobsCommand"; import { GlacierClient } from "../GlacierClient"; import { GlacierPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlacierClient, - input: ListJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobs( +export const paginateListJobs: ( config: GlacierPaginationConfiguration, input: ListJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobsCommandOutput; - while (hasNext) { - input.marker = token; - input["limit"] = config.pageSize; - if (config.client instanceof GlacierClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glacier | GlacierClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlacierPaginationConfiguration, + ListJobsCommandInput, + ListJobsCommandOutput +>(GlacierClient, ListJobsCommand, "marker", "Marker", "limit"); diff --git a/clients/client-glacier/src/pagination/ListMultipartUploadsPaginator.ts b/clients/client-glacier/src/pagination/ListMultipartUploadsPaginator.ts index f2680d6a4ee1..071287f871e4 100644 --- a/clients/client-glacier/src/pagination/ListMultipartUploadsPaginator.ts +++ b/clients/client-glacier/src/pagination/ListMultipartUploadsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlacierClient } from "../GlacierClient"; import { GlacierPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlacierClient, - input: ListMultipartUploadsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMultipartUploadsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMultipartUploads( +export const paginateListMultipartUploads: ( config: GlacierPaginationConfiguration, input: ListMultipartUploadsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMultipartUploadsCommandOutput; - while (hasNext) { - input.marker = token; - input["limit"] = config.pageSize; - if (config.client instanceof GlacierClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glacier | GlacierClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlacierPaginationConfiguration, + ListMultipartUploadsCommandInput, + ListMultipartUploadsCommandOutput +>(GlacierClient, ListMultipartUploadsCommand, "marker", "Marker", "limit"); diff --git a/clients/client-glacier/src/pagination/ListPartsPaginator.ts b/clients/client-glacier/src/pagination/ListPartsPaginator.ts index ae37fb1ad511..1370dfa8c55a 100644 --- a/clients/client-glacier/src/pagination/ListPartsPaginator.ts +++ b/clients/client-glacier/src/pagination/ListPartsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListPartsCommand, ListPartsCommandInput, ListPartsCommandOutput } from "../commands/ListPartsCommand"; import { GlacierClient } from "../GlacierClient"; import { GlacierPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlacierClient, - input: ListPartsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPartsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListParts( +export const paginateListParts: ( config: GlacierPaginationConfiguration, input: ListPartsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPartsCommandOutput; - while (hasNext) { - input.marker = token; - input["limit"] = config.pageSize; - if (config.client instanceof GlacierClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glacier | GlacierClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlacierPaginationConfiguration, + ListPartsCommandInput, + ListPartsCommandOutput +>(GlacierClient, ListPartsCommand, "marker", "Marker", "limit"); diff --git a/clients/client-glacier/src/pagination/ListVaultsPaginator.ts b/clients/client-glacier/src/pagination/ListVaultsPaginator.ts index a4a3c8ad693f..e6c6885305ed 100644 --- a/clients/client-glacier/src/pagination/ListVaultsPaginator.ts +++ b/clients/client-glacier/src/pagination/ListVaultsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListVaultsCommand, ListVaultsCommandInput, ListVaultsCommandOutput } from "../commands/ListVaultsCommand"; import { GlacierClient } from "../GlacierClient"; import { GlacierPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlacierClient, - input: ListVaultsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVaultsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVaults( +export const paginateListVaults: ( config: GlacierPaginationConfiguration, input: ListVaultsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVaultsCommandOutput; - while (hasNext) { - input.marker = token; - input["limit"] = config.pageSize; - if (config.client instanceof GlacierClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glacier | GlacierClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlacierPaginationConfiguration, + ListVaultsCommandInput, + ListVaultsCommandOutput +>(GlacierClient, ListVaultsCommand, "marker", "Marker", "limit"); diff --git a/clients/client-global-accelerator/package.json b/clients/client-global-accelerator/package.json index 28a549edac11..53204a1da81e 100644 --- a/clients/client-global-accelerator/package.json +++ b/clients/client-global-accelerator/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-global-accelerator/src/pagination/ListAcceleratorsPaginator.ts b/clients/client-global-accelerator/src/pagination/ListAcceleratorsPaginator.ts index 1c061d0bb3ec..b343c28e38d1 100644 --- a/clients/client-global-accelerator/src/pagination/ListAcceleratorsPaginator.ts +++ b/clients/client-global-accelerator/src/pagination/ListAcceleratorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlobalAcceleratorClient } from "../GlobalAcceleratorClient"; import { GlobalAcceleratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlobalAcceleratorClient, - input: ListAcceleratorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAcceleratorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccelerators( +export const paginateListAccelerators: ( config: GlobalAcceleratorPaginationConfiguration, input: ListAcceleratorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAcceleratorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlobalAcceleratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GlobalAccelerator | GlobalAcceleratorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlobalAcceleratorPaginationConfiguration, + ListAcceleratorsCommandInput, + ListAcceleratorsCommandOutput +>(GlobalAcceleratorClient, ListAcceleratorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-global-accelerator/src/pagination/ListByoipCidrsPaginator.ts b/clients/client-global-accelerator/src/pagination/ListByoipCidrsPaginator.ts index f05198099ad2..046d39d33872 100644 --- a/clients/client-global-accelerator/src/pagination/ListByoipCidrsPaginator.ts +++ b/clients/client-global-accelerator/src/pagination/ListByoipCidrsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlobalAcceleratorClient } from "../GlobalAcceleratorClient"; import { GlobalAcceleratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlobalAcceleratorClient, - input: ListByoipCidrsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListByoipCidrsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListByoipCidrs( +export const paginateListByoipCidrs: ( config: GlobalAcceleratorPaginationConfiguration, input: ListByoipCidrsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListByoipCidrsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlobalAcceleratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GlobalAccelerator | GlobalAcceleratorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlobalAcceleratorPaginationConfiguration, + ListByoipCidrsCommandInput, + ListByoipCidrsCommandOutput +>(GlobalAcceleratorClient, ListByoipCidrsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-global-accelerator/src/pagination/ListCrossAccountAttachmentsPaginator.ts b/clients/client-global-accelerator/src/pagination/ListCrossAccountAttachmentsPaginator.ts index 2614bf3ee287..873fc436a4da 100644 --- a/clients/client-global-accelerator/src/pagination/ListCrossAccountAttachmentsPaginator.ts +++ b/clients/client-global-accelerator/src/pagination/ListCrossAccountAttachmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlobalAcceleratorClient } from "../GlobalAcceleratorClient"; import { GlobalAcceleratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlobalAcceleratorClient, - input: ListCrossAccountAttachmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCrossAccountAttachmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCrossAccountAttachments( +export const paginateListCrossAccountAttachments: ( config: GlobalAcceleratorPaginationConfiguration, input: ListCrossAccountAttachmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCrossAccountAttachmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlobalAcceleratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GlobalAccelerator | GlobalAcceleratorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlobalAcceleratorPaginationConfiguration, + ListCrossAccountAttachmentsCommandInput, + ListCrossAccountAttachmentsCommandOutput +>(GlobalAcceleratorClient, ListCrossAccountAttachmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-global-accelerator/src/pagination/ListCrossAccountResourcesPaginator.ts b/clients/client-global-accelerator/src/pagination/ListCrossAccountResourcesPaginator.ts index aadc1e08c799..7ae69ba8cf42 100644 --- a/clients/client-global-accelerator/src/pagination/ListCrossAccountResourcesPaginator.ts +++ b/clients/client-global-accelerator/src/pagination/ListCrossAccountResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlobalAcceleratorClient } from "../GlobalAcceleratorClient"; import { GlobalAcceleratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlobalAcceleratorClient, - input: ListCrossAccountResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCrossAccountResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCrossAccountResources( +export const paginateListCrossAccountResources: ( config: GlobalAcceleratorPaginationConfiguration, input: ListCrossAccountResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCrossAccountResourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlobalAcceleratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GlobalAccelerator | GlobalAcceleratorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlobalAcceleratorPaginationConfiguration, + ListCrossAccountResourcesCommandInput, + ListCrossAccountResourcesCommandOutput +>(GlobalAcceleratorClient, ListCrossAccountResourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-global-accelerator/src/pagination/ListCustomRoutingAcceleratorsPaginator.ts b/clients/client-global-accelerator/src/pagination/ListCustomRoutingAcceleratorsPaginator.ts index 48d07774ea0b..481c95ad94b4 100644 --- a/clients/client-global-accelerator/src/pagination/ListCustomRoutingAcceleratorsPaginator.ts +++ b/clients/client-global-accelerator/src/pagination/ListCustomRoutingAcceleratorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlobalAcceleratorClient } from "../GlobalAcceleratorClient"; import { GlobalAcceleratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlobalAcceleratorClient, - input: ListCustomRoutingAcceleratorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomRoutingAcceleratorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomRoutingAccelerators( +export const paginateListCustomRoutingAccelerators: ( config: GlobalAcceleratorPaginationConfiguration, input: ListCustomRoutingAcceleratorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomRoutingAcceleratorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlobalAcceleratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GlobalAccelerator | GlobalAcceleratorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlobalAcceleratorPaginationConfiguration, + ListCustomRoutingAcceleratorsCommandInput, + ListCustomRoutingAcceleratorsCommandOutput +>(GlobalAcceleratorClient, ListCustomRoutingAcceleratorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-global-accelerator/src/pagination/ListCustomRoutingEndpointGroupsPaginator.ts b/clients/client-global-accelerator/src/pagination/ListCustomRoutingEndpointGroupsPaginator.ts index 42d679ea3385..432df18681a6 100644 --- a/clients/client-global-accelerator/src/pagination/ListCustomRoutingEndpointGroupsPaginator.ts +++ b/clients/client-global-accelerator/src/pagination/ListCustomRoutingEndpointGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlobalAcceleratorClient } from "../GlobalAcceleratorClient"; import { GlobalAcceleratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlobalAcceleratorClient, - input: ListCustomRoutingEndpointGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomRoutingEndpointGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomRoutingEndpointGroups( +export const paginateListCustomRoutingEndpointGroups: ( config: GlobalAcceleratorPaginationConfiguration, input: ListCustomRoutingEndpointGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomRoutingEndpointGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlobalAcceleratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GlobalAccelerator | GlobalAcceleratorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlobalAcceleratorPaginationConfiguration, + ListCustomRoutingEndpointGroupsCommandInput, + ListCustomRoutingEndpointGroupsCommandOutput +>(GlobalAcceleratorClient, ListCustomRoutingEndpointGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-global-accelerator/src/pagination/ListCustomRoutingListenersPaginator.ts b/clients/client-global-accelerator/src/pagination/ListCustomRoutingListenersPaginator.ts index 83371c8a5fa2..7082b1745ef5 100644 --- a/clients/client-global-accelerator/src/pagination/ListCustomRoutingListenersPaginator.ts +++ b/clients/client-global-accelerator/src/pagination/ListCustomRoutingListenersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlobalAcceleratorClient } from "../GlobalAcceleratorClient"; import { GlobalAcceleratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlobalAcceleratorClient, - input: ListCustomRoutingListenersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomRoutingListenersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomRoutingListeners( +export const paginateListCustomRoutingListeners: ( config: GlobalAcceleratorPaginationConfiguration, input: ListCustomRoutingListenersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomRoutingListenersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlobalAcceleratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GlobalAccelerator | GlobalAcceleratorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlobalAcceleratorPaginationConfiguration, + ListCustomRoutingListenersCommandInput, + ListCustomRoutingListenersCommandOutput +>(GlobalAcceleratorClient, ListCustomRoutingListenersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-global-accelerator/src/pagination/ListCustomRoutingPortMappingsByDestinationPaginator.ts b/clients/client-global-accelerator/src/pagination/ListCustomRoutingPortMappingsByDestinationPaginator.ts index 09bd250e6376..2dd739cee391 100644 --- a/clients/client-global-accelerator/src/pagination/ListCustomRoutingPortMappingsByDestinationPaginator.ts +++ b/clients/client-global-accelerator/src/pagination/ListCustomRoutingPortMappingsByDestinationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlobalAcceleratorClient } from "../GlobalAcceleratorClient"; import { GlobalAcceleratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlobalAcceleratorClient, - input: ListCustomRoutingPortMappingsByDestinationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomRoutingPortMappingsByDestinationCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomRoutingPortMappingsByDestination( +export const paginateListCustomRoutingPortMappingsByDestination: ( config: GlobalAcceleratorPaginationConfiguration, input: ListCustomRoutingPortMappingsByDestinationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomRoutingPortMappingsByDestinationCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlobalAcceleratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GlobalAccelerator | GlobalAcceleratorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlobalAcceleratorPaginationConfiguration, + ListCustomRoutingPortMappingsByDestinationCommandInput, + ListCustomRoutingPortMappingsByDestinationCommandOutput +>(GlobalAcceleratorClient, ListCustomRoutingPortMappingsByDestinationCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-global-accelerator/src/pagination/ListCustomRoutingPortMappingsPaginator.ts b/clients/client-global-accelerator/src/pagination/ListCustomRoutingPortMappingsPaginator.ts index 9a866c27a2d7..d9c410f2b235 100644 --- a/clients/client-global-accelerator/src/pagination/ListCustomRoutingPortMappingsPaginator.ts +++ b/clients/client-global-accelerator/src/pagination/ListCustomRoutingPortMappingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlobalAcceleratorClient } from "../GlobalAcceleratorClient"; import { GlobalAcceleratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlobalAcceleratorClient, - input: ListCustomRoutingPortMappingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomRoutingPortMappingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomRoutingPortMappings( +export const paginateListCustomRoutingPortMappings: ( config: GlobalAcceleratorPaginationConfiguration, input: ListCustomRoutingPortMappingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomRoutingPortMappingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlobalAcceleratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GlobalAccelerator | GlobalAcceleratorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlobalAcceleratorPaginationConfiguration, + ListCustomRoutingPortMappingsCommandInput, + ListCustomRoutingPortMappingsCommandOutput +>(GlobalAcceleratorClient, ListCustomRoutingPortMappingsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-global-accelerator/src/pagination/ListEndpointGroupsPaginator.ts b/clients/client-global-accelerator/src/pagination/ListEndpointGroupsPaginator.ts index 69d0718e2543..6bea7b93951d 100644 --- a/clients/client-global-accelerator/src/pagination/ListEndpointGroupsPaginator.ts +++ b/clients/client-global-accelerator/src/pagination/ListEndpointGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlobalAcceleratorClient } from "../GlobalAcceleratorClient"; import { GlobalAcceleratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlobalAcceleratorClient, - input: ListEndpointGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEndpointGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEndpointGroups( +export const paginateListEndpointGroups: ( config: GlobalAcceleratorPaginationConfiguration, input: ListEndpointGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEndpointGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlobalAcceleratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GlobalAccelerator | GlobalAcceleratorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlobalAcceleratorPaginationConfiguration, + ListEndpointGroupsCommandInput, + ListEndpointGroupsCommandOutput +>(GlobalAcceleratorClient, ListEndpointGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-global-accelerator/src/pagination/ListListenersPaginator.ts b/clients/client-global-accelerator/src/pagination/ListListenersPaginator.ts index 0072c71d6db2..87dc2b16c104 100644 --- a/clients/client-global-accelerator/src/pagination/ListListenersPaginator.ts +++ b/clients/client-global-accelerator/src/pagination/ListListenersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlobalAcceleratorClient } from "../GlobalAcceleratorClient"; import { GlobalAcceleratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlobalAcceleratorClient, - input: ListListenersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListListenersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListListeners( +export const paginateListListeners: ( config: GlobalAcceleratorPaginationConfiguration, input: ListListenersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListListenersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlobalAcceleratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GlobalAccelerator | GlobalAcceleratorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GlobalAcceleratorPaginationConfiguration, + ListListenersCommandInput, + ListListenersCommandOutput +>(GlobalAcceleratorClient, ListListenersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/package.json b/clients/client-glue/package.json index 6e8d153d9f0c..0631ac746265 100644 --- a/clients/client-glue/package.json +++ b/clients/client-glue/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-glue/src/pagination/GetBlueprintRunsPaginator.ts b/clients/client-glue/src/pagination/GetBlueprintRunsPaginator.ts index 75eeb8cd44a6..6c0013106534 100644 --- a/clients/client-glue/src/pagination/GetBlueprintRunsPaginator.ts +++ b/clients/client-glue/src/pagination/GetBlueprintRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetBlueprintRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetBlueprintRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetBlueprintRuns( +export const paginateGetBlueprintRuns: ( config: GluePaginationConfiguration, input: GetBlueprintRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetBlueprintRunsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetBlueprintRunsCommandInput, + GetBlueprintRunsCommandOutput +>(GlueClient, GetBlueprintRunsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetClassifiersPaginator.ts b/clients/client-glue/src/pagination/GetClassifiersPaginator.ts index c3fcfef0911a..cf4ed8b7f326 100644 --- a/clients/client-glue/src/pagination/GetClassifiersPaginator.ts +++ b/clients/client-glue/src/pagination/GetClassifiersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetClassifiersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetClassifiersCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetClassifiers( +export const paginateGetClassifiers: ( config: GluePaginationConfiguration, input: GetClassifiersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetClassifiersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetClassifiersCommandInput, + GetClassifiersCommandOutput +>(GlueClient, GetClassifiersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetColumnStatisticsTaskRunsPaginator.ts b/clients/client-glue/src/pagination/GetColumnStatisticsTaskRunsPaginator.ts index aaae367037c7..478916768e86 100644 --- a/clients/client-glue/src/pagination/GetColumnStatisticsTaskRunsPaginator.ts +++ b/clients/client-glue/src/pagination/GetColumnStatisticsTaskRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetColumnStatisticsTaskRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetColumnStatisticsTaskRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetColumnStatisticsTaskRuns( +export const paginateGetColumnStatisticsTaskRuns: ( config: GluePaginationConfiguration, input: GetColumnStatisticsTaskRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetColumnStatisticsTaskRunsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetColumnStatisticsTaskRunsCommandInput, + GetColumnStatisticsTaskRunsCommandOutput +>(GlueClient, GetColumnStatisticsTaskRunsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetConnectionsPaginator.ts b/clients/client-glue/src/pagination/GetConnectionsPaginator.ts index 352168fe136b..d90e04a1eca9 100644 --- a/clients/client-glue/src/pagination/GetConnectionsPaginator.ts +++ b/clients/client-glue/src/pagination/GetConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetConnections( +export const paginateGetConnections: ( config: GluePaginationConfiguration, input: GetConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetConnectionsCommandInput, + GetConnectionsCommandOutput +>(GlueClient, GetConnectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetCrawlerMetricsPaginator.ts b/clients/client-glue/src/pagination/GetCrawlerMetricsPaginator.ts index f03cc6385875..e13eba80e0dd 100644 --- a/clients/client-glue/src/pagination/GetCrawlerMetricsPaginator.ts +++ b/clients/client-glue/src/pagination/GetCrawlerMetricsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetCrawlerMetricsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCrawlerMetricsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCrawlerMetrics( +export const paginateGetCrawlerMetrics: ( config: GluePaginationConfiguration, input: GetCrawlerMetricsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCrawlerMetricsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetCrawlerMetricsCommandInput, + GetCrawlerMetricsCommandOutput +>(GlueClient, GetCrawlerMetricsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetCrawlersPaginator.ts b/clients/client-glue/src/pagination/GetCrawlersPaginator.ts index 89dbaf7ef37e..331fe5ec62f1 100644 --- a/clients/client-glue/src/pagination/GetCrawlersPaginator.ts +++ b/clients/client-glue/src/pagination/GetCrawlersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetCrawlersCommand, GetCrawlersCommandInput, GetCrawlersCommandOutput } from "../commands/GetCrawlersCommand"; import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetCrawlersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCrawlersCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCrawlers( +export const paginateGetCrawlers: ( config: GluePaginationConfiguration, input: GetCrawlersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCrawlersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetCrawlersCommandInput, + GetCrawlersCommandOutput +>(GlueClient, GetCrawlersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetDatabasesPaginator.ts b/clients/client-glue/src/pagination/GetDatabasesPaginator.ts index 6a93faeb28ef..c0fed7480afc 100644 --- a/clients/client-glue/src/pagination/GetDatabasesPaginator.ts +++ b/clients/client-glue/src/pagination/GetDatabasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetDatabasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetDatabasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetDatabases( +export const paginateGetDatabases: ( config: GluePaginationConfiguration, input: GetDatabasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetDatabasesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetDatabasesCommandInput, + GetDatabasesCommandOutput +>(GlueClient, GetDatabasesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetDevEndpointsPaginator.ts b/clients/client-glue/src/pagination/GetDevEndpointsPaginator.ts index bc70df26e7cd..c0a04d8b78b9 100644 --- a/clients/client-glue/src/pagination/GetDevEndpointsPaginator.ts +++ b/clients/client-glue/src/pagination/GetDevEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetDevEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetDevEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetDevEndpoints( +export const paginateGetDevEndpoints: ( config: GluePaginationConfiguration, input: GetDevEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetDevEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetDevEndpointsCommandInput, + GetDevEndpointsCommandOutput +>(GlueClient, GetDevEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetJobRunsPaginator.ts b/clients/client-glue/src/pagination/GetJobRunsPaginator.ts index 7a21441486a5..84f933e3e62b 100644 --- a/clients/client-glue/src/pagination/GetJobRunsPaginator.ts +++ b/clients/client-glue/src/pagination/GetJobRunsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetJobRunsCommand, GetJobRunsCommandInput, GetJobRunsCommandOutput } from "../commands/GetJobRunsCommand"; import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetJobRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetJobRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetJobRuns( +export const paginateGetJobRuns: ( config: GluePaginationConfiguration, input: GetJobRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetJobRunsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetJobRunsCommandInput, + GetJobRunsCommandOutput +>(GlueClient, GetJobRunsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetJobsPaginator.ts b/clients/client-glue/src/pagination/GetJobsPaginator.ts index 2c018c77b8b0..9e691fa09fee 100644 --- a/clients/client-glue/src/pagination/GetJobsPaginator.ts +++ b/clients/client-glue/src/pagination/GetJobsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetJobsCommand, GetJobsCommandInput, GetJobsCommandOutput } from "../commands/GetJobsCommand"; import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetJobs( +export const paginateGetJobs: ( config: GluePaginationConfiguration, input: GetJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetJobsCommandInput, + GetJobsCommandOutput +>(GlueClient, GetJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetMLTaskRunsPaginator.ts b/clients/client-glue/src/pagination/GetMLTaskRunsPaginator.ts index 0b482d71f848..7a3763304190 100644 --- a/clients/client-glue/src/pagination/GetMLTaskRunsPaginator.ts +++ b/clients/client-glue/src/pagination/GetMLTaskRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetMLTaskRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetMLTaskRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetMLTaskRuns( +export const paginateGetMLTaskRuns: ( config: GluePaginationConfiguration, input: GetMLTaskRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetMLTaskRunsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetMLTaskRunsCommandInput, + GetMLTaskRunsCommandOutput +>(GlueClient, GetMLTaskRunsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetMLTransformsPaginator.ts b/clients/client-glue/src/pagination/GetMLTransformsPaginator.ts index c6576d603d31..b46fdd2b37c0 100644 --- a/clients/client-glue/src/pagination/GetMLTransformsPaginator.ts +++ b/clients/client-glue/src/pagination/GetMLTransformsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetMLTransformsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetMLTransformsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetMLTransforms( +export const paginateGetMLTransforms: ( config: GluePaginationConfiguration, input: GetMLTransformsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetMLTransformsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetMLTransformsCommandInput, + GetMLTransformsCommandOutput +>(GlueClient, GetMLTransformsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetPartitionIndexesPaginator.ts b/clients/client-glue/src/pagination/GetPartitionIndexesPaginator.ts index 3130e12b474e..11c684da61e5 100644 --- a/clients/client-glue/src/pagination/GetPartitionIndexesPaginator.ts +++ b/clients/client-glue/src/pagination/GetPartitionIndexesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetPartitionIndexesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetPartitionIndexesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetPartitionIndexes( +export const paginateGetPartitionIndexes: ( config: GluePaginationConfiguration, input: GetPartitionIndexesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetPartitionIndexesCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetPartitionIndexesCommandInput, + GetPartitionIndexesCommandOutput +>(GlueClient, GetPartitionIndexesCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-glue/src/pagination/GetPartitionsPaginator.ts b/clients/client-glue/src/pagination/GetPartitionsPaginator.ts index d5117b970654..d2afe191c745 100644 --- a/clients/client-glue/src/pagination/GetPartitionsPaginator.ts +++ b/clients/client-glue/src/pagination/GetPartitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetPartitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetPartitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetPartitions( +export const paginateGetPartitions: ( config: GluePaginationConfiguration, input: GetPartitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetPartitionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetPartitionsCommandInput, + GetPartitionsCommandOutput +>(GlueClient, GetPartitionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetResourcePoliciesPaginator.ts b/clients/client-glue/src/pagination/GetResourcePoliciesPaginator.ts index 2536fa2cbe71..269f7b9dc340 100644 --- a/clients/client-glue/src/pagination/GetResourcePoliciesPaginator.ts +++ b/clients/client-glue/src/pagination/GetResourcePoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetResourcePoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetResourcePoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetResourcePolicies( +export const paginateGetResourcePolicies: ( config: GluePaginationConfiguration, input: GetResourcePoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetResourcePoliciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetResourcePoliciesCommandInput, + GetResourcePoliciesCommandOutput +>(GlueClient, GetResourcePoliciesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetSecurityConfigurationsPaginator.ts b/clients/client-glue/src/pagination/GetSecurityConfigurationsPaginator.ts index 3d45ebf4229f..2b784d7c4842 100644 --- a/clients/client-glue/src/pagination/GetSecurityConfigurationsPaginator.ts +++ b/clients/client-glue/src/pagination/GetSecurityConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetSecurityConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetSecurityConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetSecurityConfigurations( +export const paginateGetSecurityConfigurations: ( config: GluePaginationConfiguration, input: GetSecurityConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetSecurityConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetSecurityConfigurationsCommandInput, + GetSecurityConfigurationsCommandOutput +>(GlueClient, GetSecurityConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetTableVersionsPaginator.ts b/clients/client-glue/src/pagination/GetTableVersionsPaginator.ts index 5649f41f070b..829d387b066f 100644 --- a/clients/client-glue/src/pagination/GetTableVersionsPaginator.ts +++ b/clients/client-glue/src/pagination/GetTableVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetTableVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTableVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTableVersions( +export const paginateGetTableVersions: ( config: GluePaginationConfiguration, input: GetTableVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTableVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetTableVersionsCommandInput, + GetTableVersionsCommandOutput +>(GlueClient, GetTableVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetTablesPaginator.ts b/clients/client-glue/src/pagination/GetTablesPaginator.ts index e00d8d619e11..43a1a8ad1d4c 100644 --- a/clients/client-glue/src/pagination/GetTablesPaginator.ts +++ b/clients/client-glue/src/pagination/GetTablesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetTablesCommand, GetTablesCommandInput, GetTablesCommandOutput } from "../commands/GetTablesCommand"; import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetTablesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTablesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTables( +export const paginateGetTables: ( config: GluePaginationConfiguration, input: GetTablesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTablesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetTablesCommandInput, + GetTablesCommandOutput +>(GlueClient, GetTablesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetTriggersPaginator.ts b/clients/client-glue/src/pagination/GetTriggersPaginator.ts index 647124aa6b2e..3a35f0339913 100644 --- a/clients/client-glue/src/pagination/GetTriggersPaginator.ts +++ b/clients/client-glue/src/pagination/GetTriggersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetTriggersCommand, GetTriggersCommandInput, GetTriggersCommandOutput } from "../commands/GetTriggersCommand"; import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetTriggersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTriggersCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTriggers( +export const paginateGetTriggers: ( config: GluePaginationConfiguration, input: GetTriggersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTriggersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetTriggersCommandInput, + GetTriggersCommandOutput +>(GlueClient, GetTriggersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetUnfilteredPartitionsMetadataPaginator.ts b/clients/client-glue/src/pagination/GetUnfilteredPartitionsMetadataPaginator.ts index b1e82f250efa..5babc03541ca 100644 --- a/clients/client-glue/src/pagination/GetUnfilteredPartitionsMetadataPaginator.ts +++ b/clients/client-glue/src/pagination/GetUnfilteredPartitionsMetadataPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetUnfilteredPartitionsMetadataCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetUnfilteredPartitionsMetadataCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetUnfilteredPartitionsMetadata( +export const paginateGetUnfilteredPartitionsMetadata: ( config: GluePaginationConfiguration, input: GetUnfilteredPartitionsMetadataCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetUnfilteredPartitionsMetadataCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetUnfilteredPartitionsMetadataCommandInput, + GetUnfilteredPartitionsMetadataCommandOutput +>(GlueClient, GetUnfilteredPartitionsMetadataCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetUserDefinedFunctionsPaginator.ts b/clients/client-glue/src/pagination/GetUserDefinedFunctionsPaginator.ts index fcc62503b9f1..5fd9b5e0181e 100644 --- a/clients/client-glue/src/pagination/GetUserDefinedFunctionsPaginator.ts +++ b/clients/client-glue/src/pagination/GetUserDefinedFunctionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetUserDefinedFunctionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetUserDefinedFunctionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetUserDefinedFunctions( +export const paginateGetUserDefinedFunctions: ( config: GluePaginationConfiguration, input: GetUserDefinedFunctionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetUserDefinedFunctionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetUserDefinedFunctionsCommandInput, + GetUserDefinedFunctionsCommandOutput +>(GlueClient, GetUserDefinedFunctionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/GetWorkflowRunsPaginator.ts b/clients/client-glue/src/pagination/GetWorkflowRunsPaginator.ts index 9c656ea2cc49..0226b612e5c6 100644 --- a/clients/client-glue/src/pagination/GetWorkflowRunsPaginator.ts +++ b/clients/client-glue/src/pagination/GetWorkflowRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: GetWorkflowRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetWorkflowRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetWorkflowRuns( +export const paginateGetWorkflowRuns: ( config: GluePaginationConfiguration, input: GetWorkflowRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetWorkflowRunsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + GetWorkflowRunsCommandInput, + GetWorkflowRunsCommandOutput +>(GlueClient, GetWorkflowRunsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListBlueprintsPaginator.ts b/clients/client-glue/src/pagination/ListBlueprintsPaginator.ts index 01db2ecff7ff..daace744bb1b 100644 --- a/clients/client-glue/src/pagination/ListBlueprintsPaginator.ts +++ b/clients/client-glue/src/pagination/ListBlueprintsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListBlueprintsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBlueprintsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBlueprints( +export const paginateListBlueprints: ( config: GluePaginationConfiguration, input: ListBlueprintsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBlueprintsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListBlueprintsCommandInput, + ListBlueprintsCommandOutput +>(GlueClient, ListBlueprintsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListColumnStatisticsTaskRunsPaginator.ts b/clients/client-glue/src/pagination/ListColumnStatisticsTaskRunsPaginator.ts index f0ba9c3b16c5..fbf6452cadad 100644 --- a/clients/client-glue/src/pagination/ListColumnStatisticsTaskRunsPaginator.ts +++ b/clients/client-glue/src/pagination/ListColumnStatisticsTaskRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListColumnStatisticsTaskRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListColumnStatisticsTaskRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListColumnStatisticsTaskRuns( +export const paginateListColumnStatisticsTaskRuns: ( config: GluePaginationConfiguration, input: ListColumnStatisticsTaskRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListColumnStatisticsTaskRunsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListColumnStatisticsTaskRunsCommandInput, + ListColumnStatisticsTaskRunsCommandOutput +>(GlueClient, ListColumnStatisticsTaskRunsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListCrawlersPaginator.ts b/clients/client-glue/src/pagination/ListCrawlersPaginator.ts index 9f3f16f6c2b8..b50873654f1f 100644 --- a/clients/client-glue/src/pagination/ListCrawlersPaginator.ts +++ b/clients/client-glue/src/pagination/ListCrawlersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListCrawlersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCrawlersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCrawlers( +export const paginateListCrawlers: ( config: GluePaginationConfiguration, input: ListCrawlersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCrawlersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListCrawlersCommandInput, + ListCrawlersCommandOutput +>(GlueClient, ListCrawlersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListCustomEntityTypesPaginator.ts b/clients/client-glue/src/pagination/ListCustomEntityTypesPaginator.ts index d4e45a6395ec..1149a22fc879 100644 --- a/clients/client-glue/src/pagination/ListCustomEntityTypesPaginator.ts +++ b/clients/client-glue/src/pagination/ListCustomEntityTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListCustomEntityTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomEntityTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomEntityTypes( +export const paginateListCustomEntityTypes: ( config: GluePaginationConfiguration, input: ListCustomEntityTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomEntityTypesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListCustomEntityTypesCommandInput, + ListCustomEntityTypesCommandOutput +>(GlueClient, ListCustomEntityTypesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListDataQualityResultsPaginator.ts b/clients/client-glue/src/pagination/ListDataQualityResultsPaginator.ts index 333691383113..eb99c7fb11d6 100644 --- a/clients/client-glue/src/pagination/ListDataQualityResultsPaginator.ts +++ b/clients/client-glue/src/pagination/ListDataQualityResultsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListDataQualityResultsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataQualityResultsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataQualityResults( +export const paginateListDataQualityResults: ( config: GluePaginationConfiguration, input: ListDataQualityResultsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataQualityResultsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListDataQualityResultsCommandInput, + ListDataQualityResultsCommandOutput +>(GlueClient, ListDataQualityResultsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListDataQualityRuleRecommendationRunsPaginator.ts b/clients/client-glue/src/pagination/ListDataQualityRuleRecommendationRunsPaginator.ts index fefe9e87c640..57087627eb16 100644 --- a/clients/client-glue/src/pagination/ListDataQualityRuleRecommendationRunsPaginator.ts +++ b/clients/client-glue/src/pagination/ListDataQualityRuleRecommendationRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListDataQualityRuleRecommendationRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataQualityRuleRecommendationRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataQualityRuleRecommendationRuns( +export const paginateListDataQualityRuleRecommendationRuns: ( config: GluePaginationConfiguration, input: ListDataQualityRuleRecommendationRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataQualityRuleRecommendationRunsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListDataQualityRuleRecommendationRunsCommandInput, + ListDataQualityRuleRecommendationRunsCommandOutput +>(GlueClient, ListDataQualityRuleRecommendationRunsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListDataQualityRulesetEvaluationRunsPaginator.ts b/clients/client-glue/src/pagination/ListDataQualityRulesetEvaluationRunsPaginator.ts index 29eb83c6ecf1..4ff813223ae1 100644 --- a/clients/client-glue/src/pagination/ListDataQualityRulesetEvaluationRunsPaginator.ts +++ b/clients/client-glue/src/pagination/ListDataQualityRulesetEvaluationRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListDataQualityRulesetEvaluationRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataQualityRulesetEvaluationRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataQualityRulesetEvaluationRuns( +export const paginateListDataQualityRulesetEvaluationRuns: ( config: GluePaginationConfiguration, input: ListDataQualityRulesetEvaluationRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataQualityRulesetEvaluationRunsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListDataQualityRulesetEvaluationRunsCommandInput, + ListDataQualityRulesetEvaluationRunsCommandOutput +>(GlueClient, ListDataQualityRulesetEvaluationRunsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListDataQualityRulesetsPaginator.ts b/clients/client-glue/src/pagination/ListDataQualityRulesetsPaginator.ts index 990536a190bd..9eaaefb8b796 100644 --- a/clients/client-glue/src/pagination/ListDataQualityRulesetsPaginator.ts +++ b/clients/client-glue/src/pagination/ListDataQualityRulesetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListDataQualityRulesetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataQualityRulesetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataQualityRulesets( +export const paginateListDataQualityRulesets: ( config: GluePaginationConfiguration, input: ListDataQualityRulesetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataQualityRulesetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListDataQualityRulesetsCommandInput, + ListDataQualityRulesetsCommandOutput +>(GlueClient, ListDataQualityRulesetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListDevEndpointsPaginator.ts b/clients/client-glue/src/pagination/ListDevEndpointsPaginator.ts index e8d8f8b4770a..9c4431fcb0c7 100644 --- a/clients/client-glue/src/pagination/ListDevEndpointsPaginator.ts +++ b/clients/client-glue/src/pagination/ListDevEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListDevEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDevEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDevEndpoints( +export const paginateListDevEndpoints: ( config: GluePaginationConfiguration, input: ListDevEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDevEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListDevEndpointsCommandInput, + ListDevEndpointsCommandOutput +>(GlueClient, ListDevEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListJobsPaginator.ts b/clients/client-glue/src/pagination/ListJobsPaginator.ts index 12f93e88fe1b..7a574b1aba93 100644 --- a/clients/client-glue/src/pagination/ListJobsPaginator.ts +++ b/clients/client-glue/src/pagination/ListJobsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListJobsCommand, ListJobsCommandInput, ListJobsCommandOutput } from "../commands/ListJobsCommand"; import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobs( +export const paginateListJobs: ( config: GluePaginationConfiguration, input: ListJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListJobsCommandInput, + ListJobsCommandOutput +>(GlueClient, ListJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListMLTransformsPaginator.ts b/clients/client-glue/src/pagination/ListMLTransformsPaginator.ts index df419230b86e..2f51bbb0546f 100644 --- a/clients/client-glue/src/pagination/ListMLTransformsPaginator.ts +++ b/clients/client-glue/src/pagination/ListMLTransformsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListMLTransformsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMLTransformsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMLTransforms( +export const paginateListMLTransforms: ( config: GluePaginationConfiguration, input: ListMLTransformsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMLTransformsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListMLTransformsCommandInput, + ListMLTransformsCommandOutput +>(GlueClient, ListMLTransformsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListRegistriesPaginator.ts b/clients/client-glue/src/pagination/ListRegistriesPaginator.ts index 3d38b5cf3a3e..1fcbeb73c055 100644 --- a/clients/client-glue/src/pagination/ListRegistriesPaginator.ts +++ b/clients/client-glue/src/pagination/ListRegistriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListRegistriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRegistriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRegistries( +export const paginateListRegistries: ( config: GluePaginationConfiguration, input: ListRegistriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRegistriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListRegistriesCommandInput, + ListRegistriesCommandOutput +>(GlueClient, ListRegistriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListSchemaVersionsPaginator.ts b/clients/client-glue/src/pagination/ListSchemaVersionsPaginator.ts index 0f3d76614fcd..027792965f08 100644 --- a/clients/client-glue/src/pagination/ListSchemaVersionsPaginator.ts +++ b/clients/client-glue/src/pagination/ListSchemaVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListSchemaVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSchemaVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSchemaVersions( +export const paginateListSchemaVersions: ( config: GluePaginationConfiguration, input: ListSchemaVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSchemaVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListSchemaVersionsCommandInput, + ListSchemaVersionsCommandOutput +>(GlueClient, ListSchemaVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListSchemasPaginator.ts b/clients/client-glue/src/pagination/ListSchemasPaginator.ts index cfd601bccbd5..62a85a12f0b7 100644 --- a/clients/client-glue/src/pagination/ListSchemasPaginator.ts +++ b/clients/client-glue/src/pagination/ListSchemasPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListSchemasCommand, ListSchemasCommandInput, ListSchemasCommandOutput } from "../commands/ListSchemasCommand"; import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListSchemasCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSchemasCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSchemas( +export const paginateListSchemas: ( config: GluePaginationConfiguration, input: ListSchemasCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSchemasCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListSchemasCommandInput, + ListSchemasCommandOutput +>(GlueClient, ListSchemasCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListSessionsPaginator.ts b/clients/client-glue/src/pagination/ListSessionsPaginator.ts index ca48eeeaf181..f1ea2cd0172e 100644 --- a/clients/client-glue/src/pagination/ListSessionsPaginator.ts +++ b/clients/client-glue/src/pagination/ListSessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListSessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSessions( +export const paginateListSessions: ( config: GluePaginationConfiguration, input: ListSessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSessionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListSessionsCommandInput, + ListSessionsCommandOutput +>(GlueClient, ListSessionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListTableOptimizerRunsPaginator.ts b/clients/client-glue/src/pagination/ListTableOptimizerRunsPaginator.ts index 84f03d9ef701..44f49fac0906 100644 --- a/clients/client-glue/src/pagination/ListTableOptimizerRunsPaginator.ts +++ b/clients/client-glue/src/pagination/ListTableOptimizerRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListTableOptimizerRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTableOptimizerRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTableOptimizerRuns( +export const paginateListTableOptimizerRuns: ( config: GluePaginationConfiguration, input: ListTableOptimizerRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTableOptimizerRunsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListTableOptimizerRunsCommandInput, + ListTableOptimizerRunsCommandOutput +>(GlueClient, ListTableOptimizerRunsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListTriggersPaginator.ts b/clients/client-glue/src/pagination/ListTriggersPaginator.ts index c3ad5abc422b..bafe837dbc0c 100644 --- a/clients/client-glue/src/pagination/ListTriggersPaginator.ts +++ b/clients/client-glue/src/pagination/ListTriggersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListTriggersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTriggersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTriggers( +export const paginateListTriggers: ( config: GluePaginationConfiguration, input: ListTriggersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTriggersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListTriggersCommandInput, + ListTriggersCommandOutput +>(GlueClient, ListTriggersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/ListWorkflowsPaginator.ts b/clients/client-glue/src/pagination/ListWorkflowsPaginator.ts index f9afc2ef6ad5..75581580736a 100644 --- a/clients/client-glue/src/pagination/ListWorkflowsPaginator.ts +++ b/clients/client-glue/src/pagination/ListWorkflowsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: ListWorkflowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkflowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkflows( +export const paginateListWorkflows: ( config: GluePaginationConfiguration, input: ListWorkflowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkflowsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + ListWorkflowsCommandInput, + ListWorkflowsCommandOutput +>(GlueClient, ListWorkflowsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-glue/src/pagination/SearchTablesPaginator.ts b/clients/client-glue/src/pagination/SearchTablesPaginator.ts index 97d38fac62b0..73599a7fcd3f 100644 --- a/clients/client-glue/src/pagination/SearchTablesPaginator.ts +++ b/clients/client-glue/src/pagination/SearchTablesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GlueClient } from "../GlueClient"; import { GluePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GlueClient, - input: SearchTablesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchTablesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchTables( +export const paginateSearchTables: ( config: GluePaginationConfiguration, input: SearchTablesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchTablesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GlueClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Glue | GlueClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GluePaginationConfiguration, + SearchTablesCommandInput, + SearchTablesCommandOutput +>(GlueClient, SearchTablesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-grafana/src/pagination/ListPermissionsPaginator.ts b/clients/client-grafana/src/pagination/ListPermissionsPaginator.ts index 5303ead38d0d..49eca5f2f5e7 100644 --- a/clients/client-grafana/src/pagination/ListPermissionsPaginator.ts +++ b/clients/client-grafana/src/pagination/ListPermissionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GrafanaClient } from "../GrafanaClient"; import { GrafanaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GrafanaClient, - input: ListPermissionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPermissionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPermissions( +export const paginateListPermissions: ( config: GrafanaPaginationConfiguration, input: ListPermissionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPermissionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GrafanaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Grafana | GrafanaClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GrafanaPaginationConfiguration, + ListPermissionsCommandInput, + ListPermissionsCommandOutput +>(GrafanaClient, ListPermissionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-grafana/src/pagination/ListVersionsPaginator.ts b/clients/client-grafana/src/pagination/ListVersionsPaginator.ts index 16d25b516c65..016a9d53e6b3 100644 --- a/clients/client-grafana/src/pagination/ListVersionsPaginator.ts +++ b/clients/client-grafana/src/pagination/ListVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GrafanaClient } from "../GrafanaClient"; import { GrafanaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GrafanaClient, - input: ListVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVersions( +export const paginateListVersions: ( config: GrafanaPaginationConfiguration, input: ListVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GrafanaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Grafana | GrafanaClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GrafanaPaginationConfiguration, + ListVersionsCommandInput, + ListVersionsCommandOutput +>(GrafanaClient, ListVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-grafana/src/pagination/ListWorkspacesPaginator.ts b/clients/client-grafana/src/pagination/ListWorkspacesPaginator.ts index 0df659d301ed..87940d8ceee8 100644 --- a/clients/client-grafana/src/pagination/ListWorkspacesPaginator.ts +++ b/clients/client-grafana/src/pagination/ListWorkspacesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GrafanaClient } from "../GrafanaClient"; import { GrafanaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GrafanaClient, - input: ListWorkspacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkspacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkspaces( +export const paginateListWorkspaces: ( config: GrafanaPaginationConfiguration, input: ListWorkspacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkspacesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GrafanaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Grafana | GrafanaClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GrafanaPaginationConfiguration, + ListWorkspacesCommandInput, + ListWorkspacesCommandOutput +>(GrafanaClient, ListWorkspacesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-greengrassv2/src/pagination/ListClientDevicesAssociatedWithCoreDevicePaginator.ts b/clients/client-greengrassv2/src/pagination/ListClientDevicesAssociatedWithCoreDevicePaginator.ts index 69bcc02be8a7..7e6bec894dfd 100644 --- a/clients/client-greengrassv2/src/pagination/ListClientDevicesAssociatedWithCoreDevicePaginator.ts +++ b/clients/client-greengrassv2/src/pagination/ListClientDevicesAssociatedWithCoreDevicePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GreengrassV2Client } from "../GreengrassV2Client"; import { GreengrassV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GreengrassV2Client, - input: ListClientDevicesAssociatedWithCoreDeviceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClientDevicesAssociatedWithCoreDeviceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClientDevicesAssociatedWithCoreDevice( +export const paginateListClientDevicesAssociatedWithCoreDevice: ( config: GreengrassV2PaginationConfiguration, input: ListClientDevicesAssociatedWithCoreDeviceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClientDevicesAssociatedWithCoreDeviceCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GreengrassV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GreengrassV2 | GreengrassV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GreengrassV2PaginationConfiguration, + ListClientDevicesAssociatedWithCoreDeviceCommandInput, + ListClientDevicesAssociatedWithCoreDeviceCommandOutput +>(GreengrassV2Client, ListClientDevicesAssociatedWithCoreDeviceCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-greengrassv2/src/pagination/ListComponentVersionsPaginator.ts b/clients/client-greengrassv2/src/pagination/ListComponentVersionsPaginator.ts index 07f6d05e5932..1e05985153dd 100644 --- a/clients/client-greengrassv2/src/pagination/ListComponentVersionsPaginator.ts +++ b/clients/client-greengrassv2/src/pagination/ListComponentVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GreengrassV2Client } from "../GreengrassV2Client"; import { GreengrassV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GreengrassV2Client, - input: ListComponentVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComponentVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComponentVersions( +export const paginateListComponentVersions: ( config: GreengrassV2PaginationConfiguration, input: ListComponentVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComponentVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GreengrassV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GreengrassV2 | GreengrassV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GreengrassV2PaginationConfiguration, + ListComponentVersionsCommandInput, + ListComponentVersionsCommandOutput +>(GreengrassV2Client, ListComponentVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-greengrassv2/src/pagination/ListComponentsPaginator.ts b/clients/client-greengrassv2/src/pagination/ListComponentsPaginator.ts index b89d76a4486f..84658473af29 100644 --- a/clients/client-greengrassv2/src/pagination/ListComponentsPaginator.ts +++ b/clients/client-greengrassv2/src/pagination/ListComponentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GreengrassV2Client } from "../GreengrassV2Client"; import { GreengrassV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GreengrassV2Client, - input: ListComponentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComponentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComponents( +export const paginateListComponents: ( config: GreengrassV2PaginationConfiguration, input: ListComponentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComponentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GreengrassV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GreengrassV2 | GreengrassV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GreengrassV2PaginationConfiguration, + ListComponentsCommandInput, + ListComponentsCommandOutput +>(GreengrassV2Client, ListComponentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-greengrassv2/src/pagination/ListCoreDevicesPaginator.ts b/clients/client-greengrassv2/src/pagination/ListCoreDevicesPaginator.ts index d309e1c6b654..99c2889284a9 100644 --- a/clients/client-greengrassv2/src/pagination/ListCoreDevicesPaginator.ts +++ b/clients/client-greengrassv2/src/pagination/ListCoreDevicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GreengrassV2Client } from "../GreengrassV2Client"; import { GreengrassV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GreengrassV2Client, - input: ListCoreDevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCoreDevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCoreDevices( +export const paginateListCoreDevices: ( config: GreengrassV2PaginationConfiguration, input: ListCoreDevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCoreDevicesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GreengrassV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GreengrassV2 | GreengrassV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GreengrassV2PaginationConfiguration, + ListCoreDevicesCommandInput, + ListCoreDevicesCommandOutput +>(GreengrassV2Client, ListCoreDevicesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-greengrassv2/src/pagination/ListDeploymentsPaginator.ts b/clients/client-greengrassv2/src/pagination/ListDeploymentsPaginator.ts index fcce381c249e..9d0eadab6a8e 100644 --- a/clients/client-greengrassv2/src/pagination/ListDeploymentsPaginator.ts +++ b/clients/client-greengrassv2/src/pagination/ListDeploymentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GreengrassV2Client } from "../GreengrassV2Client"; import { GreengrassV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GreengrassV2Client, - input: ListDeploymentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeploymentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeployments( +export const paginateListDeployments: ( config: GreengrassV2PaginationConfiguration, input: ListDeploymentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeploymentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GreengrassV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GreengrassV2 | GreengrassV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GreengrassV2PaginationConfiguration, + ListDeploymentsCommandInput, + ListDeploymentsCommandOutput +>(GreengrassV2Client, ListDeploymentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-greengrassv2/src/pagination/ListEffectiveDeploymentsPaginator.ts b/clients/client-greengrassv2/src/pagination/ListEffectiveDeploymentsPaginator.ts index 1ee0d8ee510a..b455f1734da3 100644 --- a/clients/client-greengrassv2/src/pagination/ListEffectiveDeploymentsPaginator.ts +++ b/clients/client-greengrassv2/src/pagination/ListEffectiveDeploymentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GreengrassV2Client } from "../GreengrassV2Client"; import { GreengrassV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GreengrassV2Client, - input: ListEffectiveDeploymentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEffectiveDeploymentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEffectiveDeployments( +export const paginateListEffectiveDeployments: ( config: GreengrassV2PaginationConfiguration, input: ListEffectiveDeploymentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEffectiveDeploymentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GreengrassV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GreengrassV2 | GreengrassV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GreengrassV2PaginationConfiguration, + ListEffectiveDeploymentsCommandInput, + ListEffectiveDeploymentsCommandOutput +>(GreengrassV2Client, ListEffectiveDeploymentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-greengrassv2/src/pagination/ListInstalledComponentsPaginator.ts b/clients/client-greengrassv2/src/pagination/ListInstalledComponentsPaginator.ts index c8540f1f5068..eba6a31bb4e8 100644 --- a/clients/client-greengrassv2/src/pagination/ListInstalledComponentsPaginator.ts +++ b/clients/client-greengrassv2/src/pagination/ListInstalledComponentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GreengrassV2Client } from "../GreengrassV2Client"; import { GreengrassV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GreengrassV2Client, - input: ListInstalledComponentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInstalledComponentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInstalledComponents( +export const paginateListInstalledComponents: ( config: GreengrassV2PaginationConfiguration, input: ListInstalledComponentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInstalledComponentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GreengrassV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GreengrassV2 | GreengrassV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GreengrassV2PaginationConfiguration, + ListInstalledComponentsCommandInput, + ListInstalledComponentsCommandOutput +>(GreengrassV2Client, ListInstalledComponentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-groundstation/src/pagination/ListConfigsPaginator.ts b/clients/client-groundstation/src/pagination/ListConfigsPaginator.ts index 18416373b8bf..3d67660211cb 100644 --- a/clients/client-groundstation/src/pagination/ListConfigsPaginator.ts +++ b/clients/client-groundstation/src/pagination/ListConfigsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListConfigsCommand, ListConfigsCommandInput, ListConfigsCommandOutput } from "../commands/ListConfigsCommand"; import { GroundStationClient } from "../GroundStationClient"; import { GroundStationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GroundStationClient, - input: ListConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConfigs( +export const paginateListConfigs: ( config: GroundStationPaginationConfiguration, input: ListConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConfigsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GroundStationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GroundStation | GroundStationClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GroundStationPaginationConfiguration, + ListConfigsCommandInput, + ListConfigsCommandOutput +>(GroundStationClient, ListConfigsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-groundstation/src/pagination/ListContactsPaginator.ts b/clients/client-groundstation/src/pagination/ListContactsPaginator.ts index f200a2659be6..5af08cfbca14 100644 --- a/clients/client-groundstation/src/pagination/ListContactsPaginator.ts +++ b/clients/client-groundstation/src/pagination/ListContactsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GroundStationClient } from "../GroundStationClient"; import { GroundStationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GroundStationClient, - input: ListContactsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContactsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContacts( +export const paginateListContacts: ( config: GroundStationPaginationConfiguration, input: ListContactsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContactsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GroundStationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GroundStation | GroundStationClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GroundStationPaginationConfiguration, + ListContactsCommandInput, + ListContactsCommandOutput +>(GroundStationClient, ListContactsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-groundstation/src/pagination/ListDataflowEndpointGroupsPaginator.ts b/clients/client-groundstation/src/pagination/ListDataflowEndpointGroupsPaginator.ts index 966f20f40680..3bafca1636de 100644 --- a/clients/client-groundstation/src/pagination/ListDataflowEndpointGroupsPaginator.ts +++ b/clients/client-groundstation/src/pagination/ListDataflowEndpointGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GroundStationClient } from "../GroundStationClient"; import { GroundStationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GroundStationClient, - input: ListDataflowEndpointGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataflowEndpointGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataflowEndpointGroups( +export const paginateListDataflowEndpointGroups: ( config: GroundStationPaginationConfiguration, input: ListDataflowEndpointGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataflowEndpointGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GroundStationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GroundStation | GroundStationClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GroundStationPaginationConfiguration, + ListDataflowEndpointGroupsCommandInput, + ListDataflowEndpointGroupsCommandOutput +>(GroundStationClient, ListDataflowEndpointGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-groundstation/src/pagination/ListEphemeridesPaginator.ts b/clients/client-groundstation/src/pagination/ListEphemeridesPaginator.ts index c4cdf1f8c314..8dbf41ba4ced 100644 --- a/clients/client-groundstation/src/pagination/ListEphemeridesPaginator.ts +++ b/clients/client-groundstation/src/pagination/ListEphemeridesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GroundStationClient } from "../GroundStationClient"; import { GroundStationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GroundStationClient, - input: ListEphemeridesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEphemeridesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEphemerides( +export const paginateListEphemerides: ( config: GroundStationPaginationConfiguration, input: ListEphemeridesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEphemeridesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GroundStationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GroundStation | GroundStationClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GroundStationPaginationConfiguration, + ListEphemeridesCommandInput, + ListEphemeridesCommandOutput +>(GroundStationClient, ListEphemeridesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-groundstation/src/pagination/ListGroundStationsPaginator.ts b/clients/client-groundstation/src/pagination/ListGroundStationsPaginator.ts index 865f4d16e630..29a74efc4dbb 100644 --- a/clients/client-groundstation/src/pagination/ListGroundStationsPaginator.ts +++ b/clients/client-groundstation/src/pagination/ListGroundStationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GroundStationClient } from "../GroundStationClient"; import { GroundStationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GroundStationClient, - input: ListGroundStationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroundStationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroundStations( +export const paginateListGroundStations: ( config: GroundStationPaginationConfiguration, input: ListGroundStationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroundStationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GroundStationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GroundStation | GroundStationClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GroundStationPaginationConfiguration, + ListGroundStationsCommandInput, + ListGroundStationsCommandOutput +>(GroundStationClient, ListGroundStationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-groundstation/src/pagination/ListMissionProfilesPaginator.ts b/clients/client-groundstation/src/pagination/ListMissionProfilesPaginator.ts index b10504d557ab..07385743a4f8 100644 --- a/clients/client-groundstation/src/pagination/ListMissionProfilesPaginator.ts +++ b/clients/client-groundstation/src/pagination/ListMissionProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GroundStationClient } from "../GroundStationClient"; import { GroundStationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GroundStationClient, - input: ListMissionProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMissionProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMissionProfiles( +export const paginateListMissionProfiles: ( config: GroundStationPaginationConfiguration, input: ListMissionProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMissionProfilesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GroundStationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GroundStation | GroundStationClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GroundStationPaginationConfiguration, + ListMissionProfilesCommandInput, + ListMissionProfilesCommandOutput +>(GroundStationClient, ListMissionProfilesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-groundstation/src/pagination/ListSatellitesPaginator.ts b/clients/client-groundstation/src/pagination/ListSatellitesPaginator.ts index 5ee6550a887e..f8ca1e2d7345 100644 --- a/clients/client-groundstation/src/pagination/ListSatellitesPaginator.ts +++ b/clients/client-groundstation/src/pagination/ListSatellitesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GroundStationClient } from "../GroundStationClient"; import { GroundStationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GroundStationClient, - input: ListSatellitesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSatellitesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSatellites( +export const paginateListSatellites: ( config: GroundStationPaginationConfiguration, input: ListSatellitesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSatellitesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof GroundStationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GroundStation | GroundStationClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GroundStationPaginationConfiguration, + ListSatellitesCommandInput, + ListSatellitesCommandOutput +>(GroundStationClient, ListSatellitesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-guardduty/src/pagination/DescribeMalwareScansPaginator.ts b/clients/client-guardduty/src/pagination/DescribeMalwareScansPaginator.ts index a5df5fd6a95d..a6d5a965ae4a 100644 --- a/clients/client-guardduty/src/pagination/DescribeMalwareScansPaginator.ts +++ b/clients/client-guardduty/src/pagination/DescribeMalwareScansPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GuardDutyClient } from "../GuardDutyClient"; import { GuardDutyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GuardDutyClient, - input: DescribeMalwareScansCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMalwareScansCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMalwareScans( +export const paginateDescribeMalwareScans: ( config: GuardDutyPaginationConfiguration, input: DescribeMalwareScansCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMalwareScansCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GuardDutyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GuardDuty | GuardDutyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GuardDutyPaginationConfiguration, + DescribeMalwareScansCommandInput, + DescribeMalwareScansCommandOutput +>(GuardDutyClient, DescribeMalwareScansCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-guardduty/src/pagination/DescribeOrganizationConfigurationPaginator.ts b/clients/client-guardduty/src/pagination/DescribeOrganizationConfigurationPaginator.ts index d8be3fbcb0ad..8671913fa897 100644 --- a/clients/client-guardduty/src/pagination/DescribeOrganizationConfigurationPaginator.ts +++ b/clients/client-guardduty/src/pagination/DescribeOrganizationConfigurationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GuardDutyClient } from "../GuardDutyClient"; import { GuardDutyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GuardDutyClient, - input: DescribeOrganizationConfigurationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOrganizationConfigurationCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOrganizationConfiguration( +export const paginateDescribeOrganizationConfiguration: ( config: GuardDutyPaginationConfiguration, input: DescribeOrganizationConfigurationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOrganizationConfigurationCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GuardDutyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GuardDuty | GuardDutyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GuardDutyPaginationConfiguration, + DescribeOrganizationConfigurationCommandInput, + DescribeOrganizationConfigurationCommandOutput +>(GuardDutyClient, DescribeOrganizationConfigurationCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-guardduty/src/pagination/GetUsageStatisticsPaginator.ts b/clients/client-guardduty/src/pagination/GetUsageStatisticsPaginator.ts index a6895d19ca7d..11c1dcdff39b 100644 --- a/clients/client-guardduty/src/pagination/GetUsageStatisticsPaginator.ts +++ b/clients/client-guardduty/src/pagination/GetUsageStatisticsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GuardDutyClient } from "../GuardDutyClient"; import { GuardDutyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GuardDutyClient, - input: GetUsageStatisticsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetUsageStatisticsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetUsageStatistics( +export const paginateGetUsageStatistics: ( config: GuardDutyPaginationConfiguration, input: GetUsageStatisticsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetUsageStatisticsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GuardDutyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GuardDuty | GuardDutyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GuardDutyPaginationConfiguration, + GetUsageStatisticsCommandInput, + GetUsageStatisticsCommandOutput +>(GuardDutyClient, GetUsageStatisticsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-guardduty/src/pagination/ListCoveragePaginator.ts b/clients/client-guardduty/src/pagination/ListCoveragePaginator.ts index c8ba4d9d4fd8..5487e4a4958e 100644 --- a/clients/client-guardduty/src/pagination/ListCoveragePaginator.ts +++ b/clients/client-guardduty/src/pagination/ListCoveragePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GuardDutyClient } from "../GuardDutyClient"; import { GuardDutyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GuardDutyClient, - input: ListCoverageCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCoverageCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCoverage( +export const paginateListCoverage: ( config: GuardDutyPaginationConfiguration, input: ListCoverageCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCoverageCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GuardDutyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GuardDuty | GuardDutyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GuardDutyPaginationConfiguration, + ListCoverageCommandInput, + ListCoverageCommandOutput +>(GuardDutyClient, ListCoverageCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-guardduty/src/pagination/ListDetectorsPaginator.ts b/clients/client-guardduty/src/pagination/ListDetectorsPaginator.ts index bbffc088b176..f99f291ae69e 100644 --- a/clients/client-guardduty/src/pagination/ListDetectorsPaginator.ts +++ b/clients/client-guardduty/src/pagination/ListDetectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GuardDutyClient } from "../GuardDutyClient"; import { GuardDutyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GuardDutyClient, - input: ListDetectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDetectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDetectors( +export const paginateListDetectors: ( config: GuardDutyPaginationConfiguration, input: ListDetectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDetectorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GuardDutyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GuardDuty | GuardDutyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GuardDutyPaginationConfiguration, + ListDetectorsCommandInput, + ListDetectorsCommandOutput +>(GuardDutyClient, ListDetectorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-guardduty/src/pagination/ListFiltersPaginator.ts b/clients/client-guardduty/src/pagination/ListFiltersPaginator.ts index ed9bb5295924..2937d9e789cd 100644 --- a/clients/client-guardduty/src/pagination/ListFiltersPaginator.ts +++ b/clients/client-guardduty/src/pagination/ListFiltersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListFiltersCommand, ListFiltersCommandInput, ListFiltersCommandOutput } from "../commands/ListFiltersCommand"; import { GuardDutyClient } from "../GuardDutyClient"; import { GuardDutyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GuardDutyClient, - input: ListFiltersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFiltersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFilters( +export const paginateListFilters: ( config: GuardDutyPaginationConfiguration, input: ListFiltersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFiltersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GuardDutyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GuardDuty | GuardDutyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GuardDutyPaginationConfiguration, + ListFiltersCommandInput, + ListFiltersCommandOutput +>(GuardDutyClient, ListFiltersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-guardduty/src/pagination/ListFindingsPaginator.ts b/clients/client-guardduty/src/pagination/ListFindingsPaginator.ts index b969b7e813fa..d201c60507d5 100644 --- a/clients/client-guardduty/src/pagination/ListFindingsPaginator.ts +++ b/clients/client-guardduty/src/pagination/ListFindingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GuardDutyClient } from "../GuardDutyClient"; import { GuardDutyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GuardDutyClient, - input: ListFindingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFindingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFindings( +export const paginateListFindings: ( config: GuardDutyPaginationConfiguration, input: ListFindingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFindingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GuardDutyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GuardDuty | GuardDutyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GuardDutyPaginationConfiguration, + ListFindingsCommandInput, + ListFindingsCommandOutput +>(GuardDutyClient, ListFindingsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-guardduty/src/pagination/ListIPSetsPaginator.ts b/clients/client-guardduty/src/pagination/ListIPSetsPaginator.ts index dbe566bf6032..dd2930c1414a 100644 --- a/clients/client-guardduty/src/pagination/ListIPSetsPaginator.ts +++ b/clients/client-guardduty/src/pagination/ListIPSetsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListIPSetsCommand, ListIPSetsCommandInput, ListIPSetsCommandOutput } from "../commands/ListIPSetsCommand"; import { GuardDutyClient } from "../GuardDutyClient"; import { GuardDutyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GuardDutyClient, - input: ListIPSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIPSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIPSets( +export const paginateListIPSets: ( config: GuardDutyPaginationConfiguration, input: ListIPSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIPSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GuardDutyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GuardDuty | GuardDutyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GuardDutyPaginationConfiguration, + ListIPSetsCommandInput, + ListIPSetsCommandOutput +>(GuardDutyClient, ListIPSetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-guardduty/src/pagination/ListInvitationsPaginator.ts b/clients/client-guardduty/src/pagination/ListInvitationsPaginator.ts index 34412422c13b..e8547624116f 100644 --- a/clients/client-guardduty/src/pagination/ListInvitationsPaginator.ts +++ b/clients/client-guardduty/src/pagination/ListInvitationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GuardDutyClient } from "../GuardDutyClient"; import { GuardDutyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GuardDutyClient, - input: ListInvitationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInvitationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInvitations( +export const paginateListInvitations: ( config: GuardDutyPaginationConfiguration, input: ListInvitationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInvitationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GuardDutyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GuardDuty | GuardDutyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GuardDutyPaginationConfiguration, + ListInvitationsCommandInput, + ListInvitationsCommandOutput +>(GuardDutyClient, ListInvitationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-guardduty/src/pagination/ListMembersPaginator.ts b/clients/client-guardduty/src/pagination/ListMembersPaginator.ts index 4aac84217442..1c562f0922f3 100644 --- a/clients/client-guardduty/src/pagination/ListMembersPaginator.ts +++ b/clients/client-guardduty/src/pagination/ListMembersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListMembersCommand, ListMembersCommandInput, ListMembersCommandOutput } from "../commands/ListMembersCommand"; import { GuardDutyClient } from "../GuardDutyClient"; import { GuardDutyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GuardDutyClient, - input: ListMembersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMembersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMembers( +export const paginateListMembers: ( config: GuardDutyPaginationConfiguration, input: ListMembersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMembersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GuardDutyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GuardDuty | GuardDutyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GuardDutyPaginationConfiguration, + ListMembersCommandInput, + ListMembersCommandOutput +>(GuardDutyClient, ListMembersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-guardduty/src/pagination/ListOrganizationAdminAccountsPaginator.ts b/clients/client-guardduty/src/pagination/ListOrganizationAdminAccountsPaginator.ts index ca61f804ab3f..b4b2bc4696ce 100644 --- a/clients/client-guardduty/src/pagination/ListOrganizationAdminAccountsPaginator.ts +++ b/clients/client-guardduty/src/pagination/ListOrganizationAdminAccountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GuardDutyClient } from "../GuardDutyClient"; import { GuardDutyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GuardDutyClient, - input: ListOrganizationAdminAccountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOrganizationAdminAccountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOrganizationAdminAccounts( +export const paginateListOrganizationAdminAccounts: ( config: GuardDutyPaginationConfiguration, input: ListOrganizationAdminAccountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOrganizationAdminAccountsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GuardDutyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GuardDuty | GuardDutyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GuardDutyPaginationConfiguration, + ListOrganizationAdminAccountsCommandInput, + ListOrganizationAdminAccountsCommandOutput +>(GuardDutyClient, ListOrganizationAdminAccountsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-guardduty/src/pagination/ListPublishingDestinationsPaginator.ts b/clients/client-guardduty/src/pagination/ListPublishingDestinationsPaginator.ts index b35438a33428..3a0ed8bfb247 100644 --- a/clients/client-guardduty/src/pagination/ListPublishingDestinationsPaginator.ts +++ b/clients/client-guardduty/src/pagination/ListPublishingDestinationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GuardDutyClient } from "../GuardDutyClient"; import { GuardDutyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GuardDutyClient, - input: ListPublishingDestinationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPublishingDestinationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPublishingDestinations( +export const paginateListPublishingDestinations: ( config: GuardDutyPaginationConfiguration, input: ListPublishingDestinationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPublishingDestinationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GuardDutyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GuardDuty | GuardDutyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GuardDutyPaginationConfiguration, + ListPublishingDestinationsCommandInput, + ListPublishingDestinationsCommandOutput +>(GuardDutyClient, ListPublishingDestinationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-guardduty/src/pagination/ListThreatIntelSetsPaginator.ts b/clients/client-guardduty/src/pagination/ListThreatIntelSetsPaginator.ts index 9bf62b2bcc44..65bc2afe24db 100644 --- a/clients/client-guardduty/src/pagination/ListThreatIntelSetsPaginator.ts +++ b/clients/client-guardduty/src/pagination/ListThreatIntelSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { GuardDutyClient } from "../GuardDutyClient"; import { GuardDutyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: GuardDutyClient, - input: ListThreatIntelSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThreatIntelSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThreatIntelSets( +export const paginateListThreatIntelSets: ( config: GuardDutyPaginationConfiguration, input: ListThreatIntelSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThreatIntelSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof GuardDutyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected GuardDuty | GuardDutyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + GuardDutyPaginationConfiguration, + ListThreatIntelSetsCommandInput, + ListThreatIntelSetsCommandOutput +>(GuardDutyClient, ListThreatIntelSetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-health/package.json b/clients/client-health/package.json index f63e797e4843..0ca5ac219c80 100644 --- a/clients/client-health/package.json +++ b/clients/client-health/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-health/src/pagination/DescribeAffectedAccountsForOrganizationPaginator.ts b/clients/client-health/src/pagination/DescribeAffectedAccountsForOrganizationPaginator.ts index 8902291028cc..cc6e99349bd8 100644 --- a/clients/client-health/src/pagination/DescribeAffectedAccountsForOrganizationPaginator.ts +++ b/clients/client-health/src/pagination/DescribeAffectedAccountsForOrganizationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { HealthClient } from "../HealthClient"; import { HealthPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: HealthClient, - input: DescribeAffectedAccountsForOrganizationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAffectedAccountsForOrganizationCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAffectedAccountsForOrganization( +export const paginateDescribeAffectedAccountsForOrganization: ( config: HealthPaginationConfiguration, input: DescribeAffectedAccountsForOrganizationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAffectedAccountsForOrganizationCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof HealthClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Health | HealthClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + HealthPaginationConfiguration, + DescribeAffectedAccountsForOrganizationCommandInput, + DescribeAffectedAccountsForOrganizationCommandOutput +>(HealthClient, DescribeAffectedAccountsForOrganizationCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-health/src/pagination/DescribeAffectedEntitiesForOrganizationPaginator.ts b/clients/client-health/src/pagination/DescribeAffectedEntitiesForOrganizationPaginator.ts index e1b430d9f84e..281a2a80c279 100644 --- a/clients/client-health/src/pagination/DescribeAffectedEntitiesForOrganizationPaginator.ts +++ b/clients/client-health/src/pagination/DescribeAffectedEntitiesForOrganizationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { HealthClient } from "../HealthClient"; import { HealthPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: HealthClient, - input: DescribeAffectedEntitiesForOrganizationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAffectedEntitiesForOrganizationCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAffectedEntitiesForOrganization( +export const paginateDescribeAffectedEntitiesForOrganization: ( config: HealthPaginationConfiguration, input: DescribeAffectedEntitiesForOrganizationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAffectedEntitiesForOrganizationCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof HealthClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Health | HealthClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + HealthPaginationConfiguration, + DescribeAffectedEntitiesForOrganizationCommandInput, + DescribeAffectedEntitiesForOrganizationCommandOutput +>(HealthClient, DescribeAffectedEntitiesForOrganizationCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-health/src/pagination/DescribeAffectedEntitiesPaginator.ts b/clients/client-health/src/pagination/DescribeAffectedEntitiesPaginator.ts index bdc7fd7ce3cb..0f35e4f8abe0 100644 --- a/clients/client-health/src/pagination/DescribeAffectedEntitiesPaginator.ts +++ b/clients/client-health/src/pagination/DescribeAffectedEntitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { HealthClient } from "../HealthClient"; import { HealthPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: HealthClient, - input: DescribeAffectedEntitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAffectedEntitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAffectedEntities( +export const paginateDescribeAffectedEntities: ( config: HealthPaginationConfiguration, input: DescribeAffectedEntitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAffectedEntitiesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof HealthClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Health | HealthClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + HealthPaginationConfiguration, + DescribeAffectedEntitiesCommandInput, + DescribeAffectedEntitiesCommandOutput +>(HealthClient, DescribeAffectedEntitiesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-health/src/pagination/DescribeEventAggregatesPaginator.ts b/clients/client-health/src/pagination/DescribeEventAggregatesPaginator.ts index 6ace50da5090..f0acc09a5258 100644 --- a/clients/client-health/src/pagination/DescribeEventAggregatesPaginator.ts +++ b/clients/client-health/src/pagination/DescribeEventAggregatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { HealthClient } from "../HealthClient"; import { HealthPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: HealthClient, - input: DescribeEventAggregatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventAggregatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEventAggregates( +export const paginateDescribeEventAggregates: ( config: HealthPaginationConfiguration, input: DescribeEventAggregatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventAggregatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof HealthClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Health | HealthClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + HealthPaginationConfiguration, + DescribeEventAggregatesCommandInput, + DescribeEventAggregatesCommandOutput +>(HealthClient, DescribeEventAggregatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-health/src/pagination/DescribeEventTypesPaginator.ts b/clients/client-health/src/pagination/DescribeEventTypesPaginator.ts index 17675e7c35d2..d232b05b8ca7 100644 --- a/clients/client-health/src/pagination/DescribeEventTypesPaginator.ts +++ b/clients/client-health/src/pagination/DescribeEventTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { HealthClient } from "../HealthClient"; import { HealthPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: HealthClient, - input: DescribeEventTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEventTypes( +export const paginateDescribeEventTypes: ( config: HealthPaginationConfiguration, input: DescribeEventTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventTypesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof HealthClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Health | HealthClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + HealthPaginationConfiguration, + DescribeEventTypesCommandInput, + DescribeEventTypesCommandOutput +>(HealthClient, DescribeEventTypesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-health/src/pagination/DescribeEventsForOrganizationPaginator.ts b/clients/client-health/src/pagination/DescribeEventsForOrganizationPaginator.ts index 479d5f26f5db..4ee089159450 100644 --- a/clients/client-health/src/pagination/DescribeEventsForOrganizationPaginator.ts +++ b/clients/client-health/src/pagination/DescribeEventsForOrganizationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { HealthClient } from "../HealthClient"; import { HealthPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: HealthClient, - input: DescribeEventsForOrganizationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventsForOrganizationCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEventsForOrganization( +export const paginateDescribeEventsForOrganization: ( config: HealthPaginationConfiguration, input: DescribeEventsForOrganizationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventsForOrganizationCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof HealthClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Health | HealthClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + HealthPaginationConfiguration, + DescribeEventsForOrganizationCommandInput, + DescribeEventsForOrganizationCommandOutput +>(HealthClient, DescribeEventsForOrganizationCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-health/src/pagination/DescribeEventsPaginator.ts b/clients/client-health/src/pagination/DescribeEventsPaginator.ts index fc3551bfc3be..bf1911ac575d 100644 --- a/clients/client-health/src/pagination/DescribeEventsPaginator.ts +++ b/clients/client-health/src/pagination/DescribeEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { HealthClient } from "../HealthClient"; import { HealthPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: HealthClient, - input: DescribeEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEvents( +export const paginateDescribeEvents: ( config: HealthPaginationConfiguration, input: DescribeEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof HealthClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Health | HealthClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + HealthPaginationConfiguration, + DescribeEventsCommandInput, + DescribeEventsCommandOutput +>(HealthClient, DescribeEventsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-healthlake/package.json b/clients/client-healthlake/package.json index b4ec7e09cedb..712247d2a83b 100644 --- a/clients/client-healthlake/package.json +++ b/clients/client-healthlake/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-healthlake/src/pagination/ListFHIRDatastoresPaginator.ts b/clients/client-healthlake/src/pagination/ListFHIRDatastoresPaginator.ts index 33f897e3e875..612e31fa413d 100644 --- a/clients/client-healthlake/src/pagination/ListFHIRDatastoresPaginator.ts +++ b/clients/client-healthlake/src/pagination/ListFHIRDatastoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { HealthLakeClient } from "../HealthLakeClient"; import { HealthLakePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: HealthLakeClient, - input: ListFHIRDatastoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFHIRDatastoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFHIRDatastores( +export const paginateListFHIRDatastores: ( config: HealthLakePaginationConfiguration, input: ListFHIRDatastoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFHIRDatastoresCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof HealthLakeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected HealthLake | HealthLakeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + HealthLakePaginationConfiguration, + ListFHIRDatastoresCommandInput, + ListFHIRDatastoresCommandOutput +>(HealthLakeClient, ListFHIRDatastoresCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-healthlake/src/pagination/ListFHIRExportJobsPaginator.ts b/clients/client-healthlake/src/pagination/ListFHIRExportJobsPaginator.ts index aa3427e59ef3..2c6947214565 100644 --- a/clients/client-healthlake/src/pagination/ListFHIRExportJobsPaginator.ts +++ b/clients/client-healthlake/src/pagination/ListFHIRExportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { HealthLakeClient } from "../HealthLakeClient"; import { HealthLakePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: HealthLakeClient, - input: ListFHIRExportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFHIRExportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFHIRExportJobs( +export const paginateListFHIRExportJobs: ( config: HealthLakePaginationConfiguration, input: ListFHIRExportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFHIRExportJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof HealthLakeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected HealthLake | HealthLakeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + HealthLakePaginationConfiguration, + ListFHIRExportJobsCommandInput, + ListFHIRExportJobsCommandOutput +>(HealthLakeClient, ListFHIRExportJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-healthlake/src/pagination/ListFHIRImportJobsPaginator.ts b/clients/client-healthlake/src/pagination/ListFHIRImportJobsPaginator.ts index ef2ad0ca01ca..f5a8e64ee9ab 100644 --- a/clients/client-healthlake/src/pagination/ListFHIRImportJobsPaginator.ts +++ b/clients/client-healthlake/src/pagination/ListFHIRImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { HealthLakeClient } from "../HealthLakeClient"; import { HealthLakePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: HealthLakeClient, - input: ListFHIRImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFHIRImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFHIRImportJobs( +export const paginateListFHIRImportJobs: ( config: HealthLakePaginationConfiguration, input: ListFHIRImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFHIRImportJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof HealthLakeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected HealthLake | HealthLakeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + HealthLakePaginationConfiguration, + ListFHIRImportJobsCommandInput, + ListFHIRImportJobsCommandOutput +>(HealthLakeClient, ListFHIRImportJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-honeycode/src/pagination/ListTableColumnsPaginator.ts b/clients/client-honeycode/src/pagination/ListTableColumnsPaginator.ts index d33b7ae7b5c4..ab8ce77be724 100644 --- a/clients/client-honeycode/src/pagination/ListTableColumnsPaginator.ts +++ b/clients/client-honeycode/src/pagination/ListTableColumnsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { HoneycodeClient } from "../HoneycodeClient"; import { HoneycodePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: HoneycodeClient, - input: ListTableColumnsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTableColumnsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTableColumns( +export const paginateListTableColumns: ( config: HoneycodePaginationConfiguration, input: ListTableColumnsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTableColumnsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof HoneycodeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Honeycode | HoneycodeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + HoneycodePaginationConfiguration, + ListTableColumnsCommandInput, + ListTableColumnsCommandOutput +>(HoneycodeClient, ListTableColumnsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-honeycode/src/pagination/ListTableRowsPaginator.ts b/clients/client-honeycode/src/pagination/ListTableRowsPaginator.ts index 49936f7d992f..bcaa8eadc6a2 100644 --- a/clients/client-honeycode/src/pagination/ListTableRowsPaginator.ts +++ b/clients/client-honeycode/src/pagination/ListTableRowsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { HoneycodeClient } from "../HoneycodeClient"; import { HoneycodePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: HoneycodeClient, - input: ListTableRowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTableRowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTableRows( +export const paginateListTableRows: ( config: HoneycodePaginationConfiguration, input: ListTableRowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTableRowsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof HoneycodeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Honeycode | HoneycodeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + HoneycodePaginationConfiguration, + ListTableRowsCommandInput, + ListTableRowsCommandOutput +>(HoneycodeClient, ListTableRowsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-honeycode/src/pagination/ListTablesPaginator.ts b/clients/client-honeycode/src/pagination/ListTablesPaginator.ts index 345ff4712bdc..da9186287659 100644 --- a/clients/client-honeycode/src/pagination/ListTablesPaginator.ts +++ b/clients/client-honeycode/src/pagination/ListTablesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTablesCommand, ListTablesCommandInput, ListTablesCommandOutput } from "../commands/ListTablesCommand"; import { HoneycodeClient } from "../HoneycodeClient"; import { HoneycodePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: HoneycodeClient, - input: ListTablesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTablesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTables( +export const paginateListTables: ( config: HoneycodePaginationConfiguration, input: ListTablesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTablesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof HoneycodeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Honeycode | HoneycodeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + HoneycodePaginationConfiguration, + ListTablesCommandInput, + ListTablesCommandOutput +>(HoneycodeClient, ListTablesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-honeycode/src/pagination/QueryTableRowsPaginator.ts b/clients/client-honeycode/src/pagination/QueryTableRowsPaginator.ts index 466cae2ce5fc..d0b3dc9fa451 100644 --- a/clients/client-honeycode/src/pagination/QueryTableRowsPaginator.ts +++ b/clients/client-honeycode/src/pagination/QueryTableRowsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { HoneycodeClient } from "../HoneycodeClient"; import { HoneycodePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: HoneycodeClient, - input: QueryTableRowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new QueryTableRowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateQueryTableRows( +export const paginateQueryTableRows: ( config: HoneycodePaginationConfiguration, input: QueryTableRowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: QueryTableRowsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof HoneycodeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Honeycode | HoneycodeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + HoneycodePaginationConfiguration, + QueryTableRowsCommandInput, + QueryTableRowsCommandOutput +>(HoneycodeClient, QueryTableRowsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iam/package.json b/clients/client-iam/package.json index 27a89c9e3bd0..957f075aa37b 100644 --- a/clients/client-iam/package.json +++ b/clients/client-iam/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-iam/src/pagination/GetAccountAuthorizationDetailsPaginator.ts b/clients/client-iam/src/pagination/GetAccountAuthorizationDetailsPaginator.ts index f8f3358481ae..82849194ba13 100644 --- a/clients/client-iam/src/pagination/GetAccountAuthorizationDetailsPaginator.ts +++ b/clients/client-iam/src/pagination/GetAccountAuthorizationDetailsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: GetAccountAuthorizationDetailsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetAccountAuthorizationDetailsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetAccountAuthorizationDetails( +export const paginateGetAccountAuthorizationDetails: ( config: IAMPaginationConfiguration, input: GetAccountAuthorizationDetailsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetAccountAuthorizationDetailsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + GetAccountAuthorizationDetailsCommandInput, + GetAccountAuthorizationDetailsCommandOutput +>(IAMClient, GetAccountAuthorizationDetailsCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/GetGroupPaginator.ts b/clients/client-iam/src/pagination/GetGroupPaginator.ts index 0db4ef309aa8..8d0eb46372fc 100644 --- a/clients/client-iam/src/pagination/GetGroupPaginator.ts +++ b/clients/client-iam/src/pagination/GetGroupPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetGroupCommand, GetGroupCommandInput, GetGroupCommandOutput } from "../commands/GetGroupCommand"; import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: GetGroupCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetGroupCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetGroup( +export const paginateGetGroup: ( config: IAMPaginationConfiguration, input: GetGroupCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetGroupCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + GetGroupCommandInput, + GetGroupCommandOutput +>(IAMClient, GetGroupCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListAccessKeysPaginator.ts b/clients/client-iam/src/pagination/ListAccessKeysPaginator.ts index c22f79f352cb..b3ac52a01d57 100644 --- a/clients/client-iam/src/pagination/ListAccessKeysPaginator.ts +++ b/clients/client-iam/src/pagination/ListAccessKeysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListAccessKeysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessKeysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessKeys( +export const paginateListAccessKeys: ( config: IAMPaginationConfiguration, input: ListAccessKeysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessKeysCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListAccessKeysCommandInput, + ListAccessKeysCommandOutput +>(IAMClient, ListAccessKeysCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListAccountAliasesPaginator.ts b/clients/client-iam/src/pagination/ListAccountAliasesPaginator.ts index 18fd76f12039..70e178e79d8c 100644 --- a/clients/client-iam/src/pagination/ListAccountAliasesPaginator.ts +++ b/clients/client-iam/src/pagination/ListAccountAliasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListAccountAliasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccountAliasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccountAliases( +export const paginateListAccountAliases: ( config: IAMPaginationConfiguration, input: ListAccountAliasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccountAliasesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListAccountAliasesCommandInput, + ListAccountAliasesCommandOutput +>(IAMClient, ListAccountAliasesCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListAttachedGroupPoliciesPaginator.ts b/clients/client-iam/src/pagination/ListAttachedGroupPoliciesPaginator.ts index f09a98e3622a..a501c8d4fae0 100644 --- a/clients/client-iam/src/pagination/ListAttachedGroupPoliciesPaginator.ts +++ b/clients/client-iam/src/pagination/ListAttachedGroupPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListAttachedGroupPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAttachedGroupPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAttachedGroupPolicies( +export const paginateListAttachedGroupPolicies: ( config: IAMPaginationConfiguration, input: ListAttachedGroupPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAttachedGroupPoliciesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListAttachedGroupPoliciesCommandInput, + ListAttachedGroupPoliciesCommandOutput +>(IAMClient, ListAttachedGroupPoliciesCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListAttachedRolePoliciesPaginator.ts b/clients/client-iam/src/pagination/ListAttachedRolePoliciesPaginator.ts index 4dd023aa649f..f5fb83ac286f 100644 --- a/clients/client-iam/src/pagination/ListAttachedRolePoliciesPaginator.ts +++ b/clients/client-iam/src/pagination/ListAttachedRolePoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListAttachedRolePoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAttachedRolePoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAttachedRolePolicies( +export const paginateListAttachedRolePolicies: ( config: IAMPaginationConfiguration, input: ListAttachedRolePoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAttachedRolePoliciesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListAttachedRolePoliciesCommandInput, + ListAttachedRolePoliciesCommandOutput +>(IAMClient, ListAttachedRolePoliciesCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListAttachedUserPoliciesPaginator.ts b/clients/client-iam/src/pagination/ListAttachedUserPoliciesPaginator.ts index cd01118c721a..b4dba3f4111f 100644 --- a/clients/client-iam/src/pagination/ListAttachedUserPoliciesPaginator.ts +++ b/clients/client-iam/src/pagination/ListAttachedUserPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListAttachedUserPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAttachedUserPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAttachedUserPolicies( +export const paginateListAttachedUserPolicies: ( config: IAMPaginationConfiguration, input: ListAttachedUserPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAttachedUserPoliciesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListAttachedUserPoliciesCommandInput, + ListAttachedUserPoliciesCommandOutput +>(IAMClient, ListAttachedUserPoliciesCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListEntitiesForPolicyPaginator.ts b/clients/client-iam/src/pagination/ListEntitiesForPolicyPaginator.ts index c418f3634f3f..4a5ddd20f9fd 100644 --- a/clients/client-iam/src/pagination/ListEntitiesForPolicyPaginator.ts +++ b/clients/client-iam/src/pagination/ListEntitiesForPolicyPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListEntitiesForPolicyCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEntitiesForPolicyCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEntitiesForPolicy( +export const paginateListEntitiesForPolicy: ( config: IAMPaginationConfiguration, input: ListEntitiesForPolicyCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEntitiesForPolicyCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListEntitiesForPolicyCommandInput, + ListEntitiesForPolicyCommandOutput +>(IAMClient, ListEntitiesForPolicyCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListGroupPoliciesPaginator.ts b/clients/client-iam/src/pagination/ListGroupPoliciesPaginator.ts index 80639ad6d865..20ba0e5816c7 100644 --- a/clients/client-iam/src/pagination/ListGroupPoliciesPaginator.ts +++ b/clients/client-iam/src/pagination/ListGroupPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListGroupPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroupPolicies( +export const paginateListGroupPolicies: ( config: IAMPaginationConfiguration, input: ListGroupPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupPoliciesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListGroupPoliciesCommandInput, + ListGroupPoliciesCommandOutput +>(IAMClient, ListGroupPoliciesCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListGroupsForUserPaginator.ts b/clients/client-iam/src/pagination/ListGroupsForUserPaginator.ts index ef78e0eaf443..32d8be82304d 100644 --- a/clients/client-iam/src/pagination/ListGroupsForUserPaginator.ts +++ b/clients/client-iam/src/pagination/ListGroupsForUserPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListGroupsForUserCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupsForUserCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroupsForUser( +export const paginateListGroupsForUser: ( config: IAMPaginationConfiguration, input: ListGroupsForUserCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupsForUserCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListGroupsForUserCommandInput, + ListGroupsForUserCommandOutput +>(IAMClient, ListGroupsForUserCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListGroupsPaginator.ts b/clients/client-iam/src/pagination/ListGroupsPaginator.ts index c02a3f2b785e..c056200bd8a3 100644 --- a/clients/client-iam/src/pagination/ListGroupsPaginator.ts +++ b/clients/client-iam/src/pagination/ListGroupsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListGroupsCommand, ListGroupsCommandInput, ListGroupsCommandOutput } from "../commands/ListGroupsCommand"; import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroups( +export const paginateListGroups: ( config: IAMPaginationConfiguration, input: ListGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListGroupsCommandInput, + ListGroupsCommandOutput +>(IAMClient, ListGroupsCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListInstanceProfileTagsPaginator.ts b/clients/client-iam/src/pagination/ListInstanceProfileTagsPaginator.ts index 20c16735318a..02fbfb9e3657 100644 --- a/clients/client-iam/src/pagination/ListInstanceProfileTagsPaginator.ts +++ b/clients/client-iam/src/pagination/ListInstanceProfileTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListInstanceProfileTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInstanceProfileTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInstanceProfileTags( +export const paginateListInstanceProfileTags: ( config: IAMPaginationConfiguration, input: ListInstanceProfileTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInstanceProfileTagsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListInstanceProfileTagsCommandInput, + ListInstanceProfileTagsCommandOutput +>(IAMClient, ListInstanceProfileTagsCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListInstanceProfilesForRolePaginator.ts b/clients/client-iam/src/pagination/ListInstanceProfilesForRolePaginator.ts index b160616ead82..b0eb22064a04 100644 --- a/clients/client-iam/src/pagination/ListInstanceProfilesForRolePaginator.ts +++ b/clients/client-iam/src/pagination/ListInstanceProfilesForRolePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListInstanceProfilesForRoleCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInstanceProfilesForRoleCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInstanceProfilesForRole( +export const paginateListInstanceProfilesForRole: ( config: IAMPaginationConfiguration, input: ListInstanceProfilesForRoleCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInstanceProfilesForRoleCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListInstanceProfilesForRoleCommandInput, + ListInstanceProfilesForRoleCommandOutput +>(IAMClient, ListInstanceProfilesForRoleCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListInstanceProfilesPaginator.ts b/clients/client-iam/src/pagination/ListInstanceProfilesPaginator.ts index a0e83c92f5b5..585ca4a35983 100644 --- a/clients/client-iam/src/pagination/ListInstanceProfilesPaginator.ts +++ b/clients/client-iam/src/pagination/ListInstanceProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListInstanceProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInstanceProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInstanceProfiles( +export const paginateListInstanceProfiles: ( config: IAMPaginationConfiguration, input: ListInstanceProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInstanceProfilesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListInstanceProfilesCommandInput, + ListInstanceProfilesCommandOutput +>(IAMClient, ListInstanceProfilesCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListMFADeviceTagsPaginator.ts b/clients/client-iam/src/pagination/ListMFADeviceTagsPaginator.ts index e8893ed79051..77ac7757a17c 100644 --- a/clients/client-iam/src/pagination/ListMFADeviceTagsPaginator.ts +++ b/clients/client-iam/src/pagination/ListMFADeviceTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListMFADeviceTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMFADeviceTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMFADeviceTags( +export const paginateListMFADeviceTags: ( config: IAMPaginationConfiguration, input: ListMFADeviceTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMFADeviceTagsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListMFADeviceTagsCommandInput, + ListMFADeviceTagsCommandOutput +>(IAMClient, ListMFADeviceTagsCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListMFADevicesPaginator.ts b/clients/client-iam/src/pagination/ListMFADevicesPaginator.ts index 5cb65e8396ad..af37c8fd1594 100644 --- a/clients/client-iam/src/pagination/ListMFADevicesPaginator.ts +++ b/clients/client-iam/src/pagination/ListMFADevicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListMFADevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMFADevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMFADevices( +export const paginateListMFADevices: ( config: IAMPaginationConfiguration, input: ListMFADevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMFADevicesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListMFADevicesCommandInput, + ListMFADevicesCommandOutput +>(IAMClient, ListMFADevicesCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListOpenIDConnectProviderTagsPaginator.ts b/clients/client-iam/src/pagination/ListOpenIDConnectProviderTagsPaginator.ts index 83f535f6ed4b..b043bf5c7037 100644 --- a/clients/client-iam/src/pagination/ListOpenIDConnectProviderTagsPaginator.ts +++ b/clients/client-iam/src/pagination/ListOpenIDConnectProviderTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListOpenIDConnectProviderTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOpenIDConnectProviderTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOpenIDConnectProviderTags( +export const paginateListOpenIDConnectProviderTags: ( config: IAMPaginationConfiguration, input: ListOpenIDConnectProviderTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOpenIDConnectProviderTagsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListOpenIDConnectProviderTagsCommandInput, + ListOpenIDConnectProviderTagsCommandOutput +>(IAMClient, ListOpenIDConnectProviderTagsCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListPoliciesPaginator.ts b/clients/client-iam/src/pagination/ListPoliciesPaginator.ts index 0f89cec49972..4f8a55f7a12b 100644 --- a/clients/client-iam/src/pagination/ListPoliciesPaginator.ts +++ b/clients/client-iam/src/pagination/ListPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPolicies( +export const paginateListPolicies: ( config: IAMPaginationConfiguration, input: ListPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPoliciesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListPoliciesCommandInput, + ListPoliciesCommandOutput +>(IAMClient, ListPoliciesCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListPolicyTagsPaginator.ts b/clients/client-iam/src/pagination/ListPolicyTagsPaginator.ts index 2a985f3c59d0..19e3e96c0c2c 100644 --- a/clients/client-iam/src/pagination/ListPolicyTagsPaginator.ts +++ b/clients/client-iam/src/pagination/ListPolicyTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListPolicyTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPolicyTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPolicyTags( +export const paginateListPolicyTags: ( config: IAMPaginationConfiguration, input: ListPolicyTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPolicyTagsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListPolicyTagsCommandInput, + ListPolicyTagsCommandOutput +>(IAMClient, ListPolicyTagsCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListPolicyVersionsPaginator.ts b/clients/client-iam/src/pagination/ListPolicyVersionsPaginator.ts index 72214d979c40..7b69d37df8b1 100644 --- a/clients/client-iam/src/pagination/ListPolicyVersionsPaginator.ts +++ b/clients/client-iam/src/pagination/ListPolicyVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListPolicyVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPolicyVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPolicyVersions( +export const paginateListPolicyVersions: ( config: IAMPaginationConfiguration, input: ListPolicyVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPolicyVersionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListPolicyVersionsCommandInput, + ListPolicyVersionsCommandOutput +>(IAMClient, ListPolicyVersionsCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListRolePoliciesPaginator.ts b/clients/client-iam/src/pagination/ListRolePoliciesPaginator.ts index fcb65eca158a..872b7d48ade8 100644 --- a/clients/client-iam/src/pagination/ListRolePoliciesPaginator.ts +++ b/clients/client-iam/src/pagination/ListRolePoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListRolePoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRolePoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRolePolicies( +export const paginateListRolePolicies: ( config: IAMPaginationConfiguration, input: ListRolePoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRolePoliciesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListRolePoliciesCommandInput, + ListRolePoliciesCommandOutput +>(IAMClient, ListRolePoliciesCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListRoleTagsPaginator.ts b/clients/client-iam/src/pagination/ListRoleTagsPaginator.ts index 9a63184ad19d..8ee743d42834 100644 --- a/clients/client-iam/src/pagination/ListRoleTagsPaginator.ts +++ b/clients/client-iam/src/pagination/ListRoleTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListRoleTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRoleTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRoleTags( +export const paginateListRoleTags: ( config: IAMPaginationConfiguration, input: ListRoleTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRoleTagsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListRoleTagsCommandInput, + ListRoleTagsCommandOutput +>(IAMClient, ListRoleTagsCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListRolesPaginator.ts b/clients/client-iam/src/pagination/ListRolesPaginator.ts index da328126dbfa..2d19296ca4d7 100644 --- a/clients/client-iam/src/pagination/ListRolesPaginator.ts +++ b/clients/client-iam/src/pagination/ListRolesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListRolesCommand, ListRolesCommandInput, ListRolesCommandOutput } from "../commands/ListRolesCommand"; import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListRolesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRolesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRoles( +export const paginateListRoles: ( config: IAMPaginationConfiguration, input: ListRolesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRolesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListRolesCommandInput, + ListRolesCommandOutput +>(IAMClient, ListRolesCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListSAMLProviderTagsPaginator.ts b/clients/client-iam/src/pagination/ListSAMLProviderTagsPaginator.ts index ec6a1373e640..a7d0463e146c 100644 --- a/clients/client-iam/src/pagination/ListSAMLProviderTagsPaginator.ts +++ b/clients/client-iam/src/pagination/ListSAMLProviderTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListSAMLProviderTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSAMLProviderTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSAMLProviderTags( +export const paginateListSAMLProviderTags: ( config: IAMPaginationConfiguration, input: ListSAMLProviderTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSAMLProviderTagsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListSAMLProviderTagsCommandInput, + ListSAMLProviderTagsCommandOutput +>(IAMClient, ListSAMLProviderTagsCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListSSHPublicKeysPaginator.ts b/clients/client-iam/src/pagination/ListSSHPublicKeysPaginator.ts index 1d332f22fc3b..2641e57d8470 100644 --- a/clients/client-iam/src/pagination/ListSSHPublicKeysPaginator.ts +++ b/clients/client-iam/src/pagination/ListSSHPublicKeysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListSSHPublicKeysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSSHPublicKeysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSSHPublicKeys( +export const paginateListSSHPublicKeys: ( config: IAMPaginationConfiguration, input: ListSSHPublicKeysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSSHPublicKeysCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListSSHPublicKeysCommandInput, + ListSSHPublicKeysCommandOutput +>(IAMClient, ListSSHPublicKeysCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListServerCertificateTagsPaginator.ts b/clients/client-iam/src/pagination/ListServerCertificateTagsPaginator.ts index d659da46077c..df07ecba0ff1 100644 --- a/clients/client-iam/src/pagination/ListServerCertificateTagsPaginator.ts +++ b/clients/client-iam/src/pagination/ListServerCertificateTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListServerCertificateTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServerCertificateTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServerCertificateTags( +export const paginateListServerCertificateTags: ( config: IAMPaginationConfiguration, input: ListServerCertificateTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServerCertificateTagsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListServerCertificateTagsCommandInput, + ListServerCertificateTagsCommandOutput +>(IAMClient, ListServerCertificateTagsCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListServerCertificatesPaginator.ts b/clients/client-iam/src/pagination/ListServerCertificatesPaginator.ts index f7a0a5a75a98..680d0bd10a3e 100644 --- a/clients/client-iam/src/pagination/ListServerCertificatesPaginator.ts +++ b/clients/client-iam/src/pagination/ListServerCertificatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListServerCertificatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServerCertificatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServerCertificates( +export const paginateListServerCertificates: ( config: IAMPaginationConfiguration, input: ListServerCertificatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServerCertificatesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListServerCertificatesCommandInput, + ListServerCertificatesCommandOutput +>(IAMClient, ListServerCertificatesCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListSigningCertificatesPaginator.ts b/clients/client-iam/src/pagination/ListSigningCertificatesPaginator.ts index 990c33a94fb6..58a8aabc5525 100644 --- a/clients/client-iam/src/pagination/ListSigningCertificatesPaginator.ts +++ b/clients/client-iam/src/pagination/ListSigningCertificatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListSigningCertificatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSigningCertificatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSigningCertificates( +export const paginateListSigningCertificates: ( config: IAMPaginationConfiguration, input: ListSigningCertificatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSigningCertificatesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListSigningCertificatesCommandInput, + ListSigningCertificatesCommandOutput +>(IAMClient, ListSigningCertificatesCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListUserPoliciesPaginator.ts b/clients/client-iam/src/pagination/ListUserPoliciesPaginator.ts index 82aabdfd98aa..3fafbf8b92b6 100644 --- a/clients/client-iam/src/pagination/ListUserPoliciesPaginator.ts +++ b/clients/client-iam/src/pagination/ListUserPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListUserPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUserPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUserPolicies( +export const paginateListUserPolicies: ( config: IAMPaginationConfiguration, input: ListUserPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUserPoliciesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListUserPoliciesCommandInput, + ListUserPoliciesCommandOutput +>(IAMClient, ListUserPoliciesCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListUserTagsPaginator.ts b/clients/client-iam/src/pagination/ListUserTagsPaginator.ts index 2cfa325105da..06a247797ff0 100644 --- a/clients/client-iam/src/pagination/ListUserTagsPaginator.ts +++ b/clients/client-iam/src/pagination/ListUserTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListUserTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUserTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUserTags( +export const paginateListUserTags: ( config: IAMPaginationConfiguration, input: ListUserTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUserTagsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListUserTagsCommandInput, + ListUserTagsCommandOutput +>(IAMClient, ListUserTagsCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListUsersPaginator.ts b/clients/client-iam/src/pagination/ListUsersPaginator.ts index 5aee3aa64e85..cf0b124057e1 100644 --- a/clients/client-iam/src/pagination/ListUsersPaginator.ts +++ b/clients/client-iam/src/pagination/ListUsersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListUsersCommand, ListUsersCommandInput, ListUsersCommandOutput } from "../commands/ListUsersCommand"; import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUsers( +export const paginateListUsers: ( config: IAMPaginationConfiguration, input: ListUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUsersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListUsersCommandInput, + ListUsersCommandOutput +>(IAMClient, ListUsersCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/ListVirtualMFADevicesPaginator.ts b/clients/client-iam/src/pagination/ListVirtualMFADevicesPaginator.ts index b9671754c244..299450e1d84e 100644 --- a/clients/client-iam/src/pagination/ListVirtualMFADevicesPaginator.ts +++ b/clients/client-iam/src/pagination/ListVirtualMFADevicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: ListVirtualMFADevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVirtualMFADevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVirtualMFADevices( +export const paginateListVirtualMFADevices: ( config: IAMPaginationConfiguration, input: ListVirtualMFADevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVirtualMFADevicesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + ListVirtualMFADevicesCommandInput, + ListVirtualMFADevicesCommandOutput +>(IAMClient, ListVirtualMFADevicesCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/SimulateCustomPolicyPaginator.ts b/clients/client-iam/src/pagination/SimulateCustomPolicyPaginator.ts index af3aa6eca3a9..68e1bbce747a 100644 --- a/clients/client-iam/src/pagination/SimulateCustomPolicyPaginator.ts +++ b/clients/client-iam/src/pagination/SimulateCustomPolicyPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: SimulateCustomPolicyCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SimulateCustomPolicyCommand(input), ...args); -}; /** * @public */ -export async function* paginateSimulateCustomPolicy( +export const paginateSimulateCustomPolicy: ( config: IAMPaginationConfiguration, input: SimulateCustomPolicyCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SimulateCustomPolicyCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + SimulateCustomPolicyCommandInput, + SimulateCustomPolicyCommandOutput +>(IAMClient, SimulateCustomPolicyCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-iam/src/pagination/SimulatePrincipalPolicyPaginator.ts b/clients/client-iam/src/pagination/SimulatePrincipalPolicyPaginator.ts index 9b1f7313fd16..3e7b2547cf9c 100644 --- a/clients/client-iam/src/pagination/SimulatePrincipalPolicyPaginator.ts +++ b/clients/client-iam/src/pagination/SimulatePrincipalPolicyPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IAMClient } from "../IAMClient"; import { IAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IAMClient, - input: SimulatePrincipalPolicyCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SimulatePrincipalPolicyCommand(input), ...args); -}; /** * @public */ -export async function* paginateSimulatePrincipalPolicy( +export const paginateSimulatePrincipalPolicy: ( config: IAMPaginationConfiguration, input: SimulatePrincipalPolicyCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SimulatePrincipalPolicyCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof IAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IAM | IAMClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IAMPaginationConfiguration, + SimulatePrincipalPolicyCommandInput, + SimulatePrincipalPolicyCommandOutput +>(IAMClient, SimulatePrincipalPolicyCommand, "Marker", "Marker", "MaxItems"); diff --git a/clients/client-identitystore/package.json b/clients/client-identitystore/package.json index 1d4e446f126c..9f9f565ff2ac 100644 --- a/clients/client-identitystore/package.json +++ b/clients/client-identitystore/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-identitystore/src/pagination/ListGroupMembershipsForMemberPaginator.ts b/clients/client-identitystore/src/pagination/ListGroupMembershipsForMemberPaginator.ts index 62a3b0918ab6..2b4faf19e59f 100644 --- a/clients/client-identitystore/src/pagination/ListGroupMembershipsForMemberPaginator.ts +++ b/clients/client-identitystore/src/pagination/ListGroupMembershipsForMemberPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IdentitystoreClient } from "../IdentitystoreClient"; import { IdentitystorePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IdentitystoreClient, - input: ListGroupMembershipsForMemberCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupMembershipsForMemberCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroupMembershipsForMember( +export const paginateListGroupMembershipsForMember: ( config: IdentitystorePaginationConfiguration, input: ListGroupMembershipsForMemberCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupMembershipsForMemberCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IdentitystoreClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Identitystore | IdentitystoreClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IdentitystorePaginationConfiguration, + ListGroupMembershipsForMemberCommandInput, + ListGroupMembershipsForMemberCommandOutput +>(IdentitystoreClient, ListGroupMembershipsForMemberCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-identitystore/src/pagination/ListGroupMembershipsPaginator.ts b/clients/client-identitystore/src/pagination/ListGroupMembershipsPaginator.ts index e1f265b56211..bf10c5ca8c47 100644 --- a/clients/client-identitystore/src/pagination/ListGroupMembershipsPaginator.ts +++ b/clients/client-identitystore/src/pagination/ListGroupMembershipsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IdentitystoreClient } from "../IdentitystoreClient"; import { IdentitystorePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IdentitystoreClient, - input: ListGroupMembershipsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupMembershipsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroupMemberships( +export const paginateListGroupMemberships: ( config: IdentitystorePaginationConfiguration, input: ListGroupMembershipsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupMembershipsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IdentitystoreClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Identitystore | IdentitystoreClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IdentitystorePaginationConfiguration, + ListGroupMembershipsCommandInput, + ListGroupMembershipsCommandOutput +>(IdentitystoreClient, ListGroupMembershipsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-identitystore/src/pagination/ListGroupsPaginator.ts b/clients/client-identitystore/src/pagination/ListGroupsPaginator.ts index 5a54c96caa75..cd305285a32d 100644 --- a/clients/client-identitystore/src/pagination/ListGroupsPaginator.ts +++ b/clients/client-identitystore/src/pagination/ListGroupsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListGroupsCommand, ListGroupsCommandInput, ListGroupsCommandOutput } from "../commands/ListGroupsCommand"; import { IdentitystoreClient } from "../IdentitystoreClient"; import { IdentitystorePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IdentitystoreClient, - input: ListGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroups( +export const paginateListGroups: ( config: IdentitystorePaginationConfiguration, input: ListGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IdentitystoreClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Identitystore | IdentitystoreClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IdentitystorePaginationConfiguration, + ListGroupsCommandInput, + ListGroupsCommandOutput +>(IdentitystoreClient, ListGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-identitystore/src/pagination/ListUsersPaginator.ts b/clients/client-identitystore/src/pagination/ListUsersPaginator.ts index 44c6f61c4b04..5568f894dcd1 100644 --- a/clients/client-identitystore/src/pagination/ListUsersPaginator.ts +++ b/clients/client-identitystore/src/pagination/ListUsersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListUsersCommand, ListUsersCommandInput, ListUsersCommandOutput } from "../commands/ListUsersCommand"; import { IdentitystoreClient } from "../IdentitystoreClient"; import { IdentitystorePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IdentitystoreClient, - input: ListUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUsers( +export const paginateListUsers: ( config: IdentitystorePaginationConfiguration, input: ListUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUsersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IdentitystoreClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Identitystore | IdentitystoreClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IdentitystorePaginationConfiguration, + ListUsersCommandInput, + ListUsersCommandOutput +>(IdentitystoreClient, ListUsersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListComponentBuildVersionsPaginator.ts b/clients/client-imagebuilder/src/pagination/ListComponentBuildVersionsPaginator.ts index 780c00da4822..ea85433f2d01 100644 --- a/clients/client-imagebuilder/src/pagination/ListComponentBuildVersionsPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListComponentBuildVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListComponentBuildVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComponentBuildVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComponentBuildVersions( +export const paginateListComponentBuildVersions: ( config: ImagebuilderPaginationConfiguration, input: ListComponentBuildVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComponentBuildVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListComponentBuildVersionsCommandInput, + ListComponentBuildVersionsCommandOutput +>(ImagebuilderClient, ListComponentBuildVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListComponentsPaginator.ts b/clients/client-imagebuilder/src/pagination/ListComponentsPaginator.ts index 1a72a80d6508..d73c98bfa6ec 100644 --- a/clients/client-imagebuilder/src/pagination/ListComponentsPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListComponentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListComponentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComponentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComponents( +export const paginateListComponents: ( config: ImagebuilderPaginationConfiguration, input: ListComponentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComponentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListComponentsCommandInput, + ListComponentsCommandOutput +>(ImagebuilderClient, ListComponentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListContainerRecipesPaginator.ts b/clients/client-imagebuilder/src/pagination/ListContainerRecipesPaginator.ts index e67ad947adce..5fb7091e5489 100644 --- a/clients/client-imagebuilder/src/pagination/ListContainerRecipesPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListContainerRecipesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListContainerRecipesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContainerRecipesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContainerRecipes( +export const paginateListContainerRecipes: ( config: ImagebuilderPaginationConfiguration, input: ListContainerRecipesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContainerRecipesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListContainerRecipesCommandInput, + ListContainerRecipesCommandOutput +>(ImagebuilderClient, ListContainerRecipesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListDistributionConfigurationsPaginator.ts b/clients/client-imagebuilder/src/pagination/ListDistributionConfigurationsPaginator.ts index cb327529d141..161be82c6325 100644 --- a/clients/client-imagebuilder/src/pagination/ListDistributionConfigurationsPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListDistributionConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListDistributionConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDistributionConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDistributionConfigurations( +export const paginateListDistributionConfigurations: ( config: ImagebuilderPaginationConfiguration, input: ListDistributionConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDistributionConfigurationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListDistributionConfigurationsCommandInput, + ListDistributionConfigurationsCommandOutput +>(ImagebuilderClient, ListDistributionConfigurationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListImageBuildVersionsPaginator.ts b/clients/client-imagebuilder/src/pagination/ListImageBuildVersionsPaginator.ts index c37e90802d00..5e8c2cd3d8a4 100644 --- a/clients/client-imagebuilder/src/pagination/ListImageBuildVersionsPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListImageBuildVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListImageBuildVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImageBuildVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImageBuildVersions( +export const paginateListImageBuildVersions: ( config: ImagebuilderPaginationConfiguration, input: ListImageBuildVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImageBuildVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListImageBuildVersionsCommandInput, + ListImageBuildVersionsCommandOutput +>(ImagebuilderClient, ListImageBuildVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListImagePackagesPaginator.ts b/clients/client-imagebuilder/src/pagination/ListImagePackagesPaginator.ts index 367d11c2945b..e3dc52c20f54 100644 --- a/clients/client-imagebuilder/src/pagination/ListImagePackagesPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListImagePackagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListImagePackagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImagePackagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImagePackages( +export const paginateListImagePackages: ( config: ImagebuilderPaginationConfiguration, input: ListImagePackagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImagePackagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListImagePackagesCommandInput, + ListImagePackagesCommandOutput +>(ImagebuilderClient, ListImagePackagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListImagePipelineImagesPaginator.ts b/clients/client-imagebuilder/src/pagination/ListImagePipelineImagesPaginator.ts index 215c2c20e68e..aa796e457432 100644 --- a/clients/client-imagebuilder/src/pagination/ListImagePipelineImagesPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListImagePipelineImagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListImagePipelineImagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImagePipelineImagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImagePipelineImages( +export const paginateListImagePipelineImages: ( config: ImagebuilderPaginationConfiguration, input: ListImagePipelineImagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImagePipelineImagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListImagePipelineImagesCommandInput, + ListImagePipelineImagesCommandOutput +>(ImagebuilderClient, ListImagePipelineImagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListImagePipelinesPaginator.ts b/clients/client-imagebuilder/src/pagination/ListImagePipelinesPaginator.ts index 2d4be68df8bd..af5d9a739a88 100644 --- a/clients/client-imagebuilder/src/pagination/ListImagePipelinesPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListImagePipelinesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListImagePipelinesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImagePipelinesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImagePipelines( +export const paginateListImagePipelines: ( config: ImagebuilderPaginationConfiguration, input: ListImagePipelinesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImagePipelinesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListImagePipelinesCommandInput, + ListImagePipelinesCommandOutput +>(ImagebuilderClient, ListImagePipelinesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListImageRecipesPaginator.ts b/clients/client-imagebuilder/src/pagination/ListImageRecipesPaginator.ts index 01c8ebf8ee83..0174d4c71da9 100644 --- a/clients/client-imagebuilder/src/pagination/ListImageRecipesPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListImageRecipesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListImageRecipesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImageRecipesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImageRecipes( +export const paginateListImageRecipes: ( config: ImagebuilderPaginationConfiguration, input: ListImageRecipesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImageRecipesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListImageRecipesCommandInput, + ListImageRecipesCommandOutput +>(ImagebuilderClient, ListImageRecipesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListImageScanFindingAggregationsPaginator.ts b/clients/client-imagebuilder/src/pagination/ListImageScanFindingAggregationsPaginator.ts index 29e131fd835b..445596c15585 100644 --- a/clients/client-imagebuilder/src/pagination/ListImageScanFindingAggregationsPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListImageScanFindingAggregationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListImageScanFindingAggregationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImageScanFindingAggregationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImageScanFindingAggregations( +export const paginateListImageScanFindingAggregations: ( config: ImagebuilderPaginationConfiguration, input: ListImageScanFindingAggregationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImageScanFindingAggregationsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListImageScanFindingAggregationsCommandInput, + ListImageScanFindingAggregationsCommandOutput +>(ImagebuilderClient, ListImageScanFindingAggregationsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-imagebuilder/src/pagination/ListImageScanFindingsPaginator.ts b/clients/client-imagebuilder/src/pagination/ListImageScanFindingsPaginator.ts index e296f88ffa1c..b04ea49baea5 100644 --- a/clients/client-imagebuilder/src/pagination/ListImageScanFindingsPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListImageScanFindingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListImageScanFindingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImageScanFindingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImageScanFindings( +export const paginateListImageScanFindings: ( config: ImagebuilderPaginationConfiguration, input: ListImageScanFindingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImageScanFindingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListImageScanFindingsCommandInput, + ListImageScanFindingsCommandOutput +>(ImagebuilderClient, ListImageScanFindingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListImagesPaginator.ts b/clients/client-imagebuilder/src/pagination/ListImagesPaginator.ts index b69788225eb3..22cedb638f94 100644 --- a/clients/client-imagebuilder/src/pagination/ListImagesPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListImagesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListImagesCommand, ListImagesCommandInput, ListImagesCommandOutput } from "../commands/ListImagesCommand"; import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListImagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImages( +export const paginateListImages: ( config: ImagebuilderPaginationConfiguration, input: ListImagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListImagesCommandInput, + ListImagesCommandOutput +>(ImagebuilderClient, ListImagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListInfrastructureConfigurationsPaginator.ts b/clients/client-imagebuilder/src/pagination/ListInfrastructureConfigurationsPaginator.ts index 69d28451c648..c0a8235beb1b 100644 --- a/clients/client-imagebuilder/src/pagination/ListInfrastructureConfigurationsPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListInfrastructureConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListInfrastructureConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInfrastructureConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInfrastructureConfigurations( +export const paginateListInfrastructureConfigurations: ( config: ImagebuilderPaginationConfiguration, input: ListInfrastructureConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInfrastructureConfigurationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListInfrastructureConfigurationsCommandInput, + ListInfrastructureConfigurationsCommandOutput +>(ImagebuilderClient, ListInfrastructureConfigurationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListLifecycleExecutionResourcesPaginator.ts b/clients/client-imagebuilder/src/pagination/ListLifecycleExecutionResourcesPaginator.ts index c5b229d0e0e7..f4318ca8556a 100644 --- a/clients/client-imagebuilder/src/pagination/ListLifecycleExecutionResourcesPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListLifecycleExecutionResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListLifecycleExecutionResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLifecycleExecutionResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLifecycleExecutionResources( +export const paginateListLifecycleExecutionResources: ( config: ImagebuilderPaginationConfiguration, input: ListLifecycleExecutionResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLifecycleExecutionResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListLifecycleExecutionResourcesCommandInput, + ListLifecycleExecutionResourcesCommandOutput +>(ImagebuilderClient, ListLifecycleExecutionResourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListLifecycleExecutionsPaginator.ts b/clients/client-imagebuilder/src/pagination/ListLifecycleExecutionsPaginator.ts index d9bda86c826c..f5d6d0d2d547 100644 --- a/clients/client-imagebuilder/src/pagination/ListLifecycleExecutionsPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListLifecycleExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListLifecycleExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLifecycleExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLifecycleExecutions( +export const paginateListLifecycleExecutions: ( config: ImagebuilderPaginationConfiguration, input: ListLifecycleExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLifecycleExecutionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListLifecycleExecutionsCommandInput, + ListLifecycleExecutionsCommandOutput +>(ImagebuilderClient, ListLifecycleExecutionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListLifecyclePoliciesPaginator.ts b/clients/client-imagebuilder/src/pagination/ListLifecyclePoliciesPaginator.ts index 851567e13797..db357a546f43 100644 --- a/clients/client-imagebuilder/src/pagination/ListLifecyclePoliciesPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListLifecyclePoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListLifecyclePoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLifecyclePoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLifecyclePolicies( +export const paginateListLifecyclePolicies: ( config: ImagebuilderPaginationConfiguration, input: ListLifecyclePoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLifecyclePoliciesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListLifecyclePoliciesCommandInput, + ListLifecyclePoliciesCommandOutput +>(ImagebuilderClient, ListLifecyclePoliciesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListWaitingWorkflowStepsPaginator.ts b/clients/client-imagebuilder/src/pagination/ListWaitingWorkflowStepsPaginator.ts index bcccbb459b87..641b7df75303 100644 --- a/clients/client-imagebuilder/src/pagination/ListWaitingWorkflowStepsPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListWaitingWorkflowStepsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListWaitingWorkflowStepsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWaitingWorkflowStepsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWaitingWorkflowSteps( +export const paginateListWaitingWorkflowSteps: ( config: ImagebuilderPaginationConfiguration, input: ListWaitingWorkflowStepsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWaitingWorkflowStepsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListWaitingWorkflowStepsCommandInput, + ListWaitingWorkflowStepsCommandOutput +>(ImagebuilderClient, ListWaitingWorkflowStepsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListWorkflowBuildVersionsPaginator.ts b/clients/client-imagebuilder/src/pagination/ListWorkflowBuildVersionsPaginator.ts index 3d654bd9a99c..fbaf40c09c75 100644 --- a/clients/client-imagebuilder/src/pagination/ListWorkflowBuildVersionsPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListWorkflowBuildVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListWorkflowBuildVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkflowBuildVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkflowBuildVersions( +export const paginateListWorkflowBuildVersions: ( config: ImagebuilderPaginationConfiguration, input: ListWorkflowBuildVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkflowBuildVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListWorkflowBuildVersionsCommandInput, + ListWorkflowBuildVersionsCommandOutput +>(ImagebuilderClient, ListWorkflowBuildVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListWorkflowExecutionsPaginator.ts b/clients/client-imagebuilder/src/pagination/ListWorkflowExecutionsPaginator.ts index 94866ea1af32..a8d15b68f221 100644 --- a/clients/client-imagebuilder/src/pagination/ListWorkflowExecutionsPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListWorkflowExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListWorkflowExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkflowExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkflowExecutions( +export const paginateListWorkflowExecutions: ( config: ImagebuilderPaginationConfiguration, input: ListWorkflowExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkflowExecutionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListWorkflowExecutionsCommandInput, + ListWorkflowExecutionsCommandOutput +>(ImagebuilderClient, ListWorkflowExecutionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListWorkflowStepExecutionsPaginator.ts b/clients/client-imagebuilder/src/pagination/ListWorkflowStepExecutionsPaginator.ts index e39fc040d1a3..e6135a43d6c8 100644 --- a/clients/client-imagebuilder/src/pagination/ListWorkflowStepExecutionsPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListWorkflowStepExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListWorkflowStepExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkflowStepExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkflowStepExecutions( +export const paginateListWorkflowStepExecutions: ( config: ImagebuilderPaginationConfiguration, input: ListWorkflowStepExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkflowStepExecutionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListWorkflowStepExecutionsCommandInput, + ListWorkflowStepExecutionsCommandOutput +>(ImagebuilderClient, ListWorkflowStepExecutionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-imagebuilder/src/pagination/ListWorkflowsPaginator.ts b/clients/client-imagebuilder/src/pagination/ListWorkflowsPaginator.ts index 8271375dbee2..c033a1702ea7 100644 --- a/clients/client-imagebuilder/src/pagination/ListWorkflowsPaginator.ts +++ b/clients/client-imagebuilder/src/pagination/ListWorkflowsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ImagebuilderClient } from "../ImagebuilderClient"; import { ImagebuilderPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ImagebuilderClient, - input: ListWorkflowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkflowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkflows( +export const paginateListWorkflows: ( config: ImagebuilderPaginationConfiguration, input: ListWorkflowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkflowsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ImagebuilderClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Imagebuilder | ImagebuilderClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ImagebuilderPaginationConfiguration, + ListWorkflowsCommandInput, + ListWorkflowsCommandOutput +>(ImagebuilderClient, ListWorkflowsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector/package.json b/clients/client-inspector/package.json index c17cb321a396..f88e6d909f79 100644 --- a/clients/client-inspector/package.json +++ b/clients/client-inspector/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-inspector/src/pagination/GetExclusionsPreviewPaginator.ts b/clients/client-inspector/src/pagination/GetExclusionsPreviewPaginator.ts index ed4574abbdaa..1e873add9b89 100644 --- a/clients/client-inspector/src/pagination/GetExclusionsPreviewPaginator.ts +++ b/clients/client-inspector/src/pagination/GetExclusionsPreviewPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { InspectorClient } from "../InspectorClient"; import { InspectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: InspectorClient, - input: GetExclusionsPreviewCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetExclusionsPreviewCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetExclusionsPreview( +export const paginateGetExclusionsPreview: ( config: InspectorPaginationConfiguration, input: GetExclusionsPreviewCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetExclusionsPreviewCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof InspectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector | InspectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + InspectorPaginationConfiguration, + GetExclusionsPreviewCommandInput, + GetExclusionsPreviewCommandOutput +>(InspectorClient, GetExclusionsPreviewCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector/src/pagination/ListAssessmentRunAgentsPaginator.ts b/clients/client-inspector/src/pagination/ListAssessmentRunAgentsPaginator.ts index 9ae0ff731caf..c48d7179f7bf 100644 --- a/clients/client-inspector/src/pagination/ListAssessmentRunAgentsPaginator.ts +++ b/clients/client-inspector/src/pagination/ListAssessmentRunAgentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { InspectorClient } from "../InspectorClient"; import { InspectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: InspectorClient, - input: ListAssessmentRunAgentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssessmentRunAgentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssessmentRunAgents( +export const paginateListAssessmentRunAgents: ( config: InspectorPaginationConfiguration, input: ListAssessmentRunAgentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssessmentRunAgentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof InspectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector | InspectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + InspectorPaginationConfiguration, + ListAssessmentRunAgentsCommandInput, + ListAssessmentRunAgentsCommandOutput +>(InspectorClient, ListAssessmentRunAgentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector/src/pagination/ListAssessmentRunsPaginator.ts b/clients/client-inspector/src/pagination/ListAssessmentRunsPaginator.ts index 046fb0df884d..ccacb9410e86 100644 --- a/clients/client-inspector/src/pagination/ListAssessmentRunsPaginator.ts +++ b/clients/client-inspector/src/pagination/ListAssessmentRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { InspectorClient } from "../InspectorClient"; import { InspectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: InspectorClient, - input: ListAssessmentRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssessmentRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssessmentRuns( +export const paginateListAssessmentRuns: ( config: InspectorPaginationConfiguration, input: ListAssessmentRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssessmentRunsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof InspectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector | InspectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + InspectorPaginationConfiguration, + ListAssessmentRunsCommandInput, + ListAssessmentRunsCommandOutput +>(InspectorClient, ListAssessmentRunsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector/src/pagination/ListAssessmentTargetsPaginator.ts b/clients/client-inspector/src/pagination/ListAssessmentTargetsPaginator.ts index d4089b9c42ab..28f741c45885 100644 --- a/clients/client-inspector/src/pagination/ListAssessmentTargetsPaginator.ts +++ b/clients/client-inspector/src/pagination/ListAssessmentTargetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { InspectorClient } from "../InspectorClient"; import { InspectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: InspectorClient, - input: ListAssessmentTargetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssessmentTargetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssessmentTargets( +export const paginateListAssessmentTargets: ( config: InspectorPaginationConfiguration, input: ListAssessmentTargetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssessmentTargetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof InspectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector | InspectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + InspectorPaginationConfiguration, + ListAssessmentTargetsCommandInput, + ListAssessmentTargetsCommandOutput +>(InspectorClient, ListAssessmentTargetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector/src/pagination/ListAssessmentTemplatesPaginator.ts b/clients/client-inspector/src/pagination/ListAssessmentTemplatesPaginator.ts index 0c5a0dac58a6..6deed6efbbf1 100644 --- a/clients/client-inspector/src/pagination/ListAssessmentTemplatesPaginator.ts +++ b/clients/client-inspector/src/pagination/ListAssessmentTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { InspectorClient } from "../InspectorClient"; import { InspectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: InspectorClient, - input: ListAssessmentTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssessmentTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssessmentTemplates( +export const paginateListAssessmentTemplates: ( config: InspectorPaginationConfiguration, input: ListAssessmentTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssessmentTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof InspectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector | InspectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + InspectorPaginationConfiguration, + ListAssessmentTemplatesCommandInput, + ListAssessmentTemplatesCommandOutput +>(InspectorClient, ListAssessmentTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector/src/pagination/ListEventSubscriptionsPaginator.ts b/clients/client-inspector/src/pagination/ListEventSubscriptionsPaginator.ts index 44aaf1e062df..6ee05984453e 100644 --- a/clients/client-inspector/src/pagination/ListEventSubscriptionsPaginator.ts +++ b/clients/client-inspector/src/pagination/ListEventSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { InspectorClient } from "../InspectorClient"; import { InspectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: InspectorClient, - input: ListEventSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEventSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEventSubscriptions( +export const paginateListEventSubscriptions: ( config: InspectorPaginationConfiguration, input: ListEventSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEventSubscriptionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof InspectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector | InspectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + InspectorPaginationConfiguration, + ListEventSubscriptionsCommandInput, + ListEventSubscriptionsCommandOutput +>(InspectorClient, ListEventSubscriptionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector/src/pagination/ListExclusionsPaginator.ts b/clients/client-inspector/src/pagination/ListExclusionsPaginator.ts index 0da7504ab89c..d5c50674b166 100644 --- a/clients/client-inspector/src/pagination/ListExclusionsPaginator.ts +++ b/clients/client-inspector/src/pagination/ListExclusionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { InspectorClient } from "../InspectorClient"; import { InspectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: InspectorClient, - input: ListExclusionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExclusionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExclusions( +export const paginateListExclusions: ( config: InspectorPaginationConfiguration, input: ListExclusionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExclusionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof InspectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector | InspectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + InspectorPaginationConfiguration, + ListExclusionsCommandInput, + ListExclusionsCommandOutput +>(InspectorClient, ListExclusionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector/src/pagination/ListFindingsPaginator.ts b/clients/client-inspector/src/pagination/ListFindingsPaginator.ts index 0ccb924a6fd6..7bcfe64d754b 100644 --- a/clients/client-inspector/src/pagination/ListFindingsPaginator.ts +++ b/clients/client-inspector/src/pagination/ListFindingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { InspectorClient } from "../InspectorClient"; import { InspectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: InspectorClient, - input: ListFindingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFindingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFindings( +export const paginateListFindings: ( config: InspectorPaginationConfiguration, input: ListFindingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFindingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof InspectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector | InspectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + InspectorPaginationConfiguration, + ListFindingsCommandInput, + ListFindingsCommandOutput +>(InspectorClient, ListFindingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector/src/pagination/ListRulesPackagesPaginator.ts b/clients/client-inspector/src/pagination/ListRulesPackagesPaginator.ts index 10f6e6e9fcba..e6f810d331da 100644 --- a/clients/client-inspector/src/pagination/ListRulesPackagesPaginator.ts +++ b/clients/client-inspector/src/pagination/ListRulesPackagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { InspectorClient } from "../InspectorClient"; import { InspectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: InspectorClient, - input: ListRulesPackagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRulesPackagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRulesPackages( +export const paginateListRulesPackages: ( config: InspectorPaginationConfiguration, input: ListRulesPackagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRulesPackagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof InspectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector | InspectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + InspectorPaginationConfiguration, + ListRulesPackagesCommandInput, + ListRulesPackagesCommandOutput +>(InspectorClient, ListRulesPackagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector/src/pagination/PreviewAgentsPaginator.ts b/clients/client-inspector/src/pagination/PreviewAgentsPaginator.ts index 9bf4bf646c4a..2233e0784639 100644 --- a/clients/client-inspector/src/pagination/PreviewAgentsPaginator.ts +++ b/clients/client-inspector/src/pagination/PreviewAgentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { InspectorClient } from "../InspectorClient"; import { InspectorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: InspectorClient, - input: PreviewAgentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new PreviewAgentsCommand(input), ...args); -}; /** * @public */ -export async function* paginatePreviewAgents( +export const paginatePreviewAgents: ( config: InspectorPaginationConfiguration, input: PreviewAgentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: PreviewAgentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof InspectorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector | InspectorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + InspectorPaginationConfiguration, + PreviewAgentsCommandInput, + PreviewAgentsCommandOutput +>(InspectorClient, PreviewAgentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector2/src/pagination/ListAccountPermissionsPaginator.ts b/clients/client-inspector2/src/pagination/ListAccountPermissionsPaginator.ts index cc842e6629f8..4c6ab09cccc4 100644 --- a/clients/client-inspector2/src/pagination/ListAccountPermissionsPaginator.ts +++ b/clients/client-inspector2/src/pagination/ListAccountPermissionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Inspector2Client } from "../Inspector2Client"; import { Inspector2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Inspector2Client, - input: ListAccountPermissionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccountPermissionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccountPermissions( +export const paginateListAccountPermissions: ( config: Inspector2PaginationConfiguration, input: ListAccountPermissionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccountPermissionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Inspector2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector2 | Inspector2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Inspector2PaginationConfiguration, + ListAccountPermissionsCommandInput, + ListAccountPermissionsCommandOutput +>(Inspector2Client, ListAccountPermissionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector2/src/pagination/ListCoveragePaginator.ts b/clients/client-inspector2/src/pagination/ListCoveragePaginator.ts index 95ad3cf53cd4..a25a8aca40f3 100644 --- a/clients/client-inspector2/src/pagination/ListCoveragePaginator.ts +++ b/clients/client-inspector2/src/pagination/ListCoveragePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Inspector2Client } from "../Inspector2Client"; import { Inspector2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Inspector2Client, - input: ListCoverageCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCoverageCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCoverage( +export const paginateListCoverage: ( config: Inspector2PaginationConfiguration, input: ListCoverageCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCoverageCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Inspector2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector2 | Inspector2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Inspector2PaginationConfiguration, + ListCoverageCommandInput, + ListCoverageCommandOutput +>(Inspector2Client, ListCoverageCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector2/src/pagination/ListCoverageStatisticsPaginator.ts b/clients/client-inspector2/src/pagination/ListCoverageStatisticsPaginator.ts index 203a273ab572..7462ef7d8cd5 100644 --- a/clients/client-inspector2/src/pagination/ListCoverageStatisticsPaginator.ts +++ b/clients/client-inspector2/src/pagination/ListCoverageStatisticsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { Inspector2Client } from "../Inspector2Client"; import { Inspector2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Inspector2Client, - input: ListCoverageStatisticsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCoverageStatisticsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCoverageStatistics( +export const paginateListCoverageStatistics: ( config: Inspector2PaginationConfiguration, input: ListCoverageStatisticsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCoverageStatisticsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof Inspector2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector2 | Inspector2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Inspector2PaginationConfiguration, + ListCoverageStatisticsCommandInput, + ListCoverageStatisticsCommandOutput +>(Inspector2Client, ListCoverageStatisticsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-inspector2/src/pagination/ListDelegatedAdminAccountsPaginator.ts b/clients/client-inspector2/src/pagination/ListDelegatedAdminAccountsPaginator.ts index 4b0231a3537e..25834e45f134 100644 --- a/clients/client-inspector2/src/pagination/ListDelegatedAdminAccountsPaginator.ts +++ b/clients/client-inspector2/src/pagination/ListDelegatedAdminAccountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Inspector2Client } from "../Inspector2Client"; import { Inspector2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Inspector2Client, - input: ListDelegatedAdminAccountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDelegatedAdminAccountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDelegatedAdminAccounts( +export const paginateListDelegatedAdminAccounts: ( config: Inspector2PaginationConfiguration, input: ListDelegatedAdminAccountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDelegatedAdminAccountsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Inspector2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector2 | Inspector2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Inspector2PaginationConfiguration, + ListDelegatedAdminAccountsCommandInput, + ListDelegatedAdminAccountsCommandOutput +>(Inspector2Client, ListDelegatedAdminAccountsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector2/src/pagination/ListFiltersPaginator.ts b/clients/client-inspector2/src/pagination/ListFiltersPaginator.ts index d9cfdc0fd4f7..392670e7ff09 100644 --- a/clients/client-inspector2/src/pagination/ListFiltersPaginator.ts +++ b/clients/client-inspector2/src/pagination/ListFiltersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListFiltersCommand, ListFiltersCommandInput, ListFiltersCommandOutput } from "../commands/ListFiltersCommand"; import { Inspector2Client } from "../Inspector2Client"; import { Inspector2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Inspector2Client, - input: ListFiltersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFiltersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFilters( +export const paginateListFilters: ( config: Inspector2PaginationConfiguration, input: ListFiltersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFiltersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Inspector2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector2 | Inspector2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Inspector2PaginationConfiguration, + ListFiltersCommandInput, + ListFiltersCommandOutput +>(Inspector2Client, ListFiltersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector2/src/pagination/ListFindingAggregationsPaginator.ts b/clients/client-inspector2/src/pagination/ListFindingAggregationsPaginator.ts index ea3826ba14c1..738bd36d36b2 100644 --- a/clients/client-inspector2/src/pagination/ListFindingAggregationsPaginator.ts +++ b/clients/client-inspector2/src/pagination/ListFindingAggregationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Inspector2Client } from "../Inspector2Client"; import { Inspector2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Inspector2Client, - input: ListFindingAggregationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFindingAggregationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFindingAggregations( +export const paginateListFindingAggregations: ( config: Inspector2PaginationConfiguration, input: ListFindingAggregationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFindingAggregationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Inspector2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector2 | Inspector2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Inspector2PaginationConfiguration, + ListFindingAggregationsCommandInput, + ListFindingAggregationsCommandOutput +>(Inspector2Client, ListFindingAggregationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector2/src/pagination/ListFindingsPaginator.ts b/clients/client-inspector2/src/pagination/ListFindingsPaginator.ts index af1947f6023c..767c8316b2af 100644 --- a/clients/client-inspector2/src/pagination/ListFindingsPaginator.ts +++ b/clients/client-inspector2/src/pagination/ListFindingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Inspector2Client } from "../Inspector2Client"; import { Inspector2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Inspector2Client, - input: ListFindingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFindingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFindings( +export const paginateListFindings: ( config: Inspector2PaginationConfiguration, input: ListFindingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFindingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Inspector2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector2 | Inspector2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Inspector2PaginationConfiguration, + ListFindingsCommandInput, + ListFindingsCommandOutput +>(Inspector2Client, ListFindingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector2/src/pagination/ListMembersPaginator.ts b/clients/client-inspector2/src/pagination/ListMembersPaginator.ts index 1be5c00f4c67..96be24f93f91 100644 --- a/clients/client-inspector2/src/pagination/ListMembersPaginator.ts +++ b/clients/client-inspector2/src/pagination/ListMembersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListMembersCommand, ListMembersCommandInput, ListMembersCommandOutput } from "../commands/ListMembersCommand"; import { Inspector2Client } from "../Inspector2Client"; import { Inspector2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Inspector2Client, - input: ListMembersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMembersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMembers( +export const paginateListMembers: ( config: Inspector2PaginationConfiguration, input: ListMembersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMembersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Inspector2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector2 | Inspector2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Inspector2PaginationConfiguration, + ListMembersCommandInput, + ListMembersCommandOutput +>(Inspector2Client, ListMembersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector2/src/pagination/ListUsageTotalsPaginator.ts b/clients/client-inspector2/src/pagination/ListUsageTotalsPaginator.ts index 0ca059b8a64f..0bc2a2caee42 100644 --- a/clients/client-inspector2/src/pagination/ListUsageTotalsPaginator.ts +++ b/clients/client-inspector2/src/pagination/ListUsageTotalsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Inspector2Client } from "../Inspector2Client"; import { Inspector2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Inspector2Client, - input: ListUsageTotalsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUsageTotalsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUsageTotals( +export const paginateListUsageTotals: ( config: Inspector2PaginationConfiguration, input: ListUsageTotalsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUsageTotalsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Inspector2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector2 | Inspector2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Inspector2PaginationConfiguration, + ListUsageTotalsCommandInput, + ListUsageTotalsCommandOutput +>(Inspector2Client, ListUsageTotalsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-inspector2/src/pagination/SearchVulnerabilitiesPaginator.ts b/clients/client-inspector2/src/pagination/SearchVulnerabilitiesPaginator.ts index 15ca1f4e4be0..e6a4672a2da9 100644 --- a/clients/client-inspector2/src/pagination/SearchVulnerabilitiesPaginator.ts +++ b/clients/client-inspector2/src/pagination/SearchVulnerabilitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { Inspector2Client } from "../Inspector2Client"; import { Inspector2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Inspector2Client, - input: SearchVulnerabilitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchVulnerabilitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchVulnerabilities( +export const paginateSearchVulnerabilities: ( config: Inspector2PaginationConfiguration, input: SearchVulnerabilitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchVulnerabilitiesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof Inspector2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Inspector2 | Inspector2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Inspector2PaginationConfiguration, + SearchVulnerabilitiesCommandInput, + SearchVulnerabilitiesCommandOutput +>(Inspector2Client, SearchVulnerabilitiesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-internetmonitor/src/pagination/GetQueryResultsPaginator.ts b/clients/client-internetmonitor/src/pagination/GetQueryResultsPaginator.ts index fdff2e1c004f..76e35d16c463 100644 --- a/clients/client-internetmonitor/src/pagination/GetQueryResultsPaginator.ts +++ b/clients/client-internetmonitor/src/pagination/GetQueryResultsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { InternetMonitorClient } from "../InternetMonitorClient"; import { InternetMonitorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: InternetMonitorClient, - input: GetQueryResultsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetQueryResultsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetQueryResults( +export const paginateGetQueryResults: ( config: InternetMonitorPaginationConfiguration, input: GetQueryResultsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetQueryResultsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof InternetMonitorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected InternetMonitor | InternetMonitorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + InternetMonitorPaginationConfiguration, + GetQueryResultsCommandInput, + GetQueryResultsCommandOutput +>(InternetMonitorClient, GetQueryResultsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-internetmonitor/src/pagination/ListHealthEventsPaginator.ts b/clients/client-internetmonitor/src/pagination/ListHealthEventsPaginator.ts index 4dc50de4453a..2f4aa54dc2e3 100644 --- a/clients/client-internetmonitor/src/pagination/ListHealthEventsPaginator.ts +++ b/clients/client-internetmonitor/src/pagination/ListHealthEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { InternetMonitorClient } from "../InternetMonitorClient"; import { InternetMonitorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: InternetMonitorClient, - input: ListHealthEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHealthEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHealthEvents( +export const paginateListHealthEvents: ( config: InternetMonitorPaginationConfiguration, input: ListHealthEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHealthEventsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof InternetMonitorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected InternetMonitor | InternetMonitorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + InternetMonitorPaginationConfiguration, + ListHealthEventsCommandInput, + ListHealthEventsCommandOutput +>(InternetMonitorClient, ListHealthEventsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-internetmonitor/src/pagination/ListMonitorsPaginator.ts b/clients/client-internetmonitor/src/pagination/ListMonitorsPaginator.ts index 3cf1a3256036..e9e8a2a63d94 100644 --- a/clients/client-internetmonitor/src/pagination/ListMonitorsPaginator.ts +++ b/clients/client-internetmonitor/src/pagination/ListMonitorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { InternetMonitorClient } from "../InternetMonitorClient"; import { InternetMonitorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: InternetMonitorClient, - input: ListMonitorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMonitorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMonitors( +export const paginateListMonitors: ( config: InternetMonitorPaginationConfiguration, input: ListMonitorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMonitorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof InternetMonitorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected InternetMonitor | InternetMonitorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + InternetMonitorPaginationConfiguration, + ListMonitorsCommandInput, + ListMonitorsCommandOutput +>(InternetMonitorClient, ListMonitorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-iot-1click-projects/src/pagination/ListPlacementsPaginator.ts b/clients/client-iot-1click-projects/src/pagination/ListPlacementsPaginator.ts index 54e74979d530..ce7366a986e6 100644 --- a/clients/client-iot-1click-projects/src/pagination/ListPlacementsPaginator.ts +++ b/clients/client-iot-1click-projects/src/pagination/ListPlacementsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoT1ClickProjectsClient } from "../IoT1ClickProjectsClient"; import { IoT1ClickProjectsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoT1ClickProjectsClient, - input: ListPlacementsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPlacementsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPlacements( +export const paginateListPlacements: ( config: IoT1ClickProjectsPaginationConfiguration, input: ListPlacementsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPlacementsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoT1ClickProjectsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT1ClickProjects | IoT1ClickProjectsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoT1ClickProjectsPaginationConfiguration, + ListPlacementsCommandInput, + ListPlacementsCommandOutput +>(IoT1ClickProjectsClient, ListPlacementsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot-1click-projects/src/pagination/ListProjectsPaginator.ts b/clients/client-iot-1click-projects/src/pagination/ListProjectsPaginator.ts index 1f3c0f530684..eb109f8b0115 100644 --- a/clients/client-iot-1click-projects/src/pagination/ListProjectsPaginator.ts +++ b/clients/client-iot-1click-projects/src/pagination/ListProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoT1ClickProjectsClient } from "../IoT1ClickProjectsClient"; import { IoT1ClickProjectsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoT1ClickProjectsClient, - input: ListProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProjects( +export const paginateListProjects: ( config: IoT1ClickProjectsPaginationConfiguration, input: ListProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProjectsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoT1ClickProjectsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT1ClickProjects | IoT1ClickProjectsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoT1ClickProjectsPaginationConfiguration, + ListProjectsCommandInput, + ListProjectsCommandOutput +>(IoT1ClickProjectsClient, ListProjectsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot-data-plane/src/pagination/ListRetainedMessagesPaginator.ts b/clients/client-iot-data-plane/src/pagination/ListRetainedMessagesPaginator.ts index 9dcb598ac11d..23e058841a3d 100644 --- a/clients/client-iot-data-plane/src/pagination/ListRetainedMessagesPaginator.ts +++ b/clients/client-iot-data-plane/src/pagination/ListRetainedMessagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTDataPlaneClient } from "../IoTDataPlaneClient"; import { IoTDataPlanePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTDataPlaneClient, - input: ListRetainedMessagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRetainedMessagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRetainedMessages( +export const paginateListRetainedMessages: ( config: IoTDataPlanePaginationConfiguration, input: ListRetainedMessagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRetainedMessagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTDataPlaneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTDataPlane | IoTDataPlaneClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTDataPlanePaginationConfiguration, + ListRetainedMessagesCommandInput, + ListRetainedMessagesCommandOutput +>(IoTDataPlaneClient, ListRetainedMessagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot-roborunner/src/pagination/ListDestinationsPaginator.ts b/clients/client-iot-roborunner/src/pagination/ListDestinationsPaginator.ts index 89ef180279a6..3ecd35aae08d 100644 --- a/clients/client-iot-roborunner/src/pagination/ListDestinationsPaginator.ts +++ b/clients/client-iot-roborunner/src/pagination/ListDestinationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTRoboRunnerClient } from "../IoTRoboRunnerClient"; import { IoTRoboRunnerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTRoboRunnerClient, - input: ListDestinationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDestinationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDestinations( +export const paginateListDestinations: ( config: IoTRoboRunnerPaginationConfiguration, input: ListDestinationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDestinationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTRoboRunnerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTRoboRunner | IoTRoboRunnerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTRoboRunnerPaginationConfiguration, + ListDestinationsCommandInput, + ListDestinationsCommandOutput +>(IoTRoboRunnerClient, ListDestinationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot-roborunner/src/pagination/ListSitesPaginator.ts b/clients/client-iot-roborunner/src/pagination/ListSitesPaginator.ts index e679f1ad1e90..e8012d20368a 100644 --- a/clients/client-iot-roborunner/src/pagination/ListSitesPaginator.ts +++ b/clients/client-iot-roborunner/src/pagination/ListSitesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListSitesCommand, ListSitesCommandInput, ListSitesCommandOutput } from "../commands/ListSitesCommand"; import { IoTRoboRunnerClient } from "../IoTRoboRunnerClient"; import { IoTRoboRunnerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTRoboRunnerClient, - input: ListSitesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSitesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSites( +export const paginateListSites: ( config: IoTRoboRunnerPaginationConfiguration, input: ListSitesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSitesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTRoboRunnerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTRoboRunner | IoTRoboRunnerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTRoboRunnerPaginationConfiguration, + ListSitesCommandInput, + ListSitesCommandOutput +>(IoTRoboRunnerClient, ListSitesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot-roborunner/src/pagination/ListWorkerFleetsPaginator.ts b/clients/client-iot-roborunner/src/pagination/ListWorkerFleetsPaginator.ts index 2cbccbe430fa..e1e159dedb2b 100644 --- a/clients/client-iot-roborunner/src/pagination/ListWorkerFleetsPaginator.ts +++ b/clients/client-iot-roborunner/src/pagination/ListWorkerFleetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTRoboRunnerClient } from "../IoTRoboRunnerClient"; import { IoTRoboRunnerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTRoboRunnerClient, - input: ListWorkerFleetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkerFleetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkerFleets( +export const paginateListWorkerFleets: ( config: IoTRoboRunnerPaginationConfiguration, input: ListWorkerFleetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkerFleetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTRoboRunnerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTRoboRunner | IoTRoboRunnerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTRoboRunnerPaginationConfiguration, + ListWorkerFleetsCommandInput, + ListWorkerFleetsCommandOutput +>(IoTRoboRunnerClient, ListWorkerFleetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot-roborunner/src/pagination/ListWorkersPaginator.ts b/clients/client-iot-roborunner/src/pagination/ListWorkersPaginator.ts index 3c10bcb5264a..5e0e80c1ae28 100644 --- a/clients/client-iot-roborunner/src/pagination/ListWorkersPaginator.ts +++ b/clients/client-iot-roborunner/src/pagination/ListWorkersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListWorkersCommand, ListWorkersCommandInput, ListWorkersCommandOutput } from "../commands/ListWorkersCommand"; import { IoTRoboRunnerClient } from "../IoTRoboRunnerClient"; import { IoTRoboRunnerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTRoboRunnerClient, - input: ListWorkersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkers( +export const paginateListWorkers: ( config: IoTRoboRunnerPaginationConfiguration, input: ListWorkersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTRoboRunnerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTRoboRunner | IoTRoboRunnerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTRoboRunnerPaginationConfiguration, + ListWorkersCommandInput, + ListWorkersCommandOutput +>(IoTRoboRunnerClient, ListWorkersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot-wireless/src/pagination/ListDestinationsPaginator.ts b/clients/client-iot-wireless/src/pagination/ListDestinationsPaginator.ts index 3ca5c4ffd8da..f2d153dcfd67 100644 --- a/clients/client-iot-wireless/src/pagination/ListDestinationsPaginator.ts +++ b/clients/client-iot-wireless/src/pagination/ListDestinationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTWirelessClient } from "../IoTWirelessClient"; import { IoTWirelessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTWirelessClient, - input: ListDestinationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDestinationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDestinations( +export const paginateListDestinations: ( config: IoTWirelessPaginationConfiguration, input: ListDestinationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDestinationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IoTWirelessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTWireless | IoTWirelessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTWirelessPaginationConfiguration, + ListDestinationsCommandInput, + ListDestinationsCommandOutput +>(IoTWirelessClient, ListDestinationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-iot-wireless/src/pagination/ListDeviceProfilesPaginator.ts b/clients/client-iot-wireless/src/pagination/ListDeviceProfilesPaginator.ts index 580a917f6c56..3bf2e8983985 100644 --- a/clients/client-iot-wireless/src/pagination/ListDeviceProfilesPaginator.ts +++ b/clients/client-iot-wireless/src/pagination/ListDeviceProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTWirelessClient } from "../IoTWirelessClient"; import { IoTWirelessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTWirelessClient, - input: ListDeviceProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeviceProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeviceProfiles( +export const paginateListDeviceProfiles: ( config: IoTWirelessPaginationConfiguration, input: ListDeviceProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeviceProfilesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IoTWirelessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTWireless | IoTWirelessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTWirelessPaginationConfiguration, + ListDeviceProfilesCommandInput, + ListDeviceProfilesCommandOutput +>(IoTWirelessClient, ListDeviceProfilesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-iot-wireless/src/pagination/ListFuotaTasksPaginator.ts b/clients/client-iot-wireless/src/pagination/ListFuotaTasksPaginator.ts index 8db7cf7030ab..d69cf41b362f 100644 --- a/clients/client-iot-wireless/src/pagination/ListFuotaTasksPaginator.ts +++ b/clients/client-iot-wireless/src/pagination/ListFuotaTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTWirelessClient } from "../IoTWirelessClient"; import { IoTWirelessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTWirelessClient, - input: ListFuotaTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFuotaTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFuotaTasks( +export const paginateListFuotaTasks: ( config: IoTWirelessPaginationConfiguration, input: ListFuotaTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFuotaTasksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IoTWirelessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTWireless | IoTWirelessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTWirelessPaginationConfiguration, + ListFuotaTasksCommandInput, + ListFuotaTasksCommandOutput +>(IoTWirelessClient, ListFuotaTasksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-iot-wireless/src/pagination/ListMulticastGroupsByFuotaTaskPaginator.ts b/clients/client-iot-wireless/src/pagination/ListMulticastGroupsByFuotaTaskPaginator.ts index c9b0c95ac77d..3658b9b9c705 100644 --- a/clients/client-iot-wireless/src/pagination/ListMulticastGroupsByFuotaTaskPaginator.ts +++ b/clients/client-iot-wireless/src/pagination/ListMulticastGroupsByFuotaTaskPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTWirelessClient } from "../IoTWirelessClient"; import { IoTWirelessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTWirelessClient, - input: ListMulticastGroupsByFuotaTaskCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMulticastGroupsByFuotaTaskCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMulticastGroupsByFuotaTask( +export const paginateListMulticastGroupsByFuotaTask: ( config: IoTWirelessPaginationConfiguration, input: ListMulticastGroupsByFuotaTaskCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMulticastGroupsByFuotaTaskCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IoTWirelessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTWireless | IoTWirelessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTWirelessPaginationConfiguration, + ListMulticastGroupsByFuotaTaskCommandInput, + ListMulticastGroupsByFuotaTaskCommandOutput +>(IoTWirelessClient, ListMulticastGroupsByFuotaTaskCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-iot-wireless/src/pagination/ListMulticastGroupsPaginator.ts b/clients/client-iot-wireless/src/pagination/ListMulticastGroupsPaginator.ts index 17f23c147f07..fde6410c87b4 100644 --- a/clients/client-iot-wireless/src/pagination/ListMulticastGroupsPaginator.ts +++ b/clients/client-iot-wireless/src/pagination/ListMulticastGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTWirelessClient } from "../IoTWirelessClient"; import { IoTWirelessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTWirelessClient, - input: ListMulticastGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMulticastGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMulticastGroups( +export const paginateListMulticastGroups: ( config: IoTWirelessPaginationConfiguration, input: ListMulticastGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMulticastGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IoTWirelessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTWireless | IoTWirelessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTWirelessPaginationConfiguration, + ListMulticastGroupsCommandInput, + ListMulticastGroupsCommandOutput +>(IoTWirelessClient, ListMulticastGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-iot-wireless/src/pagination/ListNetworkAnalyzerConfigurationsPaginator.ts b/clients/client-iot-wireless/src/pagination/ListNetworkAnalyzerConfigurationsPaginator.ts index 05e1b82e588f..2a1bcdc252a5 100644 --- a/clients/client-iot-wireless/src/pagination/ListNetworkAnalyzerConfigurationsPaginator.ts +++ b/clients/client-iot-wireless/src/pagination/ListNetworkAnalyzerConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTWirelessClient } from "../IoTWirelessClient"; import { IoTWirelessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTWirelessClient, - input: ListNetworkAnalyzerConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNetworkAnalyzerConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNetworkAnalyzerConfigurations( +export const paginateListNetworkAnalyzerConfigurations: ( config: IoTWirelessPaginationConfiguration, input: ListNetworkAnalyzerConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNetworkAnalyzerConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IoTWirelessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTWireless | IoTWirelessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTWirelessPaginationConfiguration, + ListNetworkAnalyzerConfigurationsCommandInput, + ListNetworkAnalyzerConfigurationsCommandOutput +>(IoTWirelessClient, ListNetworkAnalyzerConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-iot-wireless/src/pagination/ListPositionConfigurationsPaginator.ts b/clients/client-iot-wireless/src/pagination/ListPositionConfigurationsPaginator.ts index 56fe40203c10..9e2edafc35d8 100644 --- a/clients/client-iot-wireless/src/pagination/ListPositionConfigurationsPaginator.ts +++ b/clients/client-iot-wireless/src/pagination/ListPositionConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTWirelessClient } from "../IoTWirelessClient"; import { IoTWirelessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTWirelessClient, - input: ListPositionConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPositionConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPositionConfigurations( +export const paginateListPositionConfigurations: ( config: IoTWirelessPaginationConfiguration, input: ListPositionConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPositionConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IoTWirelessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTWireless | IoTWirelessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTWirelessPaginationConfiguration, + ListPositionConfigurationsCommandInput, + ListPositionConfigurationsCommandOutput +>(IoTWirelessClient, ListPositionConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-iot-wireless/src/pagination/ListQueuedMessagesPaginator.ts b/clients/client-iot-wireless/src/pagination/ListQueuedMessagesPaginator.ts index e16cdffc3549..97d2864f6524 100644 --- a/clients/client-iot-wireless/src/pagination/ListQueuedMessagesPaginator.ts +++ b/clients/client-iot-wireless/src/pagination/ListQueuedMessagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTWirelessClient } from "../IoTWirelessClient"; import { IoTWirelessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTWirelessClient, - input: ListQueuedMessagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListQueuedMessagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListQueuedMessages( +export const paginateListQueuedMessages: ( config: IoTWirelessPaginationConfiguration, input: ListQueuedMessagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListQueuedMessagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IoTWirelessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTWireless | IoTWirelessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTWirelessPaginationConfiguration, + ListQueuedMessagesCommandInput, + ListQueuedMessagesCommandOutput +>(IoTWirelessClient, ListQueuedMessagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-iot-wireless/src/pagination/ListServiceProfilesPaginator.ts b/clients/client-iot-wireless/src/pagination/ListServiceProfilesPaginator.ts index 11d7087649a6..2f65127edf9f 100644 --- a/clients/client-iot-wireless/src/pagination/ListServiceProfilesPaginator.ts +++ b/clients/client-iot-wireless/src/pagination/ListServiceProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTWirelessClient } from "../IoTWirelessClient"; import { IoTWirelessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTWirelessClient, - input: ListServiceProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServiceProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServiceProfiles( +export const paginateListServiceProfiles: ( config: IoTWirelessPaginationConfiguration, input: ListServiceProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServiceProfilesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IoTWirelessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTWireless | IoTWirelessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTWirelessPaginationConfiguration, + ListServiceProfilesCommandInput, + ListServiceProfilesCommandOutput +>(IoTWirelessClient, ListServiceProfilesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-iot-wireless/src/pagination/ListWirelessDevicesPaginator.ts b/clients/client-iot-wireless/src/pagination/ListWirelessDevicesPaginator.ts index 9bc6a4cee598..e85933da90c4 100644 --- a/clients/client-iot-wireless/src/pagination/ListWirelessDevicesPaginator.ts +++ b/clients/client-iot-wireless/src/pagination/ListWirelessDevicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTWirelessClient } from "../IoTWirelessClient"; import { IoTWirelessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTWirelessClient, - input: ListWirelessDevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWirelessDevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWirelessDevices( +export const paginateListWirelessDevices: ( config: IoTWirelessPaginationConfiguration, input: ListWirelessDevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWirelessDevicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IoTWirelessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTWireless | IoTWirelessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTWirelessPaginationConfiguration, + ListWirelessDevicesCommandInput, + ListWirelessDevicesCommandOutput +>(IoTWirelessClient, ListWirelessDevicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-iot-wireless/src/pagination/ListWirelessGatewaysPaginator.ts b/clients/client-iot-wireless/src/pagination/ListWirelessGatewaysPaginator.ts index d305d7895fd0..54f5da9b86f2 100644 --- a/clients/client-iot-wireless/src/pagination/ListWirelessGatewaysPaginator.ts +++ b/clients/client-iot-wireless/src/pagination/ListWirelessGatewaysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTWirelessClient } from "../IoTWirelessClient"; import { IoTWirelessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTWirelessClient, - input: ListWirelessGatewaysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWirelessGatewaysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWirelessGateways( +export const paginateListWirelessGateways: ( config: IoTWirelessPaginationConfiguration, input: ListWirelessGatewaysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWirelessGatewaysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof IoTWirelessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTWireless | IoTWirelessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTWirelessPaginationConfiguration, + ListWirelessGatewaysCommandInput, + ListWirelessGatewaysCommandOutput +>(IoTWirelessClient, ListWirelessGatewaysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-iot/src/pagination/GetBehaviorModelTrainingSummariesPaginator.ts b/clients/client-iot/src/pagination/GetBehaviorModelTrainingSummariesPaginator.ts index b54d32772e2a..0f224a6f940e 100644 --- a/clients/client-iot/src/pagination/GetBehaviorModelTrainingSummariesPaginator.ts +++ b/clients/client-iot/src/pagination/GetBehaviorModelTrainingSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: GetBehaviorModelTrainingSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetBehaviorModelTrainingSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetBehaviorModelTrainingSummaries( +export const paginateGetBehaviorModelTrainingSummaries: ( config: IoTPaginationConfiguration, input: GetBehaviorModelTrainingSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetBehaviorModelTrainingSummariesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + GetBehaviorModelTrainingSummariesCommandInput, + GetBehaviorModelTrainingSummariesCommandOutput +>(IoTClient, GetBehaviorModelTrainingSummariesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListActiveViolationsPaginator.ts b/clients/client-iot/src/pagination/ListActiveViolationsPaginator.ts index 8e442e049944..a9fa793804ce 100644 --- a/clients/client-iot/src/pagination/ListActiveViolationsPaginator.ts +++ b/clients/client-iot/src/pagination/ListActiveViolationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListActiveViolationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListActiveViolationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListActiveViolations( +export const paginateListActiveViolations: ( config: IoTPaginationConfiguration, input: ListActiveViolationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListActiveViolationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListActiveViolationsCommandInput, + ListActiveViolationsCommandOutput +>(IoTClient, ListActiveViolationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListAttachedPoliciesPaginator.ts b/clients/client-iot/src/pagination/ListAttachedPoliciesPaginator.ts index 91b40862ecf5..60f93cad24be 100644 --- a/clients/client-iot/src/pagination/ListAttachedPoliciesPaginator.ts +++ b/clients/client-iot/src/pagination/ListAttachedPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListAttachedPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAttachedPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAttachedPolicies( +export const paginateListAttachedPolicies: ( config: IoTPaginationConfiguration, input: ListAttachedPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAttachedPoliciesCommandOutput; - while (hasNext) { - input.marker = token; - input["pageSize"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListAttachedPoliciesCommandInput, + ListAttachedPoliciesCommandOutput +>(IoTClient, ListAttachedPoliciesCommand, "marker", "nextMarker", "pageSize"); diff --git a/clients/client-iot/src/pagination/ListAuditFindingsPaginator.ts b/clients/client-iot/src/pagination/ListAuditFindingsPaginator.ts index 6cae77d35c0d..71c8d50ba31b 100644 --- a/clients/client-iot/src/pagination/ListAuditFindingsPaginator.ts +++ b/clients/client-iot/src/pagination/ListAuditFindingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListAuditFindingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAuditFindingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAuditFindings( +export const paginateListAuditFindings: ( config: IoTPaginationConfiguration, input: ListAuditFindingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAuditFindingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListAuditFindingsCommandInput, + ListAuditFindingsCommandOutput +>(IoTClient, ListAuditFindingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListAuditMitigationActionsExecutionsPaginator.ts b/clients/client-iot/src/pagination/ListAuditMitigationActionsExecutionsPaginator.ts index a17bf4f95d39..4e806b4d339c 100644 --- a/clients/client-iot/src/pagination/ListAuditMitigationActionsExecutionsPaginator.ts +++ b/clients/client-iot/src/pagination/ListAuditMitigationActionsExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListAuditMitigationActionsExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAuditMitigationActionsExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAuditMitigationActionsExecutions( +export const paginateListAuditMitigationActionsExecutions: ( config: IoTPaginationConfiguration, input: ListAuditMitigationActionsExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAuditMitigationActionsExecutionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListAuditMitigationActionsExecutionsCommandInput, + ListAuditMitigationActionsExecutionsCommandOutput +>(IoTClient, ListAuditMitigationActionsExecutionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListAuditMitigationActionsTasksPaginator.ts b/clients/client-iot/src/pagination/ListAuditMitigationActionsTasksPaginator.ts index 35f34dd2c4f1..96cadf49e105 100644 --- a/clients/client-iot/src/pagination/ListAuditMitigationActionsTasksPaginator.ts +++ b/clients/client-iot/src/pagination/ListAuditMitigationActionsTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListAuditMitigationActionsTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAuditMitigationActionsTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAuditMitigationActionsTasks( +export const paginateListAuditMitigationActionsTasks: ( config: IoTPaginationConfiguration, input: ListAuditMitigationActionsTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAuditMitigationActionsTasksCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListAuditMitigationActionsTasksCommandInput, + ListAuditMitigationActionsTasksCommandOutput +>(IoTClient, ListAuditMitigationActionsTasksCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListAuditSuppressionsPaginator.ts b/clients/client-iot/src/pagination/ListAuditSuppressionsPaginator.ts index 62c8a7919fc1..4a0326ee2db6 100644 --- a/clients/client-iot/src/pagination/ListAuditSuppressionsPaginator.ts +++ b/clients/client-iot/src/pagination/ListAuditSuppressionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListAuditSuppressionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAuditSuppressionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAuditSuppressions( +export const paginateListAuditSuppressions: ( config: IoTPaginationConfiguration, input: ListAuditSuppressionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAuditSuppressionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListAuditSuppressionsCommandInput, + ListAuditSuppressionsCommandOutput +>(IoTClient, ListAuditSuppressionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListAuditTasksPaginator.ts b/clients/client-iot/src/pagination/ListAuditTasksPaginator.ts index 0f217308371f..1fa47dd1ea57 100644 --- a/clients/client-iot/src/pagination/ListAuditTasksPaginator.ts +++ b/clients/client-iot/src/pagination/ListAuditTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListAuditTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAuditTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAuditTasks( +export const paginateListAuditTasks: ( config: IoTPaginationConfiguration, input: ListAuditTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAuditTasksCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListAuditTasksCommandInput, + ListAuditTasksCommandOutput +>(IoTClient, ListAuditTasksCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListAuthorizersPaginator.ts b/clients/client-iot/src/pagination/ListAuthorizersPaginator.ts index 6e56d27744e0..901bf9d618f5 100644 --- a/clients/client-iot/src/pagination/ListAuthorizersPaginator.ts +++ b/clients/client-iot/src/pagination/ListAuthorizersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListAuthorizersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAuthorizersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAuthorizers( +export const paginateListAuthorizers: ( config: IoTPaginationConfiguration, input: ListAuthorizersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAuthorizersCommandOutput; - while (hasNext) { - input.marker = token; - input["pageSize"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListAuthorizersCommandInput, + ListAuthorizersCommandOutput +>(IoTClient, ListAuthorizersCommand, "marker", "nextMarker", "pageSize"); diff --git a/clients/client-iot/src/pagination/ListBillingGroupsPaginator.ts b/clients/client-iot/src/pagination/ListBillingGroupsPaginator.ts index c499d361d728..73925660c7e4 100644 --- a/clients/client-iot/src/pagination/ListBillingGroupsPaginator.ts +++ b/clients/client-iot/src/pagination/ListBillingGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListBillingGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBillingGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBillingGroups( +export const paginateListBillingGroups: ( config: IoTPaginationConfiguration, input: ListBillingGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBillingGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListBillingGroupsCommandInput, + ListBillingGroupsCommandOutput +>(IoTClient, ListBillingGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListCACertificatesPaginator.ts b/clients/client-iot/src/pagination/ListCACertificatesPaginator.ts index db4411809d6f..986a248658af 100644 --- a/clients/client-iot/src/pagination/ListCACertificatesPaginator.ts +++ b/clients/client-iot/src/pagination/ListCACertificatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListCACertificatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCACertificatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCACertificates( +export const paginateListCACertificates: ( config: IoTPaginationConfiguration, input: ListCACertificatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCACertificatesCommandOutput; - while (hasNext) { - input.marker = token; - input["pageSize"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListCACertificatesCommandInput, + ListCACertificatesCommandOutput +>(IoTClient, ListCACertificatesCommand, "marker", "nextMarker", "pageSize"); diff --git a/clients/client-iot/src/pagination/ListCertificatesByCAPaginator.ts b/clients/client-iot/src/pagination/ListCertificatesByCAPaginator.ts index 2e522d94706c..1193af652c1c 100644 --- a/clients/client-iot/src/pagination/ListCertificatesByCAPaginator.ts +++ b/clients/client-iot/src/pagination/ListCertificatesByCAPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListCertificatesByCACommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCertificatesByCACommand(input), ...args); -}; /** * @public */ -export async function* paginateListCertificatesByCA( +export const paginateListCertificatesByCA: ( config: IoTPaginationConfiguration, input: ListCertificatesByCACommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCertificatesByCACommandOutput; - while (hasNext) { - input.marker = token; - input["pageSize"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListCertificatesByCACommandInput, + ListCertificatesByCACommandOutput +>(IoTClient, ListCertificatesByCACommand, "marker", "nextMarker", "pageSize"); diff --git a/clients/client-iot/src/pagination/ListCertificatesPaginator.ts b/clients/client-iot/src/pagination/ListCertificatesPaginator.ts index 71f8b4a98789..8b2479397372 100644 --- a/clients/client-iot/src/pagination/ListCertificatesPaginator.ts +++ b/clients/client-iot/src/pagination/ListCertificatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListCertificatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCertificatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCertificates( +export const paginateListCertificates: ( config: IoTPaginationConfiguration, input: ListCertificatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCertificatesCommandOutput; - while (hasNext) { - input.marker = token; - input["pageSize"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListCertificatesCommandInput, + ListCertificatesCommandOutput +>(IoTClient, ListCertificatesCommand, "marker", "nextMarker", "pageSize"); diff --git a/clients/client-iot/src/pagination/ListCustomMetricsPaginator.ts b/clients/client-iot/src/pagination/ListCustomMetricsPaginator.ts index 5e815b892097..d25c4cdaf8d0 100644 --- a/clients/client-iot/src/pagination/ListCustomMetricsPaginator.ts +++ b/clients/client-iot/src/pagination/ListCustomMetricsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListCustomMetricsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomMetricsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomMetrics( +export const paginateListCustomMetrics: ( config: IoTPaginationConfiguration, input: ListCustomMetricsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomMetricsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListCustomMetricsCommandInput, + ListCustomMetricsCommandOutput +>(IoTClient, ListCustomMetricsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListDetectMitigationActionsExecutionsPaginator.ts b/clients/client-iot/src/pagination/ListDetectMitigationActionsExecutionsPaginator.ts index 8dfba8288b65..69c61b049285 100644 --- a/clients/client-iot/src/pagination/ListDetectMitigationActionsExecutionsPaginator.ts +++ b/clients/client-iot/src/pagination/ListDetectMitigationActionsExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListDetectMitigationActionsExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDetectMitigationActionsExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDetectMitigationActionsExecutions( +export const paginateListDetectMitigationActionsExecutions: ( config: IoTPaginationConfiguration, input: ListDetectMitigationActionsExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDetectMitigationActionsExecutionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListDetectMitigationActionsExecutionsCommandInput, + ListDetectMitigationActionsExecutionsCommandOutput +>(IoTClient, ListDetectMitigationActionsExecutionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListDetectMitigationActionsTasksPaginator.ts b/clients/client-iot/src/pagination/ListDetectMitigationActionsTasksPaginator.ts index f28ca8316b4c..12d6134acc61 100644 --- a/clients/client-iot/src/pagination/ListDetectMitigationActionsTasksPaginator.ts +++ b/clients/client-iot/src/pagination/ListDetectMitigationActionsTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListDetectMitigationActionsTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDetectMitigationActionsTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDetectMitigationActionsTasks( +export const paginateListDetectMitigationActionsTasks: ( config: IoTPaginationConfiguration, input: ListDetectMitigationActionsTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDetectMitigationActionsTasksCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListDetectMitigationActionsTasksCommandInput, + ListDetectMitigationActionsTasksCommandOutput +>(IoTClient, ListDetectMitigationActionsTasksCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListDimensionsPaginator.ts b/clients/client-iot/src/pagination/ListDimensionsPaginator.ts index c70a9463aa91..4a44863af824 100644 --- a/clients/client-iot/src/pagination/ListDimensionsPaginator.ts +++ b/clients/client-iot/src/pagination/ListDimensionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListDimensionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDimensionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDimensions( +export const paginateListDimensions: ( config: IoTPaginationConfiguration, input: ListDimensionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDimensionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListDimensionsCommandInput, + ListDimensionsCommandOutput +>(IoTClient, ListDimensionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListDomainConfigurationsPaginator.ts b/clients/client-iot/src/pagination/ListDomainConfigurationsPaginator.ts index f2c91c8dbad0..161361c9a1b4 100644 --- a/clients/client-iot/src/pagination/ListDomainConfigurationsPaginator.ts +++ b/clients/client-iot/src/pagination/ListDomainConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListDomainConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomainConfigurations( +export const paginateListDomainConfigurations: ( config: IoTPaginationConfiguration, input: ListDomainConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainConfigurationsCommandOutput; - while (hasNext) { - input.marker = token; - input["pageSize"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListDomainConfigurationsCommandInput, + ListDomainConfigurationsCommandOutput +>(IoTClient, ListDomainConfigurationsCommand, "marker", "nextMarker", "pageSize"); diff --git a/clients/client-iot/src/pagination/ListFleetMetricsPaginator.ts b/clients/client-iot/src/pagination/ListFleetMetricsPaginator.ts index 282bc1cddee4..f48d2c54aedb 100644 --- a/clients/client-iot/src/pagination/ListFleetMetricsPaginator.ts +++ b/clients/client-iot/src/pagination/ListFleetMetricsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListFleetMetricsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFleetMetricsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFleetMetrics( +export const paginateListFleetMetrics: ( config: IoTPaginationConfiguration, input: ListFleetMetricsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFleetMetricsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListFleetMetricsCommandInput, + ListFleetMetricsCommandOutput +>(IoTClient, ListFleetMetricsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListIndicesPaginator.ts b/clients/client-iot/src/pagination/ListIndicesPaginator.ts index 5e7219ca3d6b..7035092bc7b4 100644 --- a/clients/client-iot/src/pagination/ListIndicesPaginator.ts +++ b/clients/client-iot/src/pagination/ListIndicesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListIndicesCommand, ListIndicesCommandInput, ListIndicesCommandOutput } from "../commands/ListIndicesCommand"; import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListIndicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIndicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIndices( +export const paginateListIndices: ( config: IoTPaginationConfiguration, input: ListIndicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIndicesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListIndicesCommandInput, + ListIndicesCommandOutput +>(IoTClient, ListIndicesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListJobExecutionsForJobPaginator.ts b/clients/client-iot/src/pagination/ListJobExecutionsForJobPaginator.ts index 753a588b0a15..4bd936b4a04c 100644 --- a/clients/client-iot/src/pagination/ListJobExecutionsForJobPaginator.ts +++ b/clients/client-iot/src/pagination/ListJobExecutionsForJobPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListJobExecutionsForJobCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobExecutionsForJobCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobExecutionsForJob( +export const paginateListJobExecutionsForJob: ( config: IoTPaginationConfiguration, input: ListJobExecutionsForJobCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobExecutionsForJobCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListJobExecutionsForJobCommandInput, + ListJobExecutionsForJobCommandOutput +>(IoTClient, ListJobExecutionsForJobCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListJobExecutionsForThingPaginator.ts b/clients/client-iot/src/pagination/ListJobExecutionsForThingPaginator.ts index 391af30303c5..5916e96cda52 100644 --- a/clients/client-iot/src/pagination/ListJobExecutionsForThingPaginator.ts +++ b/clients/client-iot/src/pagination/ListJobExecutionsForThingPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListJobExecutionsForThingCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobExecutionsForThingCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobExecutionsForThing( +export const paginateListJobExecutionsForThing: ( config: IoTPaginationConfiguration, input: ListJobExecutionsForThingCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobExecutionsForThingCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListJobExecutionsForThingCommandInput, + ListJobExecutionsForThingCommandOutput +>(IoTClient, ListJobExecutionsForThingCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListJobTemplatesPaginator.ts b/clients/client-iot/src/pagination/ListJobTemplatesPaginator.ts index 431f25f08dbc..af12671f7ff6 100644 --- a/clients/client-iot/src/pagination/ListJobTemplatesPaginator.ts +++ b/clients/client-iot/src/pagination/ListJobTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListJobTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobTemplates( +export const paginateListJobTemplates: ( config: IoTPaginationConfiguration, input: ListJobTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListJobTemplatesCommandInput, + ListJobTemplatesCommandOutput +>(IoTClient, ListJobTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListJobsPaginator.ts b/clients/client-iot/src/pagination/ListJobsPaginator.ts index eaad85e2b4d5..60e0d7a57dbb 100644 --- a/clients/client-iot/src/pagination/ListJobsPaginator.ts +++ b/clients/client-iot/src/pagination/ListJobsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListJobsCommand, ListJobsCommandInput, ListJobsCommandOutput } from "../commands/ListJobsCommand"; import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobs( +export const paginateListJobs: ( config: IoTPaginationConfiguration, input: ListJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListJobsCommandInput, + ListJobsCommandOutput +>(IoTClient, ListJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListManagedJobTemplatesPaginator.ts b/clients/client-iot/src/pagination/ListManagedJobTemplatesPaginator.ts index 3988d9a6964c..23a31f1443ea 100644 --- a/clients/client-iot/src/pagination/ListManagedJobTemplatesPaginator.ts +++ b/clients/client-iot/src/pagination/ListManagedJobTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListManagedJobTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListManagedJobTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListManagedJobTemplates( +export const paginateListManagedJobTemplates: ( config: IoTPaginationConfiguration, input: ListManagedJobTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListManagedJobTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListManagedJobTemplatesCommandInput, + ListManagedJobTemplatesCommandOutput +>(IoTClient, ListManagedJobTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListMetricValuesPaginator.ts b/clients/client-iot/src/pagination/ListMetricValuesPaginator.ts index 7fd2689c8307..79decd204b7b 100644 --- a/clients/client-iot/src/pagination/ListMetricValuesPaginator.ts +++ b/clients/client-iot/src/pagination/ListMetricValuesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListMetricValuesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMetricValuesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMetricValues( +export const paginateListMetricValues: ( config: IoTPaginationConfiguration, input: ListMetricValuesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMetricValuesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListMetricValuesCommandInput, + ListMetricValuesCommandOutput +>(IoTClient, ListMetricValuesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListMitigationActionsPaginator.ts b/clients/client-iot/src/pagination/ListMitigationActionsPaginator.ts index e58c66f21430..5ebc07497506 100644 --- a/clients/client-iot/src/pagination/ListMitigationActionsPaginator.ts +++ b/clients/client-iot/src/pagination/ListMitigationActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListMitigationActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMitigationActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMitigationActions( +export const paginateListMitigationActions: ( config: IoTPaginationConfiguration, input: ListMitigationActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMitigationActionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListMitigationActionsCommandInput, + ListMitigationActionsCommandOutput +>(IoTClient, ListMitigationActionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListOTAUpdatesPaginator.ts b/clients/client-iot/src/pagination/ListOTAUpdatesPaginator.ts index 1455aedabcb5..30bf415d1efe 100644 --- a/clients/client-iot/src/pagination/ListOTAUpdatesPaginator.ts +++ b/clients/client-iot/src/pagination/ListOTAUpdatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListOTAUpdatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOTAUpdatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOTAUpdates( +export const paginateListOTAUpdates: ( config: IoTPaginationConfiguration, input: ListOTAUpdatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOTAUpdatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListOTAUpdatesCommandInput, + ListOTAUpdatesCommandOutput +>(IoTClient, ListOTAUpdatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListOutgoingCertificatesPaginator.ts b/clients/client-iot/src/pagination/ListOutgoingCertificatesPaginator.ts index af428955420b..4a8137e71e03 100644 --- a/clients/client-iot/src/pagination/ListOutgoingCertificatesPaginator.ts +++ b/clients/client-iot/src/pagination/ListOutgoingCertificatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListOutgoingCertificatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOutgoingCertificatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOutgoingCertificates( +export const paginateListOutgoingCertificates: ( config: IoTPaginationConfiguration, input: ListOutgoingCertificatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOutgoingCertificatesCommandOutput; - while (hasNext) { - input.marker = token; - input["pageSize"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListOutgoingCertificatesCommandInput, + ListOutgoingCertificatesCommandOutput +>(IoTClient, ListOutgoingCertificatesCommand, "marker", "nextMarker", "pageSize"); diff --git a/clients/client-iot/src/pagination/ListPackageVersionsPaginator.ts b/clients/client-iot/src/pagination/ListPackageVersionsPaginator.ts index a388ecf379f8..bba9b5aa04d0 100644 --- a/clients/client-iot/src/pagination/ListPackageVersionsPaginator.ts +++ b/clients/client-iot/src/pagination/ListPackageVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListPackageVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPackageVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPackageVersions( +export const paginateListPackageVersions: ( config: IoTPaginationConfiguration, input: ListPackageVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPackageVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListPackageVersionsCommandInput, + ListPackageVersionsCommandOutput +>(IoTClient, ListPackageVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListPackagesPaginator.ts b/clients/client-iot/src/pagination/ListPackagesPaginator.ts index 96a9503b8d7d..8566f1dea8a6 100644 --- a/clients/client-iot/src/pagination/ListPackagesPaginator.ts +++ b/clients/client-iot/src/pagination/ListPackagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListPackagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPackagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPackages( +export const paginateListPackages: ( config: IoTPaginationConfiguration, input: ListPackagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPackagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListPackagesCommandInput, + ListPackagesCommandOutput +>(IoTClient, ListPackagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListPoliciesPaginator.ts b/clients/client-iot/src/pagination/ListPoliciesPaginator.ts index 7bd460955a73..e53c261484fa 100644 --- a/clients/client-iot/src/pagination/ListPoliciesPaginator.ts +++ b/clients/client-iot/src/pagination/ListPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPolicies( +export const paginateListPolicies: ( config: IoTPaginationConfiguration, input: ListPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPoliciesCommandOutput; - while (hasNext) { - input.marker = token; - input["pageSize"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListPoliciesCommandInput, + ListPoliciesCommandOutput +>(IoTClient, ListPoliciesCommand, "marker", "nextMarker", "pageSize"); diff --git a/clients/client-iot/src/pagination/ListPolicyPrincipalsPaginator.ts b/clients/client-iot/src/pagination/ListPolicyPrincipalsPaginator.ts index 5813d5405629..0606cbddd5da 100644 --- a/clients/client-iot/src/pagination/ListPolicyPrincipalsPaginator.ts +++ b/clients/client-iot/src/pagination/ListPolicyPrincipalsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListPolicyPrincipalsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPolicyPrincipalsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPolicyPrincipals( +export const paginateListPolicyPrincipals: ( config: IoTPaginationConfiguration, input: ListPolicyPrincipalsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPolicyPrincipalsCommandOutput; - while (hasNext) { - input.marker = token; - input["pageSize"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListPolicyPrincipalsCommandInput, + ListPolicyPrincipalsCommandOutput +>(IoTClient, ListPolicyPrincipalsCommand, "marker", "nextMarker", "pageSize"); diff --git a/clients/client-iot/src/pagination/ListPrincipalPoliciesPaginator.ts b/clients/client-iot/src/pagination/ListPrincipalPoliciesPaginator.ts index 1b443c778000..d51e159d323f 100644 --- a/clients/client-iot/src/pagination/ListPrincipalPoliciesPaginator.ts +++ b/clients/client-iot/src/pagination/ListPrincipalPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListPrincipalPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPrincipalPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPrincipalPolicies( +export const paginateListPrincipalPolicies: ( config: IoTPaginationConfiguration, input: ListPrincipalPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPrincipalPoliciesCommandOutput; - while (hasNext) { - input.marker = token; - input["pageSize"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListPrincipalPoliciesCommandInput, + ListPrincipalPoliciesCommandOutput +>(IoTClient, ListPrincipalPoliciesCommand, "marker", "nextMarker", "pageSize"); diff --git a/clients/client-iot/src/pagination/ListPrincipalThingsPaginator.ts b/clients/client-iot/src/pagination/ListPrincipalThingsPaginator.ts index f7f5c42b38f9..e7e5ef572296 100644 --- a/clients/client-iot/src/pagination/ListPrincipalThingsPaginator.ts +++ b/clients/client-iot/src/pagination/ListPrincipalThingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListPrincipalThingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPrincipalThingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPrincipalThings( +export const paginateListPrincipalThings: ( config: IoTPaginationConfiguration, input: ListPrincipalThingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPrincipalThingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListPrincipalThingsCommandInput, + ListPrincipalThingsCommandOutput +>(IoTClient, ListPrincipalThingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListProvisioningTemplateVersionsPaginator.ts b/clients/client-iot/src/pagination/ListProvisioningTemplateVersionsPaginator.ts index bac214898a81..5c23ed1da32c 100644 --- a/clients/client-iot/src/pagination/ListProvisioningTemplateVersionsPaginator.ts +++ b/clients/client-iot/src/pagination/ListProvisioningTemplateVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListProvisioningTemplateVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProvisioningTemplateVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProvisioningTemplateVersions( +export const paginateListProvisioningTemplateVersions: ( config: IoTPaginationConfiguration, input: ListProvisioningTemplateVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProvisioningTemplateVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListProvisioningTemplateVersionsCommandInput, + ListProvisioningTemplateVersionsCommandOutput +>(IoTClient, ListProvisioningTemplateVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListProvisioningTemplatesPaginator.ts b/clients/client-iot/src/pagination/ListProvisioningTemplatesPaginator.ts index 02207283a42e..f7b00b1dc6a7 100644 --- a/clients/client-iot/src/pagination/ListProvisioningTemplatesPaginator.ts +++ b/clients/client-iot/src/pagination/ListProvisioningTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListProvisioningTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProvisioningTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProvisioningTemplates( +export const paginateListProvisioningTemplates: ( config: IoTPaginationConfiguration, input: ListProvisioningTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProvisioningTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListProvisioningTemplatesCommandInput, + ListProvisioningTemplatesCommandOutput +>(IoTClient, ListProvisioningTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListRelatedResourcesForAuditFindingPaginator.ts b/clients/client-iot/src/pagination/ListRelatedResourcesForAuditFindingPaginator.ts index fd5d5647ea93..dbe4cd0e92da 100644 --- a/clients/client-iot/src/pagination/ListRelatedResourcesForAuditFindingPaginator.ts +++ b/clients/client-iot/src/pagination/ListRelatedResourcesForAuditFindingPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListRelatedResourcesForAuditFindingCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRelatedResourcesForAuditFindingCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRelatedResourcesForAuditFinding( +export const paginateListRelatedResourcesForAuditFinding: ( config: IoTPaginationConfiguration, input: ListRelatedResourcesForAuditFindingCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRelatedResourcesForAuditFindingCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListRelatedResourcesForAuditFindingCommandInput, + ListRelatedResourcesForAuditFindingCommandOutput +>(IoTClient, ListRelatedResourcesForAuditFindingCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListRoleAliasesPaginator.ts b/clients/client-iot/src/pagination/ListRoleAliasesPaginator.ts index 4809cefe4aab..59a6f3655f2c 100644 --- a/clients/client-iot/src/pagination/ListRoleAliasesPaginator.ts +++ b/clients/client-iot/src/pagination/ListRoleAliasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListRoleAliasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRoleAliasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRoleAliases( +export const paginateListRoleAliases: ( config: IoTPaginationConfiguration, input: ListRoleAliasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRoleAliasesCommandOutput; - while (hasNext) { - input.marker = token; - input["pageSize"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListRoleAliasesCommandInput, + ListRoleAliasesCommandOutput +>(IoTClient, ListRoleAliasesCommand, "marker", "nextMarker", "pageSize"); diff --git a/clients/client-iot/src/pagination/ListScheduledAuditsPaginator.ts b/clients/client-iot/src/pagination/ListScheduledAuditsPaginator.ts index ee9afc1a68e8..63cc395d5bd4 100644 --- a/clients/client-iot/src/pagination/ListScheduledAuditsPaginator.ts +++ b/clients/client-iot/src/pagination/ListScheduledAuditsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListScheduledAuditsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListScheduledAuditsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListScheduledAudits( +export const paginateListScheduledAudits: ( config: IoTPaginationConfiguration, input: ListScheduledAuditsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListScheduledAuditsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListScheduledAuditsCommandInput, + ListScheduledAuditsCommandOutput +>(IoTClient, ListScheduledAuditsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListSecurityProfilesForTargetPaginator.ts b/clients/client-iot/src/pagination/ListSecurityProfilesForTargetPaginator.ts index 3d5eeb1c13d9..360757c1d51d 100644 --- a/clients/client-iot/src/pagination/ListSecurityProfilesForTargetPaginator.ts +++ b/clients/client-iot/src/pagination/ListSecurityProfilesForTargetPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListSecurityProfilesForTargetCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSecurityProfilesForTargetCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSecurityProfilesForTarget( +export const paginateListSecurityProfilesForTarget: ( config: IoTPaginationConfiguration, input: ListSecurityProfilesForTargetCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSecurityProfilesForTargetCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListSecurityProfilesForTargetCommandInput, + ListSecurityProfilesForTargetCommandOutput +>(IoTClient, ListSecurityProfilesForTargetCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListSecurityProfilesPaginator.ts b/clients/client-iot/src/pagination/ListSecurityProfilesPaginator.ts index e98d7b7366dc..c7a1b2bac73a 100644 --- a/clients/client-iot/src/pagination/ListSecurityProfilesPaginator.ts +++ b/clients/client-iot/src/pagination/ListSecurityProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListSecurityProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSecurityProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSecurityProfiles( +export const paginateListSecurityProfiles: ( config: IoTPaginationConfiguration, input: ListSecurityProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSecurityProfilesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListSecurityProfilesCommandInput, + ListSecurityProfilesCommandOutput +>(IoTClient, ListSecurityProfilesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListStreamsPaginator.ts b/clients/client-iot/src/pagination/ListStreamsPaginator.ts index e7e10b1977ab..dab8ede7a084 100644 --- a/clients/client-iot/src/pagination/ListStreamsPaginator.ts +++ b/clients/client-iot/src/pagination/ListStreamsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListStreamsCommand, ListStreamsCommandInput, ListStreamsCommandOutput } from "../commands/ListStreamsCommand"; import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListStreamsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStreamsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStreams( +export const paginateListStreams: ( config: IoTPaginationConfiguration, input: ListStreamsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStreamsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListStreamsCommandInput, + ListStreamsCommandOutput +>(IoTClient, ListStreamsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-iot/src/pagination/ListTagsForResourcePaginator.ts index fe621c808247..2c7c8aa6c845 100644 --- a/clients/client-iot/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-iot/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: IoTPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(IoTClient, ListTagsForResourceCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-iot/src/pagination/ListTargetsForPolicyPaginator.ts b/clients/client-iot/src/pagination/ListTargetsForPolicyPaginator.ts index 9ef0f94a992d..d444e7810327 100644 --- a/clients/client-iot/src/pagination/ListTargetsForPolicyPaginator.ts +++ b/clients/client-iot/src/pagination/ListTargetsForPolicyPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListTargetsForPolicyCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTargetsForPolicyCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTargetsForPolicy( +export const paginateListTargetsForPolicy: ( config: IoTPaginationConfiguration, input: ListTargetsForPolicyCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.marker - let token: typeof input.marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTargetsForPolicyCommandOutput; - while (hasNext) { - input.marker = token; - input["pageSize"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListTargetsForPolicyCommandInput, + ListTargetsForPolicyCommandOutput +>(IoTClient, ListTargetsForPolicyCommand, "marker", "nextMarker", "pageSize"); diff --git a/clients/client-iot/src/pagination/ListTargetsForSecurityProfilePaginator.ts b/clients/client-iot/src/pagination/ListTargetsForSecurityProfilePaginator.ts index 58f18d96f163..c058e0513556 100644 --- a/clients/client-iot/src/pagination/ListTargetsForSecurityProfilePaginator.ts +++ b/clients/client-iot/src/pagination/ListTargetsForSecurityProfilePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListTargetsForSecurityProfileCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTargetsForSecurityProfileCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTargetsForSecurityProfile( +export const paginateListTargetsForSecurityProfile: ( config: IoTPaginationConfiguration, input: ListTargetsForSecurityProfileCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTargetsForSecurityProfileCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListTargetsForSecurityProfileCommandInput, + ListTargetsForSecurityProfileCommandOutput +>(IoTClient, ListTargetsForSecurityProfileCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListThingGroupsForThingPaginator.ts b/clients/client-iot/src/pagination/ListThingGroupsForThingPaginator.ts index 6ab9eaf15243..96163efb7396 100644 --- a/clients/client-iot/src/pagination/ListThingGroupsForThingPaginator.ts +++ b/clients/client-iot/src/pagination/ListThingGroupsForThingPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListThingGroupsForThingCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThingGroupsForThingCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThingGroupsForThing( +export const paginateListThingGroupsForThing: ( config: IoTPaginationConfiguration, input: ListThingGroupsForThingCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThingGroupsForThingCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListThingGroupsForThingCommandInput, + ListThingGroupsForThingCommandOutput +>(IoTClient, ListThingGroupsForThingCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListThingGroupsPaginator.ts b/clients/client-iot/src/pagination/ListThingGroupsPaginator.ts index e38470533f9f..d9331b11b06c 100644 --- a/clients/client-iot/src/pagination/ListThingGroupsPaginator.ts +++ b/clients/client-iot/src/pagination/ListThingGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListThingGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThingGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThingGroups( +export const paginateListThingGroups: ( config: IoTPaginationConfiguration, input: ListThingGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThingGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListThingGroupsCommandInput, + ListThingGroupsCommandOutput +>(IoTClient, ListThingGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListThingPrincipalsPaginator.ts b/clients/client-iot/src/pagination/ListThingPrincipalsPaginator.ts index d3ce997e2413..64af815c691f 100644 --- a/clients/client-iot/src/pagination/ListThingPrincipalsPaginator.ts +++ b/clients/client-iot/src/pagination/ListThingPrincipalsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListThingPrincipalsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThingPrincipalsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThingPrincipals( +export const paginateListThingPrincipals: ( config: IoTPaginationConfiguration, input: ListThingPrincipalsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThingPrincipalsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListThingPrincipalsCommandInput, + ListThingPrincipalsCommandOutput +>(IoTClient, ListThingPrincipalsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListThingRegistrationTaskReportsPaginator.ts b/clients/client-iot/src/pagination/ListThingRegistrationTaskReportsPaginator.ts index 57bef13a49c1..72fc3fd2b435 100644 --- a/clients/client-iot/src/pagination/ListThingRegistrationTaskReportsPaginator.ts +++ b/clients/client-iot/src/pagination/ListThingRegistrationTaskReportsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListThingRegistrationTaskReportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThingRegistrationTaskReportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThingRegistrationTaskReports( +export const paginateListThingRegistrationTaskReports: ( config: IoTPaginationConfiguration, input: ListThingRegistrationTaskReportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThingRegistrationTaskReportsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListThingRegistrationTaskReportsCommandInput, + ListThingRegistrationTaskReportsCommandOutput +>(IoTClient, ListThingRegistrationTaskReportsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListThingRegistrationTasksPaginator.ts b/clients/client-iot/src/pagination/ListThingRegistrationTasksPaginator.ts index 1617658c76ce..25d0a7b086b6 100644 --- a/clients/client-iot/src/pagination/ListThingRegistrationTasksPaginator.ts +++ b/clients/client-iot/src/pagination/ListThingRegistrationTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListThingRegistrationTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThingRegistrationTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThingRegistrationTasks( +export const paginateListThingRegistrationTasks: ( config: IoTPaginationConfiguration, input: ListThingRegistrationTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThingRegistrationTasksCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListThingRegistrationTasksCommandInput, + ListThingRegistrationTasksCommandOutput +>(IoTClient, ListThingRegistrationTasksCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListThingTypesPaginator.ts b/clients/client-iot/src/pagination/ListThingTypesPaginator.ts index 6bd387496856..36e71da77e48 100644 --- a/clients/client-iot/src/pagination/ListThingTypesPaginator.ts +++ b/clients/client-iot/src/pagination/ListThingTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListThingTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThingTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThingTypes( +export const paginateListThingTypes: ( config: IoTPaginationConfiguration, input: ListThingTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThingTypesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListThingTypesCommandInput, + ListThingTypesCommandOutput +>(IoTClient, ListThingTypesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListThingsInBillingGroupPaginator.ts b/clients/client-iot/src/pagination/ListThingsInBillingGroupPaginator.ts index 047db633a2a5..e3988b8bd77a 100644 --- a/clients/client-iot/src/pagination/ListThingsInBillingGroupPaginator.ts +++ b/clients/client-iot/src/pagination/ListThingsInBillingGroupPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListThingsInBillingGroupCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThingsInBillingGroupCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThingsInBillingGroup( +export const paginateListThingsInBillingGroup: ( config: IoTPaginationConfiguration, input: ListThingsInBillingGroupCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThingsInBillingGroupCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListThingsInBillingGroupCommandInput, + ListThingsInBillingGroupCommandOutput +>(IoTClient, ListThingsInBillingGroupCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListThingsInThingGroupPaginator.ts b/clients/client-iot/src/pagination/ListThingsInThingGroupPaginator.ts index 5c12c613f77d..e6bf3302fdad 100644 --- a/clients/client-iot/src/pagination/ListThingsInThingGroupPaginator.ts +++ b/clients/client-iot/src/pagination/ListThingsInThingGroupPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListThingsInThingGroupCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThingsInThingGroupCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThingsInThingGroup( +export const paginateListThingsInThingGroup: ( config: IoTPaginationConfiguration, input: ListThingsInThingGroupCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThingsInThingGroupCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListThingsInThingGroupCommandInput, + ListThingsInThingGroupCommandOutput +>(IoTClient, ListThingsInThingGroupCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListThingsPaginator.ts b/clients/client-iot/src/pagination/ListThingsPaginator.ts index ec8d6ad15df2..006dd4e08837 100644 --- a/clients/client-iot/src/pagination/ListThingsPaginator.ts +++ b/clients/client-iot/src/pagination/ListThingsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListThingsCommand, ListThingsCommandInput, ListThingsCommandOutput } from "../commands/ListThingsCommand"; import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListThingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThings( +export const paginateListThings: ( config: IoTPaginationConfiguration, input: ListThingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListThingsCommandInput, + ListThingsCommandOutput +>(IoTClient, ListThingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListTopicRuleDestinationsPaginator.ts b/clients/client-iot/src/pagination/ListTopicRuleDestinationsPaginator.ts index 4aa1add48c87..a0f00698efab 100644 --- a/clients/client-iot/src/pagination/ListTopicRuleDestinationsPaginator.ts +++ b/clients/client-iot/src/pagination/ListTopicRuleDestinationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListTopicRuleDestinationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTopicRuleDestinationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTopicRuleDestinations( +export const paginateListTopicRuleDestinations: ( config: IoTPaginationConfiguration, input: ListTopicRuleDestinationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTopicRuleDestinationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListTopicRuleDestinationsCommandInput, + ListTopicRuleDestinationsCommandOutput +>(IoTClient, ListTopicRuleDestinationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListTopicRulesPaginator.ts b/clients/client-iot/src/pagination/ListTopicRulesPaginator.ts index 477b45be5d79..e2f39587391b 100644 --- a/clients/client-iot/src/pagination/ListTopicRulesPaginator.ts +++ b/clients/client-iot/src/pagination/ListTopicRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListTopicRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTopicRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTopicRules( +export const paginateListTopicRules: ( config: IoTPaginationConfiguration, input: ListTopicRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTopicRulesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListTopicRulesCommandInput, + ListTopicRulesCommandOutput +>(IoTClient, ListTopicRulesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListV2LoggingLevelsPaginator.ts b/clients/client-iot/src/pagination/ListV2LoggingLevelsPaginator.ts index 9c51f6d73108..3848c91ad62e 100644 --- a/clients/client-iot/src/pagination/ListV2LoggingLevelsPaginator.ts +++ b/clients/client-iot/src/pagination/ListV2LoggingLevelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListV2LoggingLevelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListV2LoggingLevelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListV2LoggingLevels( +export const paginateListV2LoggingLevels: ( config: IoTPaginationConfiguration, input: ListV2LoggingLevelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListV2LoggingLevelsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListV2LoggingLevelsCommandInput, + ListV2LoggingLevelsCommandOutput +>(IoTClient, ListV2LoggingLevelsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iot/src/pagination/ListViolationEventsPaginator.ts b/clients/client-iot/src/pagination/ListViolationEventsPaginator.ts index f805229db90d..aeaf205c4bf6 100644 --- a/clients/client-iot/src/pagination/ListViolationEventsPaginator.ts +++ b/clients/client-iot/src/pagination/ListViolationEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTClient } from "../IoTClient"; import { IoTPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTClient, - input: ListViolationEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListViolationEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListViolationEvents( +export const paginateListViolationEvents: ( config: IoTPaginationConfiguration, input: ListViolationEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListViolationEventsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoT | IoTClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTPaginationConfiguration, + ListViolationEventsCommandInput, + ListViolationEventsCommandOutput +>(IoTClient, ListViolationEventsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotanalytics/src/pagination/ListChannelsPaginator.ts b/clients/client-iotanalytics/src/pagination/ListChannelsPaginator.ts index 294da4bf9ae8..322fea89883b 100644 --- a/clients/client-iotanalytics/src/pagination/ListChannelsPaginator.ts +++ b/clients/client-iotanalytics/src/pagination/ListChannelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTAnalyticsClient } from "../IoTAnalyticsClient"; import { IoTAnalyticsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTAnalyticsClient, - input: ListChannelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannels( +export const paginateListChannels: ( config: IoTAnalyticsPaginationConfiguration, input: ListChannelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTAnalyticsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTAnalytics | IoTAnalyticsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTAnalyticsPaginationConfiguration, + ListChannelsCommandInput, + ListChannelsCommandOutput +>(IoTAnalyticsClient, ListChannelsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotanalytics/src/pagination/ListDatasetContentsPaginator.ts b/clients/client-iotanalytics/src/pagination/ListDatasetContentsPaginator.ts index 6fa3cf0dfcf1..f1376e0e4ad1 100644 --- a/clients/client-iotanalytics/src/pagination/ListDatasetContentsPaginator.ts +++ b/clients/client-iotanalytics/src/pagination/ListDatasetContentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTAnalyticsClient } from "../IoTAnalyticsClient"; import { IoTAnalyticsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTAnalyticsClient, - input: ListDatasetContentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetContentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasetContents( +export const paginateListDatasetContents: ( config: IoTAnalyticsPaginationConfiguration, input: ListDatasetContentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetContentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTAnalyticsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTAnalytics | IoTAnalyticsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTAnalyticsPaginationConfiguration, + ListDatasetContentsCommandInput, + ListDatasetContentsCommandOutput +>(IoTAnalyticsClient, ListDatasetContentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotanalytics/src/pagination/ListDatasetsPaginator.ts b/clients/client-iotanalytics/src/pagination/ListDatasetsPaginator.ts index 19b10eac2177..1c7876c62014 100644 --- a/clients/client-iotanalytics/src/pagination/ListDatasetsPaginator.ts +++ b/clients/client-iotanalytics/src/pagination/ListDatasetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTAnalyticsClient } from "../IoTAnalyticsClient"; import { IoTAnalyticsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTAnalyticsClient, - input: ListDatasetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasets( +export const paginateListDatasets: ( config: IoTAnalyticsPaginationConfiguration, input: ListDatasetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTAnalyticsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTAnalytics | IoTAnalyticsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTAnalyticsPaginationConfiguration, + ListDatasetsCommandInput, + ListDatasetsCommandOutput +>(IoTAnalyticsClient, ListDatasetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotanalytics/src/pagination/ListDatastoresPaginator.ts b/clients/client-iotanalytics/src/pagination/ListDatastoresPaginator.ts index 709a176cc72a..256e85ff1dd9 100644 --- a/clients/client-iotanalytics/src/pagination/ListDatastoresPaginator.ts +++ b/clients/client-iotanalytics/src/pagination/ListDatastoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTAnalyticsClient } from "../IoTAnalyticsClient"; import { IoTAnalyticsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTAnalyticsClient, - input: ListDatastoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatastoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatastores( +export const paginateListDatastores: ( config: IoTAnalyticsPaginationConfiguration, input: ListDatastoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatastoresCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTAnalyticsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTAnalytics | IoTAnalyticsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTAnalyticsPaginationConfiguration, + ListDatastoresCommandInput, + ListDatastoresCommandOutput +>(IoTAnalyticsClient, ListDatastoresCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotanalytics/src/pagination/ListPipelinesPaginator.ts b/clients/client-iotanalytics/src/pagination/ListPipelinesPaginator.ts index 072976ac9aa3..31c09a97acff 100644 --- a/clients/client-iotanalytics/src/pagination/ListPipelinesPaginator.ts +++ b/clients/client-iotanalytics/src/pagination/ListPipelinesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTAnalyticsClient } from "../IoTAnalyticsClient"; import { IoTAnalyticsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTAnalyticsClient, - input: ListPipelinesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPipelinesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPipelines( +export const paginateListPipelines: ( config: IoTAnalyticsPaginationConfiguration, input: ListPipelinesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPipelinesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTAnalyticsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTAnalytics | IoTAnalyticsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTAnalyticsPaginationConfiguration, + ListPipelinesCommandInput, + ListPipelinesCommandOutput +>(IoTAnalyticsClient, ListPipelinesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotdeviceadvisor/src/pagination/ListSuiteDefinitionsPaginator.ts b/clients/client-iotdeviceadvisor/src/pagination/ListSuiteDefinitionsPaginator.ts index bb8a27b9d196..49f01bab0ed7 100644 --- a/clients/client-iotdeviceadvisor/src/pagination/ListSuiteDefinitionsPaginator.ts +++ b/clients/client-iotdeviceadvisor/src/pagination/ListSuiteDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IotDeviceAdvisorClient } from "../IotDeviceAdvisorClient"; import { IotDeviceAdvisorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IotDeviceAdvisorClient, - input: ListSuiteDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSuiteDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSuiteDefinitions( +export const paginateListSuiteDefinitions: ( config: IotDeviceAdvisorPaginationConfiguration, input: ListSuiteDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSuiteDefinitionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IotDeviceAdvisorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IotDeviceAdvisor | IotDeviceAdvisorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IotDeviceAdvisorPaginationConfiguration, + ListSuiteDefinitionsCommandInput, + ListSuiteDefinitionsCommandOutput +>(IotDeviceAdvisorClient, ListSuiteDefinitionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotdeviceadvisor/src/pagination/ListSuiteRunsPaginator.ts b/clients/client-iotdeviceadvisor/src/pagination/ListSuiteRunsPaginator.ts index a7a85c75628d..402eebc33978 100644 --- a/clients/client-iotdeviceadvisor/src/pagination/ListSuiteRunsPaginator.ts +++ b/clients/client-iotdeviceadvisor/src/pagination/ListSuiteRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IotDeviceAdvisorClient } from "../IotDeviceAdvisorClient"; import { IotDeviceAdvisorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IotDeviceAdvisorClient, - input: ListSuiteRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSuiteRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSuiteRuns( +export const paginateListSuiteRuns: ( config: IotDeviceAdvisorPaginationConfiguration, input: ListSuiteRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSuiteRunsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IotDeviceAdvisorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IotDeviceAdvisor | IotDeviceAdvisorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IotDeviceAdvisorPaginationConfiguration, + ListSuiteRunsCommandInput, + ListSuiteRunsCommandOutput +>(IotDeviceAdvisorClient, ListSuiteRunsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotfleethub/src/pagination/ListApplicationsPaginator.ts b/clients/client-iotfleethub/src/pagination/ListApplicationsPaginator.ts index 74639b75457f..b09f40987a3e 100644 --- a/clients/client-iotfleethub/src/pagination/ListApplicationsPaginator.ts +++ b/clients/client-iotfleethub/src/pagination/ListApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { IoTFleetHubClient } from "../IoTFleetHubClient"; import { IoTFleetHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTFleetHubClient, - input: ListApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplications( +export const paginateListApplications: ( config: IoTFleetHubPaginationConfiguration, input: ListApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof IoTFleetHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTFleetHub | IoTFleetHubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTFleetHubPaginationConfiguration, + ListApplicationsCommandInput, + ListApplicationsCommandOutput +>(IoTFleetHubClient, ListApplicationsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-iotfleetwise/package.json b/clients/client-iotfleetwise/package.json index 54ff725dd1d8..a74e6157169d 100644 --- a/clients/client-iotfleetwise/package.json +++ b/clients/client-iotfleetwise/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-iotfleetwise/src/pagination/GetVehicleStatusPaginator.ts b/clients/client-iotfleetwise/src/pagination/GetVehicleStatusPaginator.ts index 7548b6283ce3..951e9c26e861 100644 --- a/clients/client-iotfleetwise/src/pagination/GetVehicleStatusPaginator.ts +++ b/clients/client-iotfleetwise/src/pagination/GetVehicleStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTFleetWiseClient } from "../IoTFleetWiseClient"; import { IoTFleetWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTFleetWiseClient, - input: GetVehicleStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetVehicleStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetVehicleStatus( +export const paginateGetVehicleStatus: ( config: IoTFleetWisePaginationConfiguration, input: GetVehicleStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetVehicleStatusCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTFleetWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTFleetWise | IoTFleetWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTFleetWisePaginationConfiguration, + GetVehicleStatusCommandInput, + GetVehicleStatusCommandOutput +>(IoTFleetWiseClient, GetVehicleStatusCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotfleetwise/src/pagination/ListCampaignsPaginator.ts b/clients/client-iotfleetwise/src/pagination/ListCampaignsPaginator.ts index 2600b86d22f9..92dc559e7b21 100644 --- a/clients/client-iotfleetwise/src/pagination/ListCampaignsPaginator.ts +++ b/clients/client-iotfleetwise/src/pagination/ListCampaignsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTFleetWiseClient } from "../IoTFleetWiseClient"; import { IoTFleetWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTFleetWiseClient, - input: ListCampaignsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCampaignsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCampaigns( +export const paginateListCampaigns: ( config: IoTFleetWisePaginationConfiguration, input: ListCampaignsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCampaignsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTFleetWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTFleetWise | IoTFleetWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTFleetWisePaginationConfiguration, + ListCampaignsCommandInput, + ListCampaignsCommandOutput +>(IoTFleetWiseClient, ListCampaignsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotfleetwise/src/pagination/ListDecoderManifestNetworkInterfacesPaginator.ts b/clients/client-iotfleetwise/src/pagination/ListDecoderManifestNetworkInterfacesPaginator.ts index de0165eb7e92..6f678eb6b4f3 100644 --- a/clients/client-iotfleetwise/src/pagination/ListDecoderManifestNetworkInterfacesPaginator.ts +++ b/clients/client-iotfleetwise/src/pagination/ListDecoderManifestNetworkInterfacesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTFleetWiseClient } from "../IoTFleetWiseClient"; import { IoTFleetWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTFleetWiseClient, - input: ListDecoderManifestNetworkInterfacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDecoderManifestNetworkInterfacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDecoderManifestNetworkInterfaces( +export const paginateListDecoderManifestNetworkInterfaces: ( config: IoTFleetWisePaginationConfiguration, input: ListDecoderManifestNetworkInterfacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDecoderManifestNetworkInterfacesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTFleetWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTFleetWise | IoTFleetWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTFleetWisePaginationConfiguration, + ListDecoderManifestNetworkInterfacesCommandInput, + ListDecoderManifestNetworkInterfacesCommandOutput +>(IoTFleetWiseClient, ListDecoderManifestNetworkInterfacesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotfleetwise/src/pagination/ListDecoderManifestSignalsPaginator.ts b/clients/client-iotfleetwise/src/pagination/ListDecoderManifestSignalsPaginator.ts index c79b0b28f8a0..f8f3c7e9bb83 100644 --- a/clients/client-iotfleetwise/src/pagination/ListDecoderManifestSignalsPaginator.ts +++ b/clients/client-iotfleetwise/src/pagination/ListDecoderManifestSignalsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTFleetWiseClient } from "../IoTFleetWiseClient"; import { IoTFleetWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTFleetWiseClient, - input: ListDecoderManifestSignalsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDecoderManifestSignalsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDecoderManifestSignals( +export const paginateListDecoderManifestSignals: ( config: IoTFleetWisePaginationConfiguration, input: ListDecoderManifestSignalsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDecoderManifestSignalsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTFleetWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTFleetWise | IoTFleetWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTFleetWisePaginationConfiguration, + ListDecoderManifestSignalsCommandInput, + ListDecoderManifestSignalsCommandOutput +>(IoTFleetWiseClient, ListDecoderManifestSignalsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotfleetwise/src/pagination/ListDecoderManifestsPaginator.ts b/clients/client-iotfleetwise/src/pagination/ListDecoderManifestsPaginator.ts index b8a408d79a5a..2c68d72ae5d9 100644 --- a/clients/client-iotfleetwise/src/pagination/ListDecoderManifestsPaginator.ts +++ b/clients/client-iotfleetwise/src/pagination/ListDecoderManifestsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTFleetWiseClient } from "../IoTFleetWiseClient"; import { IoTFleetWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTFleetWiseClient, - input: ListDecoderManifestsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDecoderManifestsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDecoderManifests( +export const paginateListDecoderManifests: ( config: IoTFleetWisePaginationConfiguration, input: ListDecoderManifestsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDecoderManifestsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTFleetWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTFleetWise | IoTFleetWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTFleetWisePaginationConfiguration, + ListDecoderManifestsCommandInput, + ListDecoderManifestsCommandOutput +>(IoTFleetWiseClient, ListDecoderManifestsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotfleetwise/src/pagination/ListFleetsForVehiclePaginator.ts b/clients/client-iotfleetwise/src/pagination/ListFleetsForVehiclePaginator.ts index 372ffca77bf7..901da982d8b4 100644 --- a/clients/client-iotfleetwise/src/pagination/ListFleetsForVehiclePaginator.ts +++ b/clients/client-iotfleetwise/src/pagination/ListFleetsForVehiclePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTFleetWiseClient } from "../IoTFleetWiseClient"; import { IoTFleetWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTFleetWiseClient, - input: ListFleetsForVehicleCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFleetsForVehicleCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFleetsForVehicle( +export const paginateListFleetsForVehicle: ( config: IoTFleetWisePaginationConfiguration, input: ListFleetsForVehicleCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFleetsForVehicleCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTFleetWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTFleetWise | IoTFleetWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTFleetWisePaginationConfiguration, + ListFleetsForVehicleCommandInput, + ListFleetsForVehicleCommandOutput +>(IoTFleetWiseClient, ListFleetsForVehicleCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotfleetwise/src/pagination/ListFleetsPaginator.ts b/clients/client-iotfleetwise/src/pagination/ListFleetsPaginator.ts index 546505961273..02b4b59b8f3a 100644 --- a/clients/client-iotfleetwise/src/pagination/ListFleetsPaginator.ts +++ b/clients/client-iotfleetwise/src/pagination/ListFleetsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListFleetsCommand, ListFleetsCommandInput, ListFleetsCommandOutput } from "../commands/ListFleetsCommand"; import { IoTFleetWiseClient } from "../IoTFleetWiseClient"; import { IoTFleetWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTFleetWiseClient, - input: ListFleetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFleetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFleets( +export const paginateListFleets: ( config: IoTFleetWisePaginationConfiguration, input: ListFleetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFleetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTFleetWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTFleetWise | IoTFleetWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTFleetWisePaginationConfiguration, + ListFleetsCommandInput, + ListFleetsCommandOutput +>(IoTFleetWiseClient, ListFleetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotfleetwise/src/pagination/ListModelManifestNodesPaginator.ts b/clients/client-iotfleetwise/src/pagination/ListModelManifestNodesPaginator.ts index ec24aaca1bc7..3b2173849910 100644 --- a/clients/client-iotfleetwise/src/pagination/ListModelManifestNodesPaginator.ts +++ b/clients/client-iotfleetwise/src/pagination/ListModelManifestNodesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTFleetWiseClient } from "../IoTFleetWiseClient"; import { IoTFleetWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTFleetWiseClient, - input: ListModelManifestNodesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelManifestNodesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModelManifestNodes( +export const paginateListModelManifestNodes: ( config: IoTFleetWisePaginationConfiguration, input: ListModelManifestNodesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelManifestNodesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTFleetWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTFleetWise | IoTFleetWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTFleetWisePaginationConfiguration, + ListModelManifestNodesCommandInput, + ListModelManifestNodesCommandOutput +>(IoTFleetWiseClient, ListModelManifestNodesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotfleetwise/src/pagination/ListModelManifestsPaginator.ts b/clients/client-iotfleetwise/src/pagination/ListModelManifestsPaginator.ts index caf2361ea0b1..e78711eec435 100644 --- a/clients/client-iotfleetwise/src/pagination/ListModelManifestsPaginator.ts +++ b/clients/client-iotfleetwise/src/pagination/ListModelManifestsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTFleetWiseClient } from "../IoTFleetWiseClient"; import { IoTFleetWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTFleetWiseClient, - input: ListModelManifestsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelManifestsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModelManifests( +export const paginateListModelManifests: ( config: IoTFleetWisePaginationConfiguration, input: ListModelManifestsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelManifestsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTFleetWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTFleetWise | IoTFleetWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTFleetWisePaginationConfiguration, + ListModelManifestsCommandInput, + ListModelManifestsCommandOutput +>(IoTFleetWiseClient, ListModelManifestsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotfleetwise/src/pagination/ListSignalCatalogNodesPaginator.ts b/clients/client-iotfleetwise/src/pagination/ListSignalCatalogNodesPaginator.ts index 84b66355c728..4a19fbfb9adb 100644 --- a/clients/client-iotfleetwise/src/pagination/ListSignalCatalogNodesPaginator.ts +++ b/clients/client-iotfleetwise/src/pagination/ListSignalCatalogNodesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTFleetWiseClient } from "../IoTFleetWiseClient"; import { IoTFleetWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTFleetWiseClient, - input: ListSignalCatalogNodesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSignalCatalogNodesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSignalCatalogNodes( +export const paginateListSignalCatalogNodes: ( config: IoTFleetWisePaginationConfiguration, input: ListSignalCatalogNodesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSignalCatalogNodesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTFleetWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTFleetWise | IoTFleetWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTFleetWisePaginationConfiguration, + ListSignalCatalogNodesCommandInput, + ListSignalCatalogNodesCommandOutput +>(IoTFleetWiseClient, ListSignalCatalogNodesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotfleetwise/src/pagination/ListSignalCatalogsPaginator.ts b/clients/client-iotfleetwise/src/pagination/ListSignalCatalogsPaginator.ts index e1dfcac12738..530768dad004 100644 --- a/clients/client-iotfleetwise/src/pagination/ListSignalCatalogsPaginator.ts +++ b/clients/client-iotfleetwise/src/pagination/ListSignalCatalogsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTFleetWiseClient } from "../IoTFleetWiseClient"; import { IoTFleetWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTFleetWiseClient, - input: ListSignalCatalogsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSignalCatalogsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSignalCatalogs( +export const paginateListSignalCatalogs: ( config: IoTFleetWisePaginationConfiguration, input: ListSignalCatalogsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSignalCatalogsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTFleetWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTFleetWise | IoTFleetWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTFleetWisePaginationConfiguration, + ListSignalCatalogsCommandInput, + ListSignalCatalogsCommandOutput +>(IoTFleetWiseClient, ListSignalCatalogsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotfleetwise/src/pagination/ListVehiclesInFleetPaginator.ts b/clients/client-iotfleetwise/src/pagination/ListVehiclesInFleetPaginator.ts index b477a511247e..b0274fd4dfd4 100644 --- a/clients/client-iotfleetwise/src/pagination/ListVehiclesInFleetPaginator.ts +++ b/clients/client-iotfleetwise/src/pagination/ListVehiclesInFleetPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTFleetWiseClient } from "../IoTFleetWiseClient"; import { IoTFleetWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTFleetWiseClient, - input: ListVehiclesInFleetCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVehiclesInFleetCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVehiclesInFleet( +export const paginateListVehiclesInFleet: ( config: IoTFleetWisePaginationConfiguration, input: ListVehiclesInFleetCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVehiclesInFleetCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTFleetWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTFleetWise | IoTFleetWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTFleetWisePaginationConfiguration, + ListVehiclesInFleetCommandInput, + ListVehiclesInFleetCommandOutput +>(IoTFleetWiseClient, ListVehiclesInFleetCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotfleetwise/src/pagination/ListVehiclesPaginator.ts b/clients/client-iotfleetwise/src/pagination/ListVehiclesPaginator.ts index 6f8f5cbcd940..67064836a060 100644 --- a/clients/client-iotfleetwise/src/pagination/ListVehiclesPaginator.ts +++ b/clients/client-iotfleetwise/src/pagination/ListVehiclesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTFleetWiseClient } from "../IoTFleetWiseClient"; import { IoTFleetWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTFleetWiseClient, - input: ListVehiclesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVehiclesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVehicles( +export const paginateListVehicles: ( config: IoTFleetWisePaginationConfiguration, input: ListVehiclesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVehiclesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTFleetWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTFleetWise | IoTFleetWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTFleetWisePaginationConfiguration, + ListVehiclesCommandInput, + ListVehiclesCommandOutput +>(IoTFleetWiseClient, ListVehiclesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsecuretunneling/package.json b/clients/client-iotsecuretunneling/package.json index 7790e39565e6..2178d3b73200 100644 --- a/clients/client-iotsecuretunneling/package.json +++ b/clients/client-iotsecuretunneling/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-iotsecuretunneling/src/pagination/ListTunnelsPaginator.ts b/clients/client-iotsecuretunneling/src/pagination/ListTunnelsPaginator.ts index 9528632be295..5b6304cc83f4 100644 --- a/clients/client-iotsecuretunneling/src/pagination/ListTunnelsPaginator.ts +++ b/clients/client-iotsecuretunneling/src/pagination/ListTunnelsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTunnelsCommand, ListTunnelsCommandInput, ListTunnelsCommandOutput } from "../commands/ListTunnelsCommand"; import { IoTSecureTunnelingClient } from "../IoTSecureTunnelingClient"; import { IoTSecureTunnelingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSecureTunnelingClient, - input: ListTunnelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTunnelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTunnels( +export const paginateListTunnels: ( config: IoTSecureTunnelingPaginationConfiguration, input: ListTunnelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTunnelsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSecureTunnelingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSecureTunneling | IoTSecureTunnelingClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSecureTunnelingPaginationConfiguration, + ListTunnelsCommandInput, + ListTunnelsCommandOutput +>(IoTSecureTunnelingClient, ListTunnelsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/BatchGetAssetPropertyAggregatesPaginator.ts b/clients/client-iotsitewise/src/pagination/BatchGetAssetPropertyAggregatesPaginator.ts index c9b907ccd4cb..5dd7662484b5 100644 --- a/clients/client-iotsitewise/src/pagination/BatchGetAssetPropertyAggregatesPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/BatchGetAssetPropertyAggregatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: BatchGetAssetPropertyAggregatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new BatchGetAssetPropertyAggregatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateBatchGetAssetPropertyAggregates( +export const paginateBatchGetAssetPropertyAggregates: ( config: IoTSiteWisePaginationConfiguration, input: BatchGetAssetPropertyAggregatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: BatchGetAssetPropertyAggregatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + BatchGetAssetPropertyAggregatesCommandInput, + BatchGetAssetPropertyAggregatesCommandOutput +>(IoTSiteWiseClient, BatchGetAssetPropertyAggregatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/BatchGetAssetPropertyValueHistoryPaginator.ts b/clients/client-iotsitewise/src/pagination/BatchGetAssetPropertyValueHistoryPaginator.ts index c248eac36ab6..c156cb80420d 100644 --- a/clients/client-iotsitewise/src/pagination/BatchGetAssetPropertyValueHistoryPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/BatchGetAssetPropertyValueHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: BatchGetAssetPropertyValueHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new BatchGetAssetPropertyValueHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateBatchGetAssetPropertyValueHistory( +export const paginateBatchGetAssetPropertyValueHistory: ( config: IoTSiteWisePaginationConfiguration, input: BatchGetAssetPropertyValueHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: BatchGetAssetPropertyValueHistoryCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + BatchGetAssetPropertyValueHistoryCommandInput, + BatchGetAssetPropertyValueHistoryCommandOutput +>(IoTSiteWiseClient, BatchGetAssetPropertyValueHistoryCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/BatchGetAssetPropertyValuePaginator.ts b/clients/client-iotsitewise/src/pagination/BatchGetAssetPropertyValuePaginator.ts index 2083cba63c60..caf359bde060 100644 --- a/clients/client-iotsitewise/src/pagination/BatchGetAssetPropertyValuePaginator.ts +++ b/clients/client-iotsitewise/src/pagination/BatchGetAssetPropertyValuePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: BatchGetAssetPropertyValueCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new BatchGetAssetPropertyValueCommand(input), ...args); -}; /** * @public */ -export async function* paginateBatchGetAssetPropertyValue( +export const paginateBatchGetAssetPropertyValue: ( config: IoTSiteWisePaginationConfiguration, input: BatchGetAssetPropertyValueCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: BatchGetAssetPropertyValueCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + BatchGetAssetPropertyValueCommandInput, + BatchGetAssetPropertyValueCommandOutput +>(IoTSiteWiseClient, BatchGetAssetPropertyValueCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-iotsitewise/src/pagination/ExecuteQueryPaginator.ts b/clients/client-iotsitewise/src/pagination/ExecuteQueryPaginator.ts index d3aba50b17b2..f3f0ab8eb93c 100644 --- a/clients/client-iotsitewise/src/pagination/ExecuteQueryPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ExecuteQueryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ExecuteQueryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ExecuteQueryCommand(input), ...args); -}; /** * @public */ -export async function* paginateExecuteQuery( +export const paginateExecuteQuery: ( config: IoTSiteWisePaginationConfiguration, input: ExecuteQueryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ExecuteQueryCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ExecuteQueryCommandInput, + ExecuteQueryCommandOutput +>(IoTSiteWiseClient, ExecuteQueryCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/GetAssetPropertyAggregatesPaginator.ts b/clients/client-iotsitewise/src/pagination/GetAssetPropertyAggregatesPaginator.ts index b41837984a15..853afcc0fc58 100644 --- a/clients/client-iotsitewise/src/pagination/GetAssetPropertyAggregatesPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/GetAssetPropertyAggregatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: GetAssetPropertyAggregatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetAssetPropertyAggregatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetAssetPropertyAggregates( +export const paginateGetAssetPropertyAggregates: ( config: IoTSiteWisePaginationConfiguration, input: GetAssetPropertyAggregatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetAssetPropertyAggregatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + GetAssetPropertyAggregatesCommandInput, + GetAssetPropertyAggregatesCommandOutput +>(IoTSiteWiseClient, GetAssetPropertyAggregatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/GetAssetPropertyValueHistoryPaginator.ts b/clients/client-iotsitewise/src/pagination/GetAssetPropertyValueHistoryPaginator.ts index 40d805a5a386..b65f24a7fb37 100644 --- a/clients/client-iotsitewise/src/pagination/GetAssetPropertyValueHistoryPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/GetAssetPropertyValueHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: GetAssetPropertyValueHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetAssetPropertyValueHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetAssetPropertyValueHistory( +export const paginateGetAssetPropertyValueHistory: ( config: IoTSiteWisePaginationConfiguration, input: GetAssetPropertyValueHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetAssetPropertyValueHistoryCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + GetAssetPropertyValueHistoryCommandInput, + GetAssetPropertyValueHistoryCommandOutput +>(IoTSiteWiseClient, GetAssetPropertyValueHistoryCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/GetInterpolatedAssetPropertyValuesPaginator.ts b/clients/client-iotsitewise/src/pagination/GetInterpolatedAssetPropertyValuesPaginator.ts index c58a4509d5dd..06408d91c957 100644 --- a/clients/client-iotsitewise/src/pagination/GetInterpolatedAssetPropertyValuesPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/GetInterpolatedAssetPropertyValuesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: GetInterpolatedAssetPropertyValuesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetInterpolatedAssetPropertyValuesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetInterpolatedAssetPropertyValues( +export const paginateGetInterpolatedAssetPropertyValues: ( config: IoTSiteWisePaginationConfiguration, input: GetInterpolatedAssetPropertyValuesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetInterpolatedAssetPropertyValuesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + GetInterpolatedAssetPropertyValuesCommandInput, + GetInterpolatedAssetPropertyValuesCommandOutput +>(IoTSiteWiseClient, GetInterpolatedAssetPropertyValuesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListAccessPoliciesPaginator.ts b/clients/client-iotsitewise/src/pagination/ListAccessPoliciesPaginator.ts index 9ce0d1b29c30..689cb820ae8a 100644 --- a/clients/client-iotsitewise/src/pagination/ListAccessPoliciesPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListAccessPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListAccessPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessPolicies( +export const paginateListAccessPolicies: ( config: IoTSiteWisePaginationConfiguration, input: ListAccessPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessPoliciesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListAccessPoliciesCommandInput, + ListAccessPoliciesCommandOutput +>(IoTSiteWiseClient, ListAccessPoliciesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListAssetModelCompositeModelsPaginator.ts b/clients/client-iotsitewise/src/pagination/ListAssetModelCompositeModelsPaginator.ts index 45f9ec19e985..244ace594ada 100644 --- a/clients/client-iotsitewise/src/pagination/ListAssetModelCompositeModelsPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListAssetModelCompositeModelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListAssetModelCompositeModelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssetModelCompositeModelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssetModelCompositeModels( +export const paginateListAssetModelCompositeModels: ( config: IoTSiteWisePaginationConfiguration, input: ListAssetModelCompositeModelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssetModelCompositeModelsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListAssetModelCompositeModelsCommandInput, + ListAssetModelCompositeModelsCommandOutput +>(IoTSiteWiseClient, ListAssetModelCompositeModelsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListAssetModelPropertiesPaginator.ts b/clients/client-iotsitewise/src/pagination/ListAssetModelPropertiesPaginator.ts index 44ff6daecb74..bbe586f9868f 100644 --- a/clients/client-iotsitewise/src/pagination/ListAssetModelPropertiesPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListAssetModelPropertiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListAssetModelPropertiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssetModelPropertiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssetModelProperties( +export const paginateListAssetModelProperties: ( config: IoTSiteWisePaginationConfiguration, input: ListAssetModelPropertiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssetModelPropertiesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListAssetModelPropertiesCommandInput, + ListAssetModelPropertiesCommandOutput +>(IoTSiteWiseClient, ListAssetModelPropertiesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListAssetModelsPaginator.ts b/clients/client-iotsitewise/src/pagination/ListAssetModelsPaginator.ts index 1aef3707c45c..f04bc9758f9d 100644 --- a/clients/client-iotsitewise/src/pagination/ListAssetModelsPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListAssetModelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListAssetModelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssetModelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssetModels( +export const paginateListAssetModels: ( config: IoTSiteWisePaginationConfiguration, input: ListAssetModelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssetModelsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListAssetModelsCommandInput, + ListAssetModelsCommandOutput +>(IoTSiteWiseClient, ListAssetModelsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListAssetPropertiesPaginator.ts b/clients/client-iotsitewise/src/pagination/ListAssetPropertiesPaginator.ts index 05ab1c55434e..1f83693c893a 100644 --- a/clients/client-iotsitewise/src/pagination/ListAssetPropertiesPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListAssetPropertiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListAssetPropertiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssetPropertiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssetProperties( +export const paginateListAssetProperties: ( config: IoTSiteWisePaginationConfiguration, input: ListAssetPropertiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssetPropertiesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListAssetPropertiesCommandInput, + ListAssetPropertiesCommandOutput +>(IoTSiteWiseClient, ListAssetPropertiesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListAssetRelationshipsPaginator.ts b/clients/client-iotsitewise/src/pagination/ListAssetRelationshipsPaginator.ts index 00b70d09fde7..197c204b42fe 100644 --- a/clients/client-iotsitewise/src/pagination/ListAssetRelationshipsPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListAssetRelationshipsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListAssetRelationshipsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssetRelationshipsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssetRelationships( +export const paginateListAssetRelationships: ( config: IoTSiteWisePaginationConfiguration, input: ListAssetRelationshipsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssetRelationshipsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListAssetRelationshipsCommandInput, + ListAssetRelationshipsCommandOutput +>(IoTSiteWiseClient, ListAssetRelationshipsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListAssetsPaginator.ts b/clients/client-iotsitewise/src/pagination/ListAssetsPaginator.ts index 67e52de81230..2ab9c4c87e3b 100644 --- a/clients/client-iotsitewise/src/pagination/ListAssetsPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListAssetsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAssetsCommand, ListAssetsCommandInput, ListAssetsCommandOutput } from "../commands/ListAssetsCommand"; import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListAssetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssets( +export const paginateListAssets: ( config: IoTSiteWisePaginationConfiguration, input: ListAssetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListAssetsCommandInput, + ListAssetsCommandOutput +>(IoTSiteWiseClient, ListAssetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListAssociatedAssetsPaginator.ts b/clients/client-iotsitewise/src/pagination/ListAssociatedAssetsPaginator.ts index db5f682ae013..3faf36803e67 100644 --- a/clients/client-iotsitewise/src/pagination/ListAssociatedAssetsPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListAssociatedAssetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListAssociatedAssetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssociatedAssetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssociatedAssets( +export const paginateListAssociatedAssets: ( config: IoTSiteWisePaginationConfiguration, input: ListAssociatedAssetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssociatedAssetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListAssociatedAssetsCommandInput, + ListAssociatedAssetsCommandOutput +>(IoTSiteWiseClient, ListAssociatedAssetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListBulkImportJobsPaginator.ts b/clients/client-iotsitewise/src/pagination/ListBulkImportJobsPaginator.ts index 81fddf807f07..c6b4fcced22f 100644 --- a/clients/client-iotsitewise/src/pagination/ListBulkImportJobsPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListBulkImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListBulkImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBulkImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBulkImportJobs( +export const paginateListBulkImportJobs: ( config: IoTSiteWisePaginationConfiguration, input: ListBulkImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBulkImportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListBulkImportJobsCommandInput, + ListBulkImportJobsCommandOutput +>(IoTSiteWiseClient, ListBulkImportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListCompositionRelationshipsPaginator.ts b/clients/client-iotsitewise/src/pagination/ListCompositionRelationshipsPaginator.ts index 4ae255931cc4..d5062fcd831e 100644 --- a/clients/client-iotsitewise/src/pagination/ListCompositionRelationshipsPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListCompositionRelationshipsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListCompositionRelationshipsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCompositionRelationshipsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCompositionRelationships( +export const paginateListCompositionRelationships: ( config: IoTSiteWisePaginationConfiguration, input: ListCompositionRelationshipsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCompositionRelationshipsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListCompositionRelationshipsCommandInput, + ListCompositionRelationshipsCommandOutput +>(IoTSiteWiseClient, ListCompositionRelationshipsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListDashboardsPaginator.ts b/clients/client-iotsitewise/src/pagination/ListDashboardsPaginator.ts index 4fdeae0d2d27..32745d364678 100644 --- a/clients/client-iotsitewise/src/pagination/ListDashboardsPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListDashboardsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListDashboardsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDashboardsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDashboards( +export const paginateListDashboards: ( config: IoTSiteWisePaginationConfiguration, input: ListDashboardsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDashboardsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListDashboardsCommandInput, + ListDashboardsCommandOutput +>(IoTSiteWiseClient, ListDashboardsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListGatewaysPaginator.ts b/clients/client-iotsitewise/src/pagination/ListGatewaysPaginator.ts index 5f61a09869df..ded4d3a4dee3 100644 --- a/clients/client-iotsitewise/src/pagination/ListGatewaysPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListGatewaysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListGatewaysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGatewaysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGateways( +export const paginateListGateways: ( config: IoTSiteWisePaginationConfiguration, input: ListGatewaysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGatewaysCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListGatewaysCommandInput, + ListGatewaysCommandOutput +>(IoTSiteWiseClient, ListGatewaysCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListPortalsPaginator.ts b/clients/client-iotsitewise/src/pagination/ListPortalsPaginator.ts index f5c2c4a9550a..0050a967e27a 100644 --- a/clients/client-iotsitewise/src/pagination/ListPortalsPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListPortalsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListPortalsCommand, ListPortalsCommandInput, ListPortalsCommandOutput } from "../commands/ListPortalsCommand"; import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListPortalsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPortalsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPortals( +export const paginateListPortals: ( config: IoTSiteWisePaginationConfiguration, input: ListPortalsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPortalsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListPortalsCommandInput, + ListPortalsCommandOutput +>(IoTSiteWiseClient, ListPortalsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListProjectAssetsPaginator.ts b/clients/client-iotsitewise/src/pagination/ListProjectAssetsPaginator.ts index 463f073d0cbb..fca81d02d03a 100644 --- a/clients/client-iotsitewise/src/pagination/ListProjectAssetsPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListProjectAssetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListProjectAssetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProjectAssetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProjectAssets( +export const paginateListProjectAssets: ( config: IoTSiteWisePaginationConfiguration, input: ListProjectAssetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProjectAssetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListProjectAssetsCommandInput, + ListProjectAssetsCommandOutput +>(IoTSiteWiseClient, ListProjectAssetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListProjectsPaginator.ts b/clients/client-iotsitewise/src/pagination/ListProjectsPaginator.ts index e2bbdd05920e..d20d8e0f8dea 100644 --- a/clients/client-iotsitewise/src/pagination/ListProjectsPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProjects( +export const paginateListProjects: ( config: IoTSiteWisePaginationConfiguration, input: ListProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProjectsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListProjectsCommandInput, + ListProjectsCommandOutput +>(IoTSiteWiseClient, ListProjectsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotsitewise/src/pagination/ListTimeSeriesPaginator.ts b/clients/client-iotsitewise/src/pagination/ListTimeSeriesPaginator.ts index 8273b0fa18be..95771d576e2f 100644 --- a/clients/client-iotsitewise/src/pagination/ListTimeSeriesPaginator.ts +++ b/clients/client-iotsitewise/src/pagination/ListTimeSeriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTSiteWiseClient } from "../IoTSiteWiseClient"; import { IoTSiteWisePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTSiteWiseClient, - input: ListTimeSeriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTimeSeriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTimeSeries( +export const paginateListTimeSeries: ( config: IoTSiteWisePaginationConfiguration, input: ListTimeSeriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTimeSeriesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTSiteWiseClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTSiteWise | IoTSiteWiseClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTSiteWisePaginationConfiguration, + ListTimeSeriesCommandInput, + ListTimeSeriesCommandOutput +>(IoTSiteWiseClient, ListTimeSeriesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotthingsgraph/package.json b/clients/client-iotthingsgraph/package.json index 24c04c3ba3d3..cf7bdd2d91bc 100644 --- a/clients/client-iotthingsgraph/package.json +++ b/clients/client-iotthingsgraph/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-iotthingsgraph/src/pagination/GetFlowTemplateRevisionsPaginator.ts b/clients/client-iotthingsgraph/src/pagination/GetFlowTemplateRevisionsPaginator.ts index 280a86e439f6..b7eddd5c02b4 100644 --- a/clients/client-iotthingsgraph/src/pagination/GetFlowTemplateRevisionsPaginator.ts +++ b/clients/client-iotthingsgraph/src/pagination/GetFlowTemplateRevisionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTThingsGraphClient } from "../IoTThingsGraphClient"; import { IoTThingsGraphPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTThingsGraphClient, - input: GetFlowTemplateRevisionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetFlowTemplateRevisionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetFlowTemplateRevisions( +export const paginateGetFlowTemplateRevisions: ( config: IoTThingsGraphPaginationConfiguration, input: GetFlowTemplateRevisionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetFlowTemplateRevisionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTThingsGraphClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTThingsGraph | IoTThingsGraphClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTThingsGraphPaginationConfiguration, + GetFlowTemplateRevisionsCommandInput, + GetFlowTemplateRevisionsCommandOutput +>(IoTThingsGraphClient, GetFlowTemplateRevisionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotthingsgraph/src/pagination/GetSystemTemplateRevisionsPaginator.ts b/clients/client-iotthingsgraph/src/pagination/GetSystemTemplateRevisionsPaginator.ts index face3c9ef1ba..4f6cbc74d9b1 100644 --- a/clients/client-iotthingsgraph/src/pagination/GetSystemTemplateRevisionsPaginator.ts +++ b/clients/client-iotthingsgraph/src/pagination/GetSystemTemplateRevisionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTThingsGraphClient } from "../IoTThingsGraphClient"; import { IoTThingsGraphPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTThingsGraphClient, - input: GetSystemTemplateRevisionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetSystemTemplateRevisionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetSystemTemplateRevisions( +export const paginateGetSystemTemplateRevisions: ( config: IoTThingsGraphPaginationConfiguration, input: GetSystemTemplateRevisionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetSystemTemplateRevisionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTThingsGraphClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTThingsGraph | IoTThingsGraphClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTThingsGraphPaginationConfiguration, + GetSystemTemplateRevisionsCommandInput, + GetSystemTemplateRevisionsCommandOutput +>(IoTThingsGraphClient, GetSystemTemplateRevisionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotthingsgraph/src/pagination/ListFlowExecutionMessagesPaginator.ts b/clients/client-iotthingsgraph/src/pagination/ListFlowExecutionMessagesPaginator.ts index 1b9d5ac3ddeb..4ebaf332462f 100644 --- a/clients/client-iotthingsgraph/src/pagination/ListFlowExecutionMessagesPaginator.ts +++ b/clients/client-iotthingsgraph/src/pagination/ListFlowExecutionMessagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTThingsGraphClient } from "../IoTThingsGraphClient"; import { IoTThingsGraphPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTThingsGraphClient, - input: ListFlowExecutionMessagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFlowExecutionMessagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFlowExecutionMessages( +export const paginateListFlowExecutionMessages: ( config: IoTThingsGraphPaginationConfiguration, input: ListFlowExecutionMessagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFlowExecutionMessagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTThingsGraphClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTThingsGraph | IoTThingsGraphClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTThingsGraphPaginationConfiguration, + ListFlowExecutionMessagesCommandInput, + ListFlowExecutionMessagesCommandOutput +>(IoTThingsGraphClient, ListFlowExecutionMessagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotthingsgraph/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-iotthingsgraph/src/pagination/ListTagsForResourcePaginator.ts index bf7f511c39f9..4f0363ba2355 100644 --- a/clients/client-iotthingsgraph/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-iotthingsgraph/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTThingsGraphClient } from "../IoTThingsGraphClient"; import { IoTThingsGraphPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTThingsGraphClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: IoTThingsGraphPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTThingsGraphClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTThingsGraph | IoTThingsGraphClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTThingsGraphPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(IoTThingsGraphClient, ListTagsForResourceCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotthingsgraph/src/pagination/SearchEntitiesPaginator.ts b/clients/client-iotthingsgraph/src/pagination/SearchEntitiesPaginator.ts index 8f85826a817b..70ac4aea5f73 100644 --- a/clients/client-iotthingsgraph/src/pagination/SearchEntitiesPaginator.ts +++ b/clients/client-iotthingsgraph/src/pagination/SearchEntitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTThingsGraphClient } from "../IoTThingsGraphClient"; import { IoTThingsGraphPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTThingsGraphClient, - input: SearchEntitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchEntitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchEntities( +export const paginateSearchEntities: ( config: IoTThingsGraphPaginationConfiguration, input: SearchEntitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchEntitiesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTThingsGraphClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTThingsGraph | IoTThingsGraphClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTThingsGraphPaginationConfiguration, + SearchEntitiesCommandInput, + SearchEntitiesCommandOutput +>(IoTThingsGraphClient, SearchEntitiesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotthingsgraph/src/pagination/SearchFlowExecutionsPaginator.ts b/clients/client-iotthingsgraph/src/pagination/SearchFlowExecutionsPaginator.ts index d476b939b330..e45d827ed777 100644 --- a/clients/client-iotthingsgraph/src/pagination/SearchFlowExecutionsPaginator.ts +++ b/clients/client-iotthingsgraph/src/pagination/SearchFlowExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTThingsGraphClient } from "../IoTThingsGraphClient"; import { IoTThingsGraphPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTThingsGraphClient, - input: SearchFlowExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchFlowExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchFlowExecutions( +export const paginateSearchFlowExecutions: ( config: IoTThingsGraphPaginationConfiguration, input: SearchFlowExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchFlowExecutionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTThingsGraphClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTThingsGraph | IoTThingsGraphClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTThingsGraphPaginationConfiguration, + SearchFlowExecutionsCommandInput, + SearchFlowExecutionsCommandOutput +>(IoTThingsGraphClient, SearchFlowExecutionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotthingsgraph/src/pagination/SearchFlowTemplatesPaginator.ts b/clients/client-iotthingsgraph/src/pagination/SearchFlowTemplatesPaginator.ts index f985bb381f4a..8f26a56f19b8 100644 --- a/clients/client-iotthingsgraph/src/pagination/SearchFlowTemplatesPaginator.ts +++ b/clients/client-iotthingsgraph/src/pagination/SearchFlowTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTThingsGraphClient } from "../IoTThingsGraphClient"; import { IoTThingsGraphPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTThingsGraphClient, - input: SearchFlowTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchFlowTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchFlowTemplates( +export const paginateSearchFlowTemplates: ( config: IoTThingsGraphPaginationConfiguration, input: SearchFlowTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchFlowTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTThingsGraphClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTThingsGraph | IoTThingsGraphClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTThingsGraphPaginationConfiguration, + SearchFlowTemplatesCommandInput, + SearchFlowTemplatesCommandOutput +>(IoTThingsGraphClient, SearchFlowTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotthingsgraph/src/pagination/SearchSystemInstancesPaginator.ts b/clients/client-iotthingsgraph/src/pagination/SearchSystemInstancesPaginator.ts index d670fc525109..7aac21c6972c 100644 --- a/clients/client-iotthingsgraph/src/pagination/SearchSystemInstancesPaginator.ts +++ b/clients/client-iotthingsgraph/src/pagination/SearchSystemInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTThingsGraphClient } from "../IoTThingsGraphClient"; import { IoTThingsGraphPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTThingsGraphClient, - input: SearchSystemInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchSystemInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchSystemInstances( +export const paginateSearchSystemInstances: ( config: IoTThingsGraphPaginationConfiguration, input: SearchSystemInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchSystemInstancesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTThingsGraphClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTThingsGraph | IoTThingsGraphClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTThingsGraphPaginationConfiguration, + SearchSystemInstancesCommandInput, + SearchSystemInstancesCommandOutput +>(IoTThingsGraphClient, SearchSystemInstancesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotthingsgraph/src/pagination/SearchSystemTemplatesPaginator.ts b/clients/client-iotthingsgraph/src/pagination/SearchSystemTemplatesPaginator.ts index a3fb82293875..d80305d6f4ca 100644 --- a/clients/client-iotthingsgraph/src/pagination/SearchSystemTemplatesPaginator.ts +++ b/clients/client-iotthingsgraph/src/pagination/SearchSystemTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTThingsGraphClient } from "../IoTThingsGraphClient"; import { IoTThingsGraphPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTThingsGraphClient, - input: SearchSystemTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchSystemTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchSystemTemplates( +export const paginateSearchSystemTemplates: ( config: IoTThingsGraphPaginationConfiguration, input: SearchSystemTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchSystemTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTThingsGraphClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTThingsGraph | IoTThingsGraphClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTThingsGraphPaginationConfiguration, + SearchSystemTemplatesCommandInput, + SearchSystemTemplatesCommandOutput +>(IoTThingsGraphClient, SearchSystemTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iotthingsgraph/src/pagination/SearchThingsPaginator.ts b/clients/client-iotthingsgraph/src/pagination/SearchThingsPaginator.ts index adb294377e34..ab39afbdf7d7 100644 --- a/clients/client-iotthingsgraph/src/pagination/SearchThingsPaginator.ts +++ b/clients/client-iotthingsgraph/src/pagination/SearchThingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTThingsGraphClient } from "../IoTThingsGraphClient"; import { IoTThingsGraphPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTThingsGraphClient, - input: SearchThingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchThingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchThings( +export const paginateSearchThings: ( config: IoTThingsGraphPaginationConfiguration, input: SearchThingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchThingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTThingsGraphClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTThingsGraph | IoTThingsGraphClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTThingsGraphPaginationConfiguration, + SearchThingsCommandInput, + SearchThingsCommandOutput +>(IoTThingsGraphClient, SearchThingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iottwinmaker/src/pagination/ExecuteQueryPaginator.ts b/clients/client-iottwinmaker/src/pagination/ExecuteQueryPaginator.ts index c7b0e80ccd82..f4ee3989feb7 100644 --- a/clients/client-iottwinmaker/src/pagination/ExecuteQueryPaginator.ts +++ b/clients/client-iottwinmaker/src/pagination/ExecuteQueryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTTwinMakerClient } from "../IoTTwinMakerClient"; import { IoTTwinMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTTwinMakerClient, - input: ExecuteQueryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ExecuteQueryCommand(input), ...args); -}; /** * @public */ -export async function* paginateExecuteQuery( +export const paginateExecuteQuery: ( config: IoTTwinMakerPaginationConfiguration, input: ExecuteQueryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ExecuteQueryCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTTwinMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTTwinMaker | IoTTwinMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTTwinMakerPaginationConfiguration, + ExecuteQueryCommandInput, + ExecuteQueryCommandOutput +>(IoTTwinMakerClient, ExecuteQueryCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iottwinmaker/src/pagination/GetPropertyValueHistoryPaginator.ts b/clients/client-iottwinmaker/src/pagination/GetPropertyValueHistoryPaginator.ts index f341d0198b6d..d7d7caa6b43a 100644 --- a/clients/client-iottwinmaker/src/pagination/GetPropertyValueHistoryPaginator.ts +++ b/clients/client-iottwinmaker/src/pagination/GetPropertyValueHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTTwinMakerClient } from "../IoTTwinMakerClient"; import { IoTTwinMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTTwinMakerClient, - input: GetPropertyValueHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetPropertyValueHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetPropertyValueHistory( +export const paginateGetPropertyValueHistory: ( config: IoTTwinMakerPaginationConfiguration, input: GetPropertyValueHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetPropertyValueHistoryCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTTwinMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTTwinMaker | IoTTwinMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTTwinMakerPaginationConfiguration, + GetPropertyValueHistoryCommandInput, + GetPropertyValueHistoryCommandOutput +>(IoTTwinMakerClient, GetPropertyValueHistoryCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iottwinmaker/src/pagination/GetPropertyValuePaginator.ts b/clients/client-iottwinmaker/src/pagination/GetPropertyValuePaginator.ts index 7f5c0da54498..f1c2b08305b9 100644 --- a/clients/client-iottwinmaker/src/pagination/GetPropertyValuePaginator.ts +++ b/clients/client-iottwinmaker/src/pagination/GetPropertyValuePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTTwinMakerClient } from "../IoTTwinMakerClient"; import { IoTTwinMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTTwinMakerClient, - input: GetPropertyValueCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetPropertyValueCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetPropertyValue( +export const paginateGetPropertyValue: ( config: IoTTwinMakerPaginationConfiguration, input: GetPropertyValueCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetPropertyValueCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTTwinMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTTwinMaker | IoTTwinMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTTwinMakerPaginationConfiguration, + GetPropertyValueCommandInput, + GetPropertyValueCommandOutput +>(IoTTwinMakerClient, GetPropertyValueCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iottwinmaker/src/pagination/ListComponentTypesPaginator.ts b/clients/client-iottwinmaker/src/pagination/ListComponentTypesPaginator.ts index c20ad3c3b314..aa895afe57f3 100644 --- a/clients/client-iottwinmaker/src/pagination/ListComponentTypesPaginator.ts +++ b/clients/client-iottwinmaker/src/pagination/ListComponentTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTTwinMakerClient } from "../IoTTwinMakerClient"; import { IoTTwinMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTTwinMakerClient, - input: ListComponentTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComponentTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComponentTypes( +export const paginateListComponentTypes: ( config: IoTTwinMakerPaginationConfiguration, input: ListComponentTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComponentTypesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTTwinMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTTwinMaker | IoTTwinMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTTwinMakerPaginationConfiguration, + ListComponentTypesCommandInput, + ListComponentTypesCommandOutput +>(IoTTwinMakerClient, ListComponentTypesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iottwinmaker/src/pagination/ListComponentsPaginator.ts b/clients/client-iottwinmaker/src/pagination/ListComponentsPaginator.ts index 27d907f60b64..f7a2f1edf2e0 100644 --- a/clients/client-iottwinmaker/src/pagination/ListComponentsPaginator.ts +++ b/clients/client-iottwinmaker/src/pagination/ListComponentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTTwinMakerClient } from "../IoTTwinMakerClient"; import { IoTTwinMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTTwinMakerClient, - input: ListComponentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComponentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComponents( +export const paginateListComponents: ( config: IoTTwinMakerPaginationConfiguration, input: ListComponentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComponentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTTwinMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTTwinMaker | IoTTwinMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTTwinMakerPaginationConfiguration, + ListComponentsCommandInput, + ListComponentsCommandOutput +>(IoTTwinMakerClient, ListComponentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iottwinmaker/src/pagination/ListEntitiesPaginator.ts b/clients/client-iottwinmaker/src/pagination/ListEntitiesPaginator.ts index e9e4dd3057da..cd893938a279 100644 --- a/clients/client-iottwinmaker/src/pagination/ListEntitiesPaginator.ts +++ b/clients/client-iottwinmaker/src/pagination/ListEntitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTTwinMakerClient } from "../IoTTwinMakerClient"; import { IoTTwinMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTTwinMakerClient, - input: ListEntitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEntitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEntities( +export const paginateListEntities: ( config: IoTTwinMakerPaginationConfiguration, input: ListEntitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEntitiesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTTwinMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTTwinMaker | IoTTwinMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTTwinMakerPaginationConfiguration, + ListEntitiesCommandInput, + ListEntitiesCommandOutput +>(IoTTwinMakerClient, ListEntitiesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iottwinmaker/src/pagination/ListMetadataTransferJobsPaginator.ts b/clients/client-iottwinmaker/src/pagination/ListMetadataTransferJobsPaginator.ts index a5a85242044f..db20027f4c38 100644 --- a/clients/client-iottwinmaker/src/pagination/ListMetadataTransferJobsPaginator.ts +++ b/clients/client-iottwinmaker/src/pagination/ListMetadataTransferJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTTwinMakerClient } from "../IoTTwinMakerClient"; import { IoTTwinMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTTwinMakerClient, - input: ListMetadataTransferJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMetadataTransferJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMetadataTransferJobs( +export const paginateListMetadataTransferJobs: ( config: IoTTwinMakerPaginationConfiguration, input: ListMetadataTransferJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMetadataTransferJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTTwinMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTTwinMaker | IoTTwinMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTTwinMakerPaginationConfiguration, + ListMetadataTransferJobsCommandInput, + ListMetadataTransferJobsCommandOutput +>(IoTTwinMakerClient, ListMetadataTransferJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iottwinmaker/src/pagination/ListPropertiesPaginator.ts b/clients/client-iottwinmaker/src/pagination/ListPropertiesPaginator.ts index 6e2ab10bbd92..5f0829aede87 100644 --- a/clients/client-iottwinmaker/src/pagination/ListPropertiesPaginator.ts +++ b/clients/client-iottwinmaker/src/pagination/ListPropertiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTTwinMakerClient } from "../IoTTwinMakerClient"; import { IoTTwinMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTTwinMakerClient, - input: ListPropertiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPropertiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProperties( +export const paginateListProperties: ( config: IoTTwinMakerPaginationConfiguration, input: ListPropertiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPropertiesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTTwinMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTTwinMaker | IoTTwinMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTTwinMakerPaginationConfiguration, + ListPropertiesCommandInput, + ListPropertiesCommandOutput +>(IoTTwinMakerClient, ListPropertiesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iottwinmaker/src/pagination/ListScenesPaginator.ts b/clients/client-iottwinmaker/src/pagination/ListScenesPaginator.ts index dd6344422c73..48203081559d 100644 --- a/clients/client-iottwinmaker/src/pagination/ListScenesPaginator.ts +++ b/clients/client-iottwinmaker/src/pagination/ListScenesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListScenesCommand, ListScenesCommandInput, ListScenesCommandOutput } from "../commands/ListScenesCommand"; import { IoTTwinMakerClient } from "../IoTTwinMakerClient"; import { IoTTwinMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTTwinMakerClient, - input: ListScenesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListScenesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListScenes( +export const paginateListScenes: ( config: IoTTwinMakerPaginationConfiguration, input: ListScenesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListScenesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTTwinMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTTwinMaker | IoTTwinMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTTwinMakerPaginationConfiguration, + ListScenesCommandInput, + ListScenesCommandOutput +>(IoTTwinMakerClient, ListScenesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iottwinmaker/src/pagination/ListSyncJobsPaginator.ts b/clients/client-iottwinmaker/src/pagination/ListSyncJobsPaginator.ts index de7411de5b97..84e135de7913 100644 --- a/clients/client-iottwinmaker/src/pagination/ListSyncJobsPaginator.ts +++ b/clients/client-iottwinmaker/src/pagination/ListSyncJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTTwinMakerClient } from "../IoTTwinMakerClient"; import { IoTTwinMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTTwinMakerClient, - input: ListSyncJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSyncJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSyncJobs( +export const paginateListSyncJobs: ( config: IoTTwinMakerPaginationConfiguration, input: ListSyncJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSyncJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTTwinMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTTwinMaker | IoTTwinMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTTwinMakerPaginationConfiguration, + ListSyncJobsCommandInput, + ListSyncJobsCommandOutput +>(IoTTwinMakerClient, ListSyncJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iottwinmaker/src/pagination/ListSyncResourcesPaginator.ts b/clients/client-iottwinmaker/src/pagination/ListSyncResourcesPaginator.ts index f9301da2dd64..e4f385515771 100644 --- a/clients/client-iottwinmaker/src/pagination/ListSyncResourcesPaginator.ts +++ b/clients/client-iottwinmaker/src/pagination/ListSyncResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTTwinMakerClient } from "../IoTTwinMakerClient"; import { IoTTwinMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTTwinMakerClient, - input: ListSyncResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSyncResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSyncResources( +export const paginateListSyncResources: ( config: IoTTwinMakerPaginationConfiguration, input: ListSyncResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSyncResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTTwinMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTTwinMaker | IoTTwinMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTTwinMakerPaginationConfiguration, + ListSyncResourcesCommandInput, + ListSyncResourcesCommandOutput +>(IoTTwinMakerClient, ListSyncResourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-iottwinmaker/src/pagination/ListWorkspacesPaginator.ts b/clients/client-iottwinmaker/src/pagination/ListWorkspacesPaginator.ts index 6e3ea3804324..2a56532c461b 100644 --- a/clients/client-iottwinmaker/src/pagination/ListWorkspacesPaginator.ts +++ b/clients/client-iottwinmaker/src/pagination/ListWorkspacesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IoTTwinMakerClient } from "../IoTTwinMakerClient"; import { IoTTwinMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IoTTwinMakerClient, - input: ListWorkspacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkspacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkspaces( +export const paginateListWorkspaces: ( config: IoTTwinMakerPaginationConfiguration, input: ListWorkspacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkspacesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IoTTwinMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IoTTwinMaker | IoTTwinMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IoTTwinMakerPaginationConfiguration, + ListWorkspacesCommandInput, + ListWorkspacesCommandOutput +>(IoTTwinMakerClient, ListWorkspacesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivs-realtime/src/pagination/ListCompositionsPaginator.ts b/clients/client-ivs-realtime/src/pagination/ListCompositionsPaginator.ts index 2d1559212d9f..b71670a736a2 100644 --- a/clients/client-ivs-realtime/src/pagination/ListCompositionsPaginator.ts +++ b/clients/client-ivs-realtime/src/pagination/ListCompositionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IVSRealTimeClient } from "../IVSRealTimeClient"; import { IVSRealTimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IVSRealTimeClient, - input: ListCompositionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCompositionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCompositions( +export const paginateListCompositions: ( config: IVSRealTimePaginationConfiguration, input: ListCompositionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCompositionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IVSRealTimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IVSRealTime | IVSRealTimeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IVSRealTimePaginationConfiguration, + ListCompositionsCommandInput, + ListCompositionsCommandOutput +>(IVSRealTimeClient, ListCompositionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivs-realtime/src/pagination/ListEncoderConfigurationsPaginator.ts b/clients/client-ivs-realtime/src/pagination/ListEncoderConfigurationsPaginator.ts index 04bae54451e1..af54e7d1d676 100644 --- a/clients/client-ivs-realtime/src/pagination/ListEncoderConfigurationsPaginator.ts +++ b/clients/client-ivs-realtime/src/pagination/ListEncoderConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IVSRealTimeClient } from "../IVSRealTimeClient"; import { IVSRealTimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IVSRealTimeClient, - input: ListEncoderConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEncoderConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEncoderConfigurations( +export const paginateListEncoderConfigurations: ( config: IVSRealTimePaginationConfiguration, input: ListEncoderConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEncoderConfigurationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IVSRealTimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IVSRealTime | IVSRealTimeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IVSRealTimePaginationConfiguration, + ListEncoderConfigurationsCommandInput, + ListEncoderConfigurationsCommandOutput +>(IVSRealTimeClient, ListEncoderConfigurationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivs-realtime/src/pagination/ListParticipantEventsPaginator.ts b/clients/client-ivs-realtime/src/pagination/ListParticipantEventsPaginator.ts index c909bcf6ec3a..cff0b1f4b35e 100644 --- a/clients/client-ivs-realtime/src/pagination/ListParticipantEventsPaginator.ts +++ b/clients/client-ivs-realtime/src/pagination/ListParticipantEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IVSRealTimeClient } from "../IVSRealTimeClient"; import { IVSRealTimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IVSRealTimeClient, - input: ListParticipantEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListParticipantEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListParticipantEvents( +export const paginateListParticipantEvents: ( config: IVSRealTimePaginationConfiguration, input: ListParticipantEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListParticipantEventsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IVSRealTimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IVSRealTime | IVSRealTimeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IVSRealTimePaginationConfiguration, + ListParticipantEventsCommandInput, + ListParticipantEventsCommandOutput +>(IVSRealTimeClient, ListParticipantEventsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivs-realtime/src/pagination/ListParticipantsPaginator.ts b/clients/client-ivs-realtime/src/pagination/ListParticipantsPaginator.ts index dc497de5bc6c..4f4b106f545e 100644 --- a/clients/client-ivs-realtime/src/pagination/ListParticipantsPaginator.ts +++ b/clients/client-ivs-realtime/src/pagination/ListParticipantsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IVSRealTimeClient } from "../IVSRealTimeClient"; import { IVSRealTimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IVSRealTimeClient, - input: ListParticipantsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListParticipantsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListParticipants( +export const paginateListParticipants: ( config: IVSRealTimePaginationConfiguration, input: ListParticipantsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListParticipantsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IVSRealTimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IVSRealTime | IVSRealTimeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IVSRealTimePaginationConfiguration, + ListParticipantsCommandInput, + ListParticipantsCommandOutput +>(IVSRealTimeClient, ListParticipantsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivs-realtime/src/pagination/ListStageSessionsPaginator.ts b/clients/client-ivs-realtime/src/pagination/ListStageSessionsPaginator.ts index 1b10068017e0..ca3d06b849e3 100644 --- a/clients/client-ivs-realtime/src/pagination/ListStageSessionsPaginator.ts +++ b/clients/client-ivs-realtime/src/pagination/ListStageSessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IVSRealTimeClient } from "../IVSRealTimeClient"; import { IVSRealTimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IVSRealTimeClient, - input: ListStageSessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStageSessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStageSessions( +export const paginateListStageSessions: ( config: IVSRealTimePaginationConfiguration, input: ListStageSessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStageSessionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IVSRealTimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IVSRealTime | IVSRealTimeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IVSRealTimePaginationConfiguration, + ListStageSessionsCommandInput, + ListStageSessionsCommandOutput +>(IVSRealTimeClient, ListStageSessionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivs-realtime/src/pagination/ListStagesPaginator.ts b/clients/client-ivs-realtime/src/pagination/ListStagesPaginator.ts index 75ad41b97310..244e8a8ca26b 100644 --- a/clients/client-ivs-realtime/src/pagination/ListStagesPaginator.ts +++ b/clients/client-ivs-realtime/src/pagination/ListStagesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListStagesCommand, ListStagesCommandInput, ListStagesCommandOutput } from "../commands/ListStagesCommand"; import { IVSRealTimeClient } from "../IVSRealTimeClient"; import { IVSRealTimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IVSRealTimeClient, - input: ListStagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStages( +export const paginateListStages: ( config: IVSRealTimePaginationConfiguration, input: ListStagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IVSRealTimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IVSRealTime | IVSRealTimeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IVSRealTimePaginationConfiguration, + ListStagesCommandInput, + ListStagesCommandOutput +>(IVSRealTimeClient, ListStagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivs-realtime/src/pagination/ListStorageConfigurationsPaginator.ts b/clients/client-ivs-realtime/src/pagination/ListStorageConfigurationsPaginator.ts index 71c6534bee48..1dce4cce807b 100644 --- a/clients/client-ivs-realtime/src/pagination/ListStorageConfigurationsPaginator.ts +++ b/clients/client-ivs-realtime/src/pagination/ListStorageConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IVSRealTimeClient } from "../IVSRealTimeClient"; import { IVSRealTimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IVSRealTimeClient, - input: ListStorageConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStorageConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStorageConfigurations( +export const paginateListStorageConfigurations: ( config: IVSRealTimePaginationConfiguration, input: ListStorageConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStorageConfigurationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IVSRealTimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected IVSRealTime | IVSRealTimeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IVSRealTimePaginationConfiguration, + ListStorageConfigurationsCommandInput, + ListStorageConfigurationsCommandOutput +>(IVSRealTimeClient, ListStorageConfigurationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivs/src/pagination/ListChannelsPaginator.ts b/clients/client-ivs/src/pagination/ListChannelsPaginator.ts index ba7fd571320f..16800ecc1883 100644 --- a/clients/client-ivs/src/pagination/ListChannelsPaginator.ts +++ b/clients/client-ivs/src/pagination/ListChannelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IvsClient } from "../IvsClient"; import { IvsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IvsClient, - input: ListChannelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannels( +export const paginateListChannels: ( config: IvsPaginationConfiguration, input: ListChannelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IvsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Ivs | IvsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IvsPaginationConfiguration, + ListChannelsCommandInput, + ListChannelsCommandOutput +>(IvsClient, ListChannelsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivs/src/pagination/ListPlaybackKeyPairsPaginator.ts b/clients/client-ivs/src/pagination/ListPlaybackKeyPairsPaginator.ts index 797b995b2be4..4df0e81fd7c6 100644 --- a/clients/client-ivs/src/pagination/ListPlaybackKeyPairsPaginator.ts +++ b/clients/client-ivs/src/pagination/ListPlaybackKeyPairsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IvsClient } from "../IvsClient"; import { IvsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IvsClient, - input: ListPlaybackKeyPairsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPlaybackKeyPairsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPlaybackKeyPairs( +export const paginateListPlaybackKeyPairs: ( config: IvsPaginationConfiguration, input: ListPlaybackKeyPairsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPlaybackKeyPairsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IvsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Ivs | IvsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IvsPaginationConfiguration, + ListPlaybackKeyPairsCommandInput, + ListPlaybackKeyPairsCommandOutput +>(IvsClient, ListPlaybackKeyPairsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivs/src/pagination/ListRecordingConfigurationsPaginator.ts b/clients/client-ivs/src/pagination/ListRecordingConfigurationsPaginator.ts index c3f235f931d2..dd3dc2335261 100644 --- a/clients/client-ivs/src/pagination/ListRecordingConfigurationsPaginator.ts +++ b/clients/client-ivs/src/pagination/ListRecordingConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IvsClient } from "../IvsClient"; import { IvsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IvsClient, - input: ListRecordingConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecordingConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecordingConfigurations( +export const paginateListRecordingConfigurations: ( config: IvsPaginationConfiguration, input: ListRecordingConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecordingConfigurationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IvsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Ivs | IvsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IvsPaginationConfiguration, + ListRecordingConfigurationsCommandInput, + ListRecordingConfigurationsCommandOutput +>(IvsClient, ListRecordingConfigurationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivs/src/pagination/ListStreamKeysPaginator.ts b/clients/client-ivs/src/pagination/ListStreamKeysPaginator.ts index 45c3ef3ffe1a..08b2349918a7 100644 --- a/clients/client-ivs/src/pagination/ListStreamKeysPaginator.ts +++ b/clients/client-ivs/src/pagination/ListStreamKeysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IvsClient } from "../IvsClient"; import { IvsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IvsClient, - input: ListStreamKeysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStreamKeysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStreamKeys( +export const paginateListStreamKeys: ( config: IvsPaginationConfiguration, input: ListStreamKeysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStreamKeysCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IvsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Ivs | IvsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IvsPaginationConfiguration, + ListStreamKeysCommandInput, + ListStreamKeysCommandOutput +>(IvsClient, ListStreamKeysCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivs/src/pagination/ListStreamSessionsPaginator.ts b/clients/client-ivs/src/pagination/ListStreamSessionsPaginator.ts index 65a724450594..47e4f8357507 100644 --- a/clients/client-ivs/src/pagination/ListStreamSessionsPaginator.ts +++ b/clients/client-ivs/src/pagination/ListStreamSessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IvsClient } from "../IvsClient"; import { IvsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IvsClient, - input: ListStreamSessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStreamSessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStreamSessions( +export const paginateListStreamSessions: ( config: IvsPaginationConfiguration, input: ListStreamSessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStreamSessionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IvsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Ivs | IvsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IvsPaginationConfiguration, + ListStreamSessionsCommandInput, + ListStreamSessionsCommandOutput +>(IvsClient, ListStreamSessionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivs/src/pagination/ListStreamsPaginator.ts b/clients/client-ivs/src/pagination/ListStreamsPaginator.ts index 211c7030ea9a..39d295f3059d 100644 --- a/clients/client-ivs/src/pagination/ListStreamsPaginator.ts +++ b/clients/client-ivs/src/pagination/ListStreamsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListStreamsCommand, ListStreamsCommandInput, ListStreamsCommandOutput } from "../commands/ListStreamsCommand"; import { IvsClient } from "../IvsClient"; import { IvsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IvsClient, - input: ListStreamsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStreamsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStreams( +export const paginateListStreams: ( config: IvsPaginationConfiguration, input: ListStreamsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStreamsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IvsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Ivs | IvsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IvsPaginationConfiguration, + ListStreamsCommandInput, + ListStreamsCommandOutput +>(IvsClient, ListStreamsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivschat/src/pagination/ListLoggingConfigurationsPaginator.ts b/clients/client-ivschat/src/pagination/ListLoggingConfigurationsPaginator.ts index fc9c3ed27c8b..08731243d855 100644 --- a/clients/client-ivschat/src/pagination/ListLoggingConfigurationsPaginator.ts +++ b/clients/client-ivschat/src/pagination/ListLoggingConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { IvschatClient } from "../IvschatClient"; import { IvschatPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IvschatClient, - input: ListLoggingConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLoggingConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLoggingConfigurations( +export const paginateListLoggingConfigurations: ( config: IvschatPaginationConfiguration, input: ListLoggingConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLoggingConfigurationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IvschatClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Ivschat | IvschatClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IvschatPaginationConfiguration, + ListLoggingConfigurationsCommandInput, + ListLoggingConfigurationsCommandOutput +>(IvschatClient, ListLoggingConfigurationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ivschat/src/pagination/ListRoomsPaginator.ts b/clients/client-ivschat/src/pagination/ListRoomsPaginator.ts index ca4e172a7c58..271b4d094720 100644 --- a/clients/client-ivschat/src/pagination/ListRoomsPaginator.ts +++ b/clients/client-ivschat/src/pagination/ListRoomsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListRoomsCommand, ListRoomsCommandInput, ListRoomsCommandOutput } from "../commands/ListRoomsCommand"; import { IvschatClient } from "../IvschatClient"; import { IvschatPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: IvschatClient, - input: ListRoomsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRoomsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRooms( +export const paginateListRooms: ( config: IvschatPaginationConfiguration, input: ListRoomsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRoomsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof IvschatClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Ivschat | IvschatClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + IvschatPaginationConfiguration, + ListRoomsCommandInput, + ListRoomsCommandOutput +>(IvschatClient, ListRoomsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-kafka/src/pagination/ListClientVpcConnectionsPaginator.ts b/clients/client-kafka/src/pagination/ListClientVpcConnectionsPaginator.ts index 82f408960647..451ab6da7ae7 100644 --- a/clients/client-kafka/src/pagination/ListClientVpcConnectionsPaginator.ts +++ b/clients/client-kafka/src/pagination/ListClientVpcConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KafkaClient } from "../KafkaClient"; import { KafkaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaClient, - input: ListClientVpcConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClientVpcConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClientVpcConnections( +export const paginateListClientVpcConnections: ( config: KafkaPaginationConfiguration, input: ListClientVpcConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClientVpcConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KafkaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kafka | KafkaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaPaginationConfiguration, + ListClientVpcConnectionsCommandInput, + ListClientVpcConnectionsCommandOutput +>(KafkaClient, ListClientVpcConnectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kafka/src/pagination/ListClusterOperationsPaginator.ts b/clients/client-kafka/src/pagination/ListClusterOperationsPaginator.ts index 5c9f8a4f6291..549eb17324a1 100644 --- a/clients/client-kafka/src/pagination/ListClusterOperationsPaginator.ts +++ b/clients/client-kafka/src/pagination/ListClusterOperationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KafkaClient } from "../KafkaClient"; import { KafkaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaClient, - input: ListClusterOperationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClusterOperationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClusterOperations( +export const paginateListClusterOperations: ( config: KafkaPaginationConfiguration, input: ListClusterOperationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClusterOperationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KafkaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kafka | KafkaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaPaginationConfiguration, + ListClusterOperationsCommandInput, + ListClusterOperationsCommandOutput +>(KafkaClient, ListClusterOperationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kafka/src/pagination/ListClusterOperationsV2Paginator.ts b/clients/client-kafka/src/pagination/ListClusterOperationsV2Paginator.ts index 9fe9ec997b7e..e7eaf57843bc 100644 --- a/clients/client-kafka/src/pagination/ListClusterOperationsV2Paginator.ts +++ b/clients/client-kafka/src/pagination/ListClusterOperationsV2Paginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KafkaClient } from "../KafkaClient"; import { KafkaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaClient, - input: ListClusterOperationsV2CommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClusterOperationsV2Command(input), ...args); -}; /** * @public */ -export async function* paginateListClusterOperationsV2( +export const paginateListClusterOperationsV2: ( config: KafkaPaginationConfiguration, input: ListClusterOperationsV2CommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClusterOperationsV2CommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KafkaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kafka | KafkaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaPaginationConfiguration, + ListClusterOperationsV2CommandInput, + ListClusterOperationsV2CommandOutput +>(KafkaClient, ListClusterOperationsV2Command, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kafka/src/pagination/ListClustersPaginator.ts b/clients/client-kafka/src/pagination/ListClustersPaginator.ts index b80027c92fef..3d9a9c0831ae 100644 --- a/clients/client-kafka/src/pagination/ListClustersPaginator.ts +++ b/clients/client-kafka/src/pagination/ListClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KafkaClient } from "../KafkaClient"; import { KafkaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaClient, - input: ListClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClusters( +export const paginateListClusters: ( config: KafkaPaginationConfiguration, input: ListClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClustersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KafkaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kafka | KafkaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaPaginationConfiguration, + ListClustersCommandInput, + ListClustersCommandOutput +>(KafkaClient, ListClustersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kafka/src/pagination/ListClustersV2Paginator.ts b/clients/client-kafka/src/pagination/ListClustersV2Paginator.ts index 34cc7a386bd0..37539bbf627e 100644 --- a/clients/client-kafka/src/pagination/ListClustersV2Paginator.ts +++ b/clients/client-kafka/src/pagination/ListClustersV2Paginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KafkaClient } from "../KafkaClient"; import { KafkaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaClient, - input: ListClustersV2CommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClustersV2Command(input), ...args); -}; /** * @public */ -export async function* paginateListClustersV2( +export const paginateListClustersV2: ( config: KafkaPaginationConfiguration, input: ListClustersV2CommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClustersV2CommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KafkaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kafka | KafkaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaPaginationConfiguration, + ListClustersV2CommandInput, + ListClustersV2CommandOutput +>(KafkaClient, ListClustersV2Command, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kafka/src/pagination/ListConfigurationRevisionsPaginator.ts b/clients/client-kafka/src/pagination/ListConfigurationRevisionsPaginator.ts index fdfdd6d1f61e..9c2f5fcff396 100644 --- a/clients/client-kafka/src/pagination/ListConfigurationRevisionsPaginator.ts +++ b/clients/client-kafka/src/pagination/ListConfigurationRevisionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KafkaClient } from "../KafkaClient"; import { KafkaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaClient, - input: ListConfigurationRevisionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConfigurationRevisionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConfigurationRevisions( +export const paginateListConfigurationRevisions: ( config: KafkaPaginationConfiguration, input: ListConfigurationRevisionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConfigurationRevisionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KafkaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kafka | KafkaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaPaginationConfiguration, + ListConfigurationRevisionsCommandInput, + ListConfigurationRevisionsCommandOutput +>(KafkaClient, ListConfigurationRevisionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kafka/src/pagination/ListConfigurationsPaginator.ts b/clients/client-kafka/src/pagination/ListConfigurationsPaginator.ts index c041322070ec..8496d07a77f6 100644 --- a/clients/client-kafka/src/pagination/ListConfigurationsPaginator.ts +++ b/clients/client-kafka/src/pagination/ListConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KafkaClient } from "../KafkaClient"; import { KafkaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaClient, - input: ListConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConfigurations( +export const paginateListConfigurations: ( config: KafkaPaginationConfiguration, input: ListConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KafkaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kafka | KafkaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaPaginationConfiguration, + ListConfigurationsCommandInput, + ListConfigurationsCommandOutput +>(KafkaClient, ListConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kafka/src/pagination/ListKafkaVersionsPaginator.ts b/clients/client-kafka/src/pagination/ListKafkaVersionsPaginator.ts index 7dbda64c231b..a1f33d1301fc 100644 --- a/clients/client-kafka/src/pagination/ListKafkaVersionsPaginator.ts +++ b/clients/client-kafka/src/pagination/ListKafkaVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KafkaClient } from "../KafkaClient"; import { KafkaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaClient, - input: ListKafkaVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKafkaVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKafkaVersions( +export const paginateListKafkaVersions: ( config: KafkaPaginationConfiguration, input: ListKafkaVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKafkaVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KafkaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kafka | KafkaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaPaginationConfiguration, + ListKafkaVersionsCommandInput, + ListKafkaVersionsCommandOutput +>(KafkaClient, ListKafkaVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kafka/src/pagination/ListNodesPaginator.ts b/clients/client-kafka/src/pagination/ListNodesPaginator.ts index d200b17b2917..f1a71e425b17 100644 --- a/clients/client-kafka/src/pagination/ListNodesPaginator.ts +++ b/clients/client-kafka/src/pagination/ListNodesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListNodesCommand, ListNodesCommandInput, ListNodesCommandOutput } from "../commands/ListNodesCommand"; import { KafkaClient } from "../KafkaClient"; import { KafkaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaClient, - input: ListNodesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNodesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNodes( +export const paginateListNodes: ( config: KafkaPaginationConfiguration, input: ListNodesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNodesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KafkaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kafka | KafkaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaPaginationConfiguration, + ListNodesCommandInput, + ListNodesCommandOutput +>(KafkaClient, ListNodesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kafka/src/pagination/ListReplicatorsPaginator.ts b/clients/client-kafka/src/pagination/ListReplicatorsPaginator.ts index ceff965c0956..b60da4fa3239 100644 --- a/clients/client-kafka/src/pagination/ListReplicatorsPaginator.ts +++ b/clients/client-kafka/src/pagination/ListReplicatorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KafkaClient } from "../KafkaClient"; import { KafkaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaClient, - input: ListReplicatorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReplicatorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReplicators( +export const paginateListReplicators: ( config: KafkaPaginationConfiguration, input: ListReplicatorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReplicatorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KafkaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kafka | KafkaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaPaginationConfiguration, + ListReplicatorsCommandInput, + ListReplicatorsCommandOutput +>(KafkaClient, ListReplicatorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kafka/src/pagination/ListScramSecretsPaginator.ts b/clients/client-kafka/src/pagination/ListScramSecretsPaginator.ts index 95219fb2f10e..17ab9f77a18d 100644 --- a/clients/client-kafka/src/pagination/ListScramSecretsPaginator.ts +++ b/clients/client-kafka/src/pagination/ListScramSecretsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KafkaClient } from "../KafkaClient"; import { KafkaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaClient, - input: ListScramSecretsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListScramSecretsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListScramSecrets( +export const paginateListScramSecrets: ( config: KafkaPaginationConfiguration, input: ListScramSecretsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListScramSecretsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KafkaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kafka | KafkaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaPaginationConfiguration, + ListScramSecretsCommandInput, + ListScramSecretsCommandOutput +>(KafkaClient, ListScramSecretsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kafka/src/pagination/ListVpcConnectionsPaginator.ts b/clients/client-kafka/src/pagination/ListVpcConnectionsPaginator.ts index 0e4750055a66..05ee27a96318 100644 --- a/clients/client-kafka/src/pagination/ListVpcConnectionsPaginator.ts +++ b/clients/client-kafka/src/pagination/ListVpcConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KafkaClient } from "../KafkaClient"; import { KafkaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaClient, - input: ListVpcConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVpcConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVpcConnections( +export const paginateListVpcConnections: ( config: KafkaPaginationConfiguration, input: ListVpcConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVpcConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KafkaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kafka | KafkaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaPaginationConfiguration, + ListVpcConnectionsCommandInput, + ListVpcConnectionsCommandOutput +>(KafkaClient, ListVpcConnectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kafkaconnect/src/pagination/ListConnectorsPaginator.ts b/clients/client-kafkaconnect/src/pagination/ListConnectorsPaginator.ts index f51d7d3b3e91..a031d3a6770a 100644 --- a/clients/client-kafkaconnect/src/pagination/ListConnectorsPaginator.ts +++ b/clients/client-kafkaconnect/src/pagination/ListConnectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KafkaConnectClient } from "../KafkaConnectClient"; import { KafkaConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaConnectClient, - input: ListConnectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConnectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConnectors( +export const paginateListConnectors: ( config: KafkaConnectPaginationConfiguration, input: ListConnectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConnectorsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof KafkaConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KafkaConnect | KafkaConnectClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaConnectPaginationConfiguration, + ListConnectorsCommandInput, + ListConnectorsCommandOutput +>(KafkaConnectClient, ListConnectorsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-kafkaconnect/src/pagination/ListCustomPluginsPaginator.ts b/clients/client-kafkaconnect/src/pagination/ListCustomPluginsPaginator.ts index 49a5f5dd1e9c..216acd900e58 100644 --- a/clients/client-kafkaconnect/src/pagination/ListCustomPluginsPaginator.ts +++ b/clients/client-kafkaconnect/src/pagination/ListCustomPluginsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KafkaConnectClient } from "../KafkaConnectClient"; import { KafkaConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaConnectClient, - input: ListCustomPluginsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomPluginsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomPlugins( +export const paginateListCustomPlugins: ( config: KafkaConnectPaginationConfiguration, input: ListCustomPluginsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomPluginsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof KafkaConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KafkaConnect | KafkaConnectClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaConnectPaginationConfiguration, + ListCustomPluginsCommandInput, + ListCustomPluginsCommandOutput +>(KafkaConnectClient, ListCustomPluginsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-kafkaconnect/src/pagination/ListWorkerConfigurationsPaginator.ts b/clients/client-kafkaconnect/src/pagination/ListWorkerConfigurationsPaginator.ts index 07d8eedfde14..c3168a447007 100644 --- a/clients/client-kafkaconnect/src/pagination/ListWorkerConfigurationsPaginator.ts +++ b/clients/client-kafkaconnect/src/pagination/ListWorkerConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KafkaConnectClient } from "../KafkaConnectClient"; import { KafkaConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KafkaConnectClient, - input: ListWorkerConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkerConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkerConfigurations( +export const paginateListWorkerConfigurations: ( config: KafkaConnectPaginationConfiguration, input: ListWorkerConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkerConfigurationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof KafkaConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KafkaConnect | KafkaConnectClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KafkaConnectPaginationConfiguration, + ListWorkerConfigurationsCommandInput, + ListWorkerConfigurationsCommandOutput +>(KafkaConnectClient, ListWorkerConfigurationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-kendra-ranking/package.json b/clients/client-kendra-ranking/package.json index fd09322d19a1..6aad301cbe2f 100644 --- a/clients/client-kendra-ranking/package.json +++ b/clients/client-kendra-ranking/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-kendra-ranking/src/pagination/ListRescoreExecutionPlansPaginator.ts b/clients/client-kendra-ranking/src/pagination/ListRescoreExecutionPlansPaginator.ts index 1f5c2978c203..07ef630b03e4 100644 --- a/clients/client-kendra-ranking/src/pagination/ListRescoreExecutionPlansPaginator.ts +++ b/clients/client-kendra-ranking/src/pagination/ListRescoreExecutionPlansPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KendraRankingClient } from "../KendraRankingClient"; import { KendraRankingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KendraRankingClient, - input: ListRescoreExecutionPlansCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRescoreExecutionPlansCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRescoreExecutionPlans( +export const paginateListRescoreExecutionPlans: ( config: KendraRankingPaginationConfiguration, input: ListRescoreExecutionPlansCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRescoreExecutionPlansCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KendraRankingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KendraRanking | KendraRankingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KendraRankingPaginationConfiguration, + ListRescoreExecutionPlansCommandInput, + ListRescoreExecutionPlansCommandOutput +>(KendraRankingClient, ListRescoreExecutionPlansCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kendra/package.json b/clients/client-kendra/package.json index 9d2ac6122079..6326a2c48c9e 100644 --- a/clients/client-kendra/package.json +++ b/clients/client-kendra/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-kendra/src/pagination/GetSnapshotsPaginator.ts b/clients/client-kendra/src/pagination/GetSnapshotsPaginator.ts index 76136de63636..bec3d552b675 100644 --- a/clients/client-kendra/src/pagination/GetSnapshotsPaginator.ts +++ b/clients/client-kendra/src/pagination/GetSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KendraClient } from "../KendraClient"; import { KendraPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KendraClient, - input: GetSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetSnapshots( +export const paginateGetSnapshots: ( config: KendraPaginationConfiguration, input: GetSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetSnapshotsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KendraClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kendra | KendraClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KendraPaginationConfiguration, + GetSnapshotsCommandInput, + GetSnapshotsCommandOutput +>(KendraClient, GetSnapshotsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kendra/src/pagination/ListAccessControlConfigurationsPaginator.ts b/clients/client-kendra/src/pagination/ListAccessControlConfigurationsPaginator.ts index a3f584d8b407..b24dfe35432b 100644 --- a/clients/client-kendra/src/pagination/ListAccessControlConfigurationsPaginator.ts +++ b/clients/client-kendra/src/pagination/ListAccessControlConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KendraClient } from "../KendraClient"; import { KendraPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KendraClient, - input: ListAccessControlConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessControlConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessControlConfigurations( +export const paginateListAccessControlConfigurations: ( config: KendraPaginationConfiguration, input: ListAccessControlConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessControlConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KendraClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kendra | KendraClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KendraPaginationConfiguration, + ListAccessControlConfigurationsCommandInput, + ListAccessControlConfigurationsCommandOutput +>(KendraClient, ListAccessControlConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kendra/src/pagination/ListDataSourceSyncJobsPaginator.ts b/clients/client-kendra/src/pagination/ListDataSourceSyncJobsPaginator.ts index cdeba2385690..1fccf2be8534 100644 --- a/clients/client-kendra/src/pagination/ListDataSourceSyncJobsPaginator.ts +++ b/clients/client-kendra/src/pagination/ListDataSourceSyncJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KendraClient } from "../KendraClient"; import { KendraPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KendraClient, - input: ListDataSourceSyncJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataSourceSyncJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataSourceSyncJobs( +export const paginateListDataSourceSyncJobs: ( config: KendraPaginationConfiguration, input: ListDataSourceSyncJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataSourceSyncJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KendraClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kendra | KendraClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KendraPaginationConfiguration, + ListDataSourceSyncJobsCommandInput, + ListDataSourceSyncJobsCommandOutput +>(KendraClient, ListDataSourceSyncJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kendra/src/pagination/ListDataSourcesPaginator.ts b/clients/client-kendra/src/pagination/ListDataSourcesPaginator.ts index f80958ef1951..0378cc9a28c8 100644 --- a/clients/client-kendra/src/pagination/ListDataSourcesPaginator.ts +++ b/clients/client-kendra/src/pagination/ListDataSourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KendraClient } from "../KendraClient"; import { KendraPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KendraClient, - input: ListDataSourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataSourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataSources( +export const paginateListDataSources: ( config: KendraPaginationConfiguration, input: ListDataSourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataSourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KendraClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kendra | KendraClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KendraPaginationConfiguration, + ListDataSourcesCommandInput, + ListDataSourcesCommandOutput +>(KendraClient, ListDataSourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kendra/src/pagination/ListEntityPersonasPaginator.ts b/clients/client-kendra/src/pagination/ListEntityPersonasPaginator.ts index c579b47e6e16..975cb88a3420 100644 --- a/clients/client-kendra/src/pagination/ListEntityPersonasPaginator.ts +++ b/clients/client-kendra/src/pagination/ListEntityPersonasPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KendraClient } from "../KendraClient"; import { KendraPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KendraClient, - input: ListEntityPersonasCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEntityPersonasCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEntityPersonas( +export const paginateListEntityPersonas: ( config: KendraPaginationConfiguration, input: ListEntityPersonasCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEntityPersonasCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KendraClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kendra | KendraClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KendraPaginationConfiguration, + ListEntityPersonasCommandInput, + ListEntityPersonasCommandOutput +>(KendraClient, ListEntityPersonasCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kendra/src/pagination/ListExperienceEntitiesPaginator.ts b/clients/client-kendra/src/pagination/ListExperienceEntitiesPaginator.ts index 19386b148f83..51a0f8332cc4 100644 --- a/clients/client-kendra/src/pagination/ListExperienceEntitiesPaginator.ts +++ b/clients/client-kendra/src/pagination/ListExperienceEntitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { KendraClient } from "../KendraClient"; import { KendraPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KendraClient, - input: ListExperienceEntitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExperienceEntitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExperienceEntities( +export const paginateListExperienceEntities: ( config: KendraPaginationConfiguration, input: ListExperienceEntitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExperienceEntitiesCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof KendraClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kendra | KendraClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KendraPaginationConfiguration, + ListExperienceEntitiesCommandInput, + ListExperienceEntitiesCommandOutput +>(KendraClient, ListExperienceEntitiesCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-kendra/src/pagination/ListExperiencesPaginator.ts b/clients/client-kendra/src/pagination/ListExperiencesPaginator.ts index ab0a9e1b6c5f..ce9b318bc4e8 100644 --- a/clients/client-kendra/src/pagination/ListExperiencesPaginator.ts +++ b/clients/client-kendra/src/pagination/ListExperiencesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KendraClient } from "../KendraClient"; import { KendraPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KendraClient, - input: ListExperiencesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExperiencesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExperiences( +export const paginateListExperiences: ( config: KendraPaginationConfiguration, input: ListExperiencesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExperiencesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KendraClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kendra | KendraClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KendraPaginationConfiguration, + ListExperiencesCommandInput, + ListExperiencesCommandOutput +>(KendraClient, ListExperiencesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kendra/src/pagination/ListFaqsPaginator.ts b/clients/client-kendra/src/pagination/ListFaqsPaginator.ts index c5d6496cf644..3d4795ab18e7 100644 --- a/clients/client-kendra/src/pagination/ListFaqsPaginator.ts +++ b/clients/client-kendra/src/pagination/ListFaqsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListFaqsCommand, ListFaqsCommandInput, ListFaqsCommandOutput } from "../commands/ListFaqsCommand"; import { KendraClient } from "../KendraClient"; import { KendraPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KendraClient, - input: ListFaqsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFaqsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFaqs( +export const paginateListFaqs: ( config: KendraPaginationConfiguration, input: ListFaqsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFaqsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KendraClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kendra | KendraClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KendraPaginationConfiguration, + ListFaqsCommandInput, + ListFaqsCommandOutput +>(KendraClient, ListFaqsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kendra/src/pagination/ListGroupsOlderThanOrderingIdPaginator.ts b/clients/client-kendra/src/pagination/ListGroupsOlderThanOrderingIdPaginator.ts index 3ab0404c338b..15ef6b96dffc 100644 --- a/clients/client-kendra/src/pagination/ListGroupsOlderThanOrderingIdPaginator.ts +++ b/clients/client-kendra/src/pagination/ListGroupsOlderThanOrderingIdPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KendraClient } from "../KendraClient"; import { KendraPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KendraClient, - input: ListGroupsOlderThanOrderingIdCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupsOlderThanOrderingIdCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroupsOlderThanOrderingId( +export const paginateListGroupsOlderThanOrderingId: ( config: KendraPaginationConfiguration, input: ListGroupsOlderThanOrderingIdCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupsOlderThanOrderingIdCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KendraClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kendra | KendraClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KendraPaginationConfiguration, + ListGroupsOlderThanOrderingIdCommandInput, + ListGroupsOlderThanOrderingIdCommandOutput +>(KendraClient, ListGroupsOlderThanOrderingIdCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kendra/src/pagination/ListIndicesPaginator.ts b/clients/client-kendra/src/pagination/ListIndicesPaginator.ts index 55105d01a74d..c0f5a8614283 100644 --- a/clients/client-kendra/src/pagination/ListIndicesPaginator.ts +++ b/clients/client-kendra/src/pagination/ListIndicesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListIndicesCommand, ListIndicesCommandInput, ListIndicesCommandOutput } from "../commands/ListIndicesCommand"; import { KendraClient } from "../KendraClient"; import { KendraPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KendraClient, - input: ListIndicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIndicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIndices( +export const paginateListIndices: ( config: KendraPaginationConfiguration, input: ListIndicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIndicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KendraClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kendra | KendraClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KendraPaginationConfiguration, + ListIndicesCommandInput, + ListIndicesCommandOutput +>(KendraClient, ListIndicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kendra/src/pagination/ListQuerySuggestionsBlockListsPaginator.ts b/clients/client-kendra/src/pagination/ListQuerySuggestionsBlockListsPaginator.ts index 58ee72a948b6..c615dc42afcb 100644 --- a/clients/client-kendra/src/pagination/ListQuerySuggestionsBlockListsPaginator.ts +++ b/clients/client-kendra/src/pagination/ListQuerySuggestionsBlockListsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KendraClient } from "../KendraClient"; import { KendraPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KendraClient, - input: ListQuerySuggestionsBlockListsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListQuerySuggestionsBlockListsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListQuerySuggestionsBlockLists( +export const paginateListQuerySuggestionsBlockLists: ( config: KendraPaginationConfiguration, input: ListQuerySuggestionsBlockListsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListQuerySuggestionsBlockListsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KendraClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kendra | KendraClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KendraPaginationConfiguration, + ListQuerySuggestionsBlockListsCommandInput, + ListQuerySuggestionsBlockListsCommandOutput +>(KendraClient, ListQuerySuggestionsBlockListsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kendra/src/pagination/ListThesauriPaginator.ts b/clients/client-kendra/src/pagination/ListThesauriPaginator.ts index 53782f80f912..88100e4c3a9c 100644 --- a/clients/client-kendra/src/pagination/ListThesauriPaginator.ts +++ b/clients/client-kendra/src/pagination/ListThesauriPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KendraClient } from "../KendraClient"; import { KendraPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KendraClient, - input: ListThesauriCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThesauriCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThesauri( +export const paginateListThesauri: ( config: KendraPaginationConfiguration, input: ListThesauriCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThesauriCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KendraClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kendra | KendraClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KendraPaginationConfiguration, + ListThesauriCommandInput, + ListThesauriCommandOutput +>(KendraClient, ListThesauriCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-keyspaces/package.json b/clients/client-keyspaces/package.json index 303d44be9e28..7e48915a77aa 100644 --- a/clients/client-keyspaces/package.json +++ b/clients/client-keyspaces/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-keyspaces/src/pagination/ListKeyspacesPaginator.ts b/clients/client-keyspaces/src/pagination/ListKeyspacesPaginator.ts index f05bf9a01ae1..11d7240a99a3 100644 --- a/clients/client-keyspaces/src/pagination/ListKeyspacesPaginator.ts +++ b/clients/client-keyspaces/src/pagination/ListKeyspacesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KeyspacesClient } from "../KeyspacesClient"; import { KeyspacesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KeyspacesClient, - input: ListKeyspacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKeyspacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKeyspaces( +export const paginateListKeyspaces: ( config: KeyspacesPaginationConfiguration, input: ListKeyspacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKeyspacesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof KeyspacesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Keyspaces | KeyspacesClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KeyspacesPaginationConfiguration, + ListKeyspacesCommandInput, + ListKeyspacesCommandOutput +>(KeyspacesClient, ListKeyspacesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-keyspaces/src/pagination/ListTablesPaginator.ts b/clients/client-keyspaces/src/pagination/ListTablesPaginator.ts index 96c5441d50f4..c726917f85f9 100644 --- a/clients/client-keyspaces/src/pagination/ListTablesPaginator.ts +++ b/clients/client-keyspaces/src/pagination/ListTablesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTablesCommand, ListTablesCommandInput, ListTablesCommandOutput } from "../commands/ListTablesCommand"; import { KeyspacesClient } from "../KeyspacesClient"; import { KeyspacesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KeyspacesClient, - input: ListTablesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTablesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTables( +export const paginateListTables: ( config: KeyspacesPaginationConfiguration, input: ListTablesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTablesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof KeyspacesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Keyspaces | KeyspacesClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KeyspacesPaginationConfiguration, + ListTablesCommandInput, + ListTablesCommandOutput +>(KeyspacesClient, ListTablesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-keyspaces/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-keyspaces/src/pagination/ListTagsForResourcePaginator.ts index 139d38a115d0..6e79f067999b 100644 --- a/clients/client-keyspaces/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-keyspaces/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KeyspacesClient } from "../KeyspacesClient"; import { KeyspacesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KeyspacesClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: KeyspacesPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof KeyspacesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Keyspaces | KeyspacesClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KeyspacesPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(KeyspacesClient, ListTagsForResourceCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-kinesis-video-archived-media/src/pagination/GetImagesPaginator.ts b/clients/client-kinesis-video-archived-media/src/pagination/GetImagesPaginator.ts index a3dc49e5ccb1..c884c6c34bbc 100644 --- a/clients/client-kinesis-video-archived-media/src/pagination/GetImagesPaginator.ts +++ b/clients/client-kinesis-video-archived-media/src/pagination/GetImagesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetImagesCommand, GetImagesCommandInput, GetImagesCommandOutput } from "../commands/GetImagesCommand"; import { KinesisVideoArchivedMediaClient } from "../KinesisVideoArchivedMediaClient"; import { KinesisVideoArchivedMediaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KinesisVideoArchivedMediaClient, - input: GetImagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetImagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetImages( +export const paginateGetImages: ( config: KinesisVideoArchivedMediaPaginationConfiguration, input: GetImagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetImagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KinesisVideoArchivedMediaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KinesisVideoArchivedMedia | KinesisVideoArchivedMediaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KinesisVideoArchivedMediaPaginationConfiguration, + GetImagesCommandInput, + GetImagesCommandOutput +>(KinesisVideoArchivedMediaClient, GetImagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kinesis-video-archived-media/src/pagination/ListFragmentsPaginator.ts b/clients/client-kinesis-video-archived-media/src/pagination/ListFragmentsPaginator.ts index b0d224b71118..33df2ab225ad 100644 --- a/clients/client-kinesis-video-archived-media/src/pagination/ListFragmentsPaginator.ts +++ b/clients/client-kinesis-video-archived-media/src/pagination/ListFragmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KinesisVideoArchivedMediaClient } from "../KinesisVideoArchivedMediaClient"; import { KinesisVideoArchivedMediaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KinesisVideoArchivedMediaClient, - input: ListFragmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFragmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFragments( +export const paginateListFragments: ( config: KinesisVideoArchivedMediaPaginationConfiguration, input: ListFragmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFragmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KinesisVideoArchivedMediaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KinesisVideoArchivedMedia | KinesisVideoArchivedMediaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KinesisVideoArchivedMediaPaginationConfiguration, + ListFragmentsCommandInput, + ListFragmentsCommandOutput +>(KinesisVideoArchivedMediaClient, ListFragmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kinesis-video/src/pagination/DescribeMappedResourceConfigurationPaginator.ts b/clients/client-kinesis-video/src/pagination/DescribeMappedResourceConfigurationPaginator.ts index c29723b32dd4..cc1383c35242 100644 --- a/clients/client-kinesis-video/src/pagination/DescribeMappedResourceConfigurationPaginator.ts +++ b/clients/client-kinesis-video/src/pagination/DescribeMappedResourceConfigurationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KinesisVideoClient } from "../KinesisVideoClient"; import { KinesisVideoPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KinesisVideoClient, - input: DescribeMappedResourceConfigurationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMappedResourceConfigurationCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMappedResourceConfiguration( +export const paginateDescribeMappedResourceConfiguration: ( config: KinesisVideoPaginationConfiguration, input: DescribeMappedResourceConfigurationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMappedResourceConfigurationCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KinesisVideoClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KinesisVideo | KinesisVideoClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KinesisVideoPaginationConfiguration, + DescribeMappedResourceConfigurationCommandInput, + DescribeMappedResourceConfigurationCommandOutput +>(KinesisVideoClient, DescribeMappedResourceConfigurationCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kinesis-video/src/pagination/ListEdgeAgentConfigurationsPaginator.ts b/clients/client-kinesis-video/src/pagination/ListEdgeAgentConfigurationsPaginator.ts index ebb69143798c..76ed2f63c78c 100644 --- a/clients/client-kinesis-video/src/pagination/ListEdgeAgentConfigurationsPaginator.ts +++ b/clients/client-kinesis-video/src/pagination/ListEdgeAgentConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KinesisVideoClient } from "../KinesisVideoClient"; import { KinesisVideoPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KinesisVideoClient, - input: ListEdgeAgentConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEdgeAgentConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEdgeAgentConfigurations( +export const paginateListEdgeAgentConfigurations: ( config: KinesisVideoPaginationConfiguration, input: ListEdgeAgentConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEdgeAgentConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KinesisVideoClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KinesisVideo | KinesisVideoClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KinesisVideoPaginationConfiguration, + ListEdgeAgentConfigurationsCommandInput, + ListEdgeAgentConfigurationsCommandOutput +>(KinesisVideoClient, ListEdgeAgentConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kinesis-video/src/pagination/ListSignalingChannelsPaginator.ts b/clients/client-kinesis-video/src/pagination/ListSignalingChannelsPaginator.ts index 9123c98e574d..d620c1cb8eeb 100644 --- a/clients/client-kinesis-video/src/pagination/ListSignalingChannelsPaginator.ts +++ b/clients/client-kinesis-video/src/pagination/ListSignalingChannelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KinesisVideoClient } from "../KinesisVideoClient"; import { KinesisVideoPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KinesisVideoClient, - input: ListSignalingChannelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSignalingChannelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSignalingChannels( +export const paginateListSignalingChannels: ( config: KinesisVideoPaginationConfiguration, input: ListSignalingChannelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSignalingChannelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KinesisVideoClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KinesisVideo | KinesisVideoClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KinesisVideoPaginationConfiguration, + ListSignalingChannelsCommandInput, + ListSignalingChannelsCommandOutput +>(KinesisVideoClient, ListSignalingChannelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kinesis-video/src/pagination/ListStreamsPaginator.ts b/clients/client-kinesis-video/src/pagination/ListStreamsPaginator.ts index 0ec388a5bbe1..a052e8ef4929 100644 --- a/clients/client-kinesis-video/src/pagination/ListStreamsPaginator.ts +++ b/clients/client-kinesis-video/src/pagination/ListStreamsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListStreamsCommand, ListStreamsCommandInput, ListStreamsCommandOutput } from "../commands/ListStreamsCommand"; import { KinesisVideoClient } from "../KinesisVideoClient"; import { KinesisVideoPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KinesisVideoClient, - input: ListStreamsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStreamsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStreams( +export const paginateListStreams: ( config: KinesisVideoPaginationConfiguration, input: ListStreamsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStreamsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KinesisVideoClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KinesisVideo | KinesisVideoClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KinesisVideoPaginationConfiguration, + ListStreamsCommandInput, + ListStreamsCommandOutput +>(KinesisVideoClient, ListStreamsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kinesis/package.json b/clients/client-kinesis/package.json index 39016ff9d6e1..0865a18b7bb3 100644 --- a/clients/client-kinesis/package.json +++ b/clients/client-kinesis/package.json @@ -35,6 +35,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/eventstream-serde-browser": "^2.0.15", "@smithy/eventstream-serde-config-resolver": "^2.0.15", "@smithy/eventstream-serde-node": "^2.0.15", diff --git a/clients/client-kinesis/src/pagination/ListStreamConsumersPaginator.ts b/clients/client-kinesis/src/pagination/ListStreamConsumersPaginator.ts index 53dabd439072..1b55e87ddea2 100644 --- a/clients/client-kinesis/src/pagination/ListStreamConsumersPaginator.ts +++ b/clients/client-kinesis/src/pagination/ListStreamConsumersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KinesisClient } from "../KinesisClient"; import { KinesisPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KinesisClient, - input: ListStreamConsumersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStreamConsumersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStreamConsumers( +export const paginateListStreamConsumers: ( config: KinesisPaginationConfiguration, input: ListStreamConsumersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStreamConsumersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof KinesisClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kinesis | KinesisClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KinesisPaginationConfiguration, + ListStreamConsumersCommandInput, + ListStreamConsumersCommandOutput +>(KinesisClient, ListStreamConsumersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-kinesis/src/pagination/ListStreamsPaginator.ts b/clients/client-kinesis/src/pagination/ListStreamsPaginator.ts index d2f8cc931b07..3c1c31d89d7e 100644 --- a/clients/client-kinesis/src/pagination/ListStreamsPaginator.ts +++ b/clients/client-kinesis/src/pagination/ListStreamsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListStreamsCommand, ListStreamsCommandInput, ListStreamsCommandOutput } from "../commands/ListStreamsCommand"; import { KinesisClient } from "../KinesisClient"; import { KinesisPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KinesisClient, - input: ListStreamsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStreamsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStreams( +export const paginateListStreams: ( config: KinesisPaginationConfiguration, input: ListStreamsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStreamsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof KinesisClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Kinesis | KinesisClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KinesisPaginationConfiguration, + ListStreamsCommandInput, + ListStreamsCommandOutput +>(KinesisClient, ListStreamsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-kms/package.json b/clients/client-kms/package.json index c4f7fa195258..4724248e1f3c 100644 --- a/clients/client-kms/package.json +++ b/clients/client-kms/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-kms/src/pagination/DescribeCustomKeyStoresPaginator.ts b/clients/client-kms/src/pagination/DescribeCustomKeyStoresPaginator.ts index de8b808f5639..4068a7f76edf 100644 --- a/clients/client-kms/src/pagination/DescribeCustomKeyStoresPaginator.ts +++ b/clients/client-kms/src/pagination/DescribeCustomKeyStoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KMSClient } from "../KMSClient"; import { KMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KMSClient, - input: DescribeCustomKeyStoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCustomKeyStoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCustomKeyStores( +export const paginateDescribeCustomKeyStores: ( config: KMSPaginationConfiguration, input: DescribeCustomKeyStoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCustomKeyStoresCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof KMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KMS | KMSClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KMSPaginationConfiguration, + DescribeCustomKeyStoresCommandInput, + DescribeCustomKeyStoresCommandOutput +>(KMSClient, DescribeCustomKeyStoresCommand, "Marker", "NextMarker", "Limit"); diff --git a/clients/client-kms/src/pagination/ListAliasesPaginator.ts b/clients/client-kms/src/pagination/ListAliasesPaginator.ts index 4272b5fbd3a1..1a1718478f82 100644 --- a/clients/client-kms/src/pagination/ListAliasesPaginator.ts +++ b/clients/client-kms/src/pagination/ListAliasesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAliasesCommand, ListAliasesCommandInput, ListAliasesCommandOutput } from "../commands/ListAliasesCommand"; import { KMSClient } from "../KMSClient"; import { KMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KMSClient, - input: ListAliasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAliasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAliases( +export const paginateListAliases: ( config: KMSPaginationConfiguration, input: ListAliasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAliasesCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof KMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KMS | KMSClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KMSPaginationConfiguration, + ListAliasesCommandInput, + ListAliasesCommandOutput +>(KMSClient, ListAliasesCommand, "Marker", "NextMarker", "Limit"); diff --git a/clients/client-kms/src/pagination/ListGrantsPaginator.ts b/clients/client-kms/src/pagination/ListGrantsPaginator.ts index b0df6505ca23..183d9af4a786 100644 --- a/clients/client-kms/src/pagination/ListGrantsPaginator.ts +++ b/clients/client-kms/src/pagination/ListGrantsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListGrantsCommand, ListGrantsCommandInput, ListGrantsCommandOutput } from "../commands/ListGrantsCommand"; import { KMSClient } from "../KMSClient"; import { KMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KMSClient, - input: ListGrantsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGrantsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGrants( +export const paginateListGrants: ( config: KMSPaginationConfiguration, input: ListGrantsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGrantsCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof KMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KMS | KMSClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KMSPaginationConfiguration, + ListGrantsCommandInput, + ListGrantsCommandOutput +>(KMSClient, ListGrantsCommand, "Marker", "NextMarker", "Limit"); diff --git a/clients/client-kms/src/pagination/ListKeyPoliciesPaginator.ts b/clients/client-kms/src/pagination/ListKeyPoliciesPaginator.ts index 445bbfb3baa0..e4208bb7d9a6 100644 --- a/clients/client-kms/src/pagination/ListKeyPoliciesPaginator.ts +++ b/clients/client-kms/src/pagination/ListKeyPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KMSClient } from "../KMSClient"; import { KMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KMSClient, - input: ListKeyPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKeyPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKeyPolicies( +export const paginateListKeyPolicies: ( config: KMSPaginationConfiguration, input: ListKeyPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKeyPoliciesCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof KMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KMS | KMSClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KMSPaginationConfiguration, + ListKeyPoliciesCommandInput, + ListKeyPoliciesCommandOutput +>(KMSClient, ListKeyPoliciesCommand, "Marker", "NextMarker", "Limit"); diff --git a/clients/client-kms/src/pagination/ListKeysPaginator.ts b/clients/client-kms/src/pagination/ListKeysPaginator.ts index 75d155833f21..1835caf6c872 100644 --- a/clients/client-kms/src/pagination/ListKeysPaginator.ts +++ b/clients/client-kms/src/pagination/ListKeysPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListKeysCommand, ListKeysCommandInput, ListKeysCommandOutput } from "../commands/ListKeysCommand"; import { KMSClient } from "../KMSClient"; import { KMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KMSClient, - input: ListKeysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKeysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKeys( +export const paginateListKeys: ( config: KMSPaginationConfiguration, input: ListKeysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKeysCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof KMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KMS | KMSClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KMSPaginationConfiguration, + ListKeysCommandInput, + ListKeysCommandOutput +>(KMSClient, ListKeysCommand, "Marker", "NextMarker", "Limit"); diff --git a/clients/client-kms/src/pagination/ListResourceTagsPaginator.ts b/clients/client-kms/src/pagination/ListResourceTagsPaginator.ts index 87fe37e09d8d..52cebfed9cf3 100644 --- a/clients/client-kms/src/pagination/ListResourceTagsPaginator.ts +++ b/clients/client-kms/src/pagination/ListResourceTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KMSClient } from "../KMSClient"; import { KMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KMSClient, - input: ListResourceTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourceTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourceTags( +export const paginateListResourceTags: ( config: KMSPaginationConfiguration, input: ListResourceTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourceTagsCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof KMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KMS | KMSClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KMSPaginationConfiguration, + ListResourceTagsCommandInput, + ListResourceTagsCommandOutput +>(KMSClient, ListResourceTagsCommand, "Marker", "NextMarker", "Limit"); diff --git a/clients/client-kms/src/pagination/ListRetirableGrantsPaginator.ts b/clients/client-kms/src/pagination/ListRetirableGrantsPaginator.ts index 9dba4aaa23bd..c4275ff1a87d 100644 --- a/clients/client-kms/src/pagination/ListRetirableGrantsPaginator.ts +++ b/clients/client-kms/src/pagination/ListRetirableGrantsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { KMSClient } from "../KMSClient"; import { KMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: KMSClient, - input: ListRetirableGrantsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRetirableGrantsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRetirableGrants( +export const paginateListRetirableGrants: ( config: KMSPaginationConfiguration, input: ListRetirableGrantsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRetirableGrantsCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof KMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected KMS | KMSClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + KMSPaginationConfiguration, + ListRetirableGrantsCommandInput, + ListRetirableGrantsCommandOutput +>(KMSClient, ListRetirableGrantsCommand, "Marker", "NextMarker", "Limit"); diff --git a/clients/client-lakeformation/src/pagination/GetEffectivePermissionsForPathPaginator.ts b/clients/client-lakeformation/src/pagination/GetEffectivePermissionsForPathPaginator.ts index 1693ddea9203..54f79411bc76 100644 --- a/clients/client-lakeformation/src/pagination/GetEffectivePermissionsForPathPaginator.ts +++ b/clients/client-lakeformation/src/pagination/GetEffectivePermissionsForPathPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LakeFormationClient } from "../LakeFormationClient"; import { LakeFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LakeFormationClient, - input: GetEffectivePermissionsForPathCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetEffectivePermissionsForPathCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetEffectivePermissionsForPath( +export const paginateGetEffectivePermissionsForPath: ( config: LakeFormationPaginationConfiguration, input: GetEffectivePermissionsForPathCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetEffectivePermissionsForPathCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LakeFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LakeFormation | LakeFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LakeFormationPaginationConfiguration, + GetEffectivePermissionsForPathCommandInput, + GetEffectivePermissionsForPathCommandOutput +>(LakeFormationClient, GetEffectivePermissionsForPathCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lakeformation/src/pagination/GetTableObjectsPaginator.ts b/clients/client-lakeformation/src/pagination/GetTableObjectsPaginator.ts index 85d5397e4c41..ea8f40db5050 100644 --- a/clients/client-lakeformation/src/pagination/GetTableObjectsPaginator.ts +++ b/clients/client-lakeformation/src/pagination/GetTableObjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LakeFormationClient } from "../LakeFormationClient"; import { LakeFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LakeFormationClient, - input: GetTableObjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTableObjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTableObjects( +export const paginateGetTableObjects: ( config: LakeFormationPaginationConfiguration, input: GetTableObjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTableObjectsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LakeFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LakeFormation | LakeFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LakeFormationPaginationConfiguration, + GetTableObjectsCommandInput, + GetTableObjectsCommandOutput +>(LakeFormationClient, GetTableObjectsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lakeformation/src/pagination/GetWorkUnitsPaginator.ts b/clients/client-lakeformation/src/pagination/GetWorkUnitsPaginator.ts index 441abac616e5..01b5ba564988 100644 --- a/clients/client-lakeformation/src/pagination/GetWorkUnitsPaginator.ts +++ b/clients/client-lakeformation/src/pagination/GetWorkUnitsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LakeFormationClient } from "../LakeFormationClient"; import { LakeFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LakeFormationClient, - input: GetWorkUnitsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetWorkUnitsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetWorkUnits( +export const paginateGetWorkUnits: ( config: LakeFormationPaginationConfiguration, input: GetWorkUnitsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetWorkUnitsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof LakeFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LakeFormation | LakeFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LakeFormationPaginationConfiguration, + GetWorkUnitsCommandInput, + GetWorkUnitsCommandOutput +>(LakeFormationClient, GetWorkUnitsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-lakeformation/src/pagination/ListDataCellsFilterPaginator.ts b/clients/client-lakeformation/src/pagination/ListDataCellsFilterPaginator.ts index c6d21b1b19a4..27db88675277 100644 --- a/clients/client-lakeformation/src/pagination/ListDataCellsFilterPaginator.ts +++ b/clients/client-lakeformation/src/pagination/ListDataCellsFilterPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LakeFormationClient } from "../LakeFormationClient"; import { LakeFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LakeFormationClient, - input: ListDataCellsFilterCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataCellsFilterCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataCellsFilter( +export const paginateListDataCellsFilter: ( config: LakeFormationPaginationConfiguration, input: ListDataCellsFilterCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataCellsFilterCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LakeFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LakeFormation | LakeFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LakeFormationPaginationConfiguration, + ListDataCellsFilterCommandInput, + ListDataCellsFilterCommandOutput +>(LakeFormationClient, ListDataCellsFilterCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lakeformation/src/pagination/ListLFTagsPaginator.ts b/clients/client-lakeformation/src/pagination/ListLFTagsPaginator.ts index 6b36e7e646b2..eab7c208d79e 100644 --- a/clients/client-lakeformation/src/pagination/ListLFTagsPaginator.ts +++ b/clients/client-lakeformation/src/pagination/ListLFTagsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListLFTagsCommand, ListLFTagsCommandInput, ListLFTagsCommandOutput } from "../commands/ListLFTagsCommand"; import { LakeFormationClient } from "../LakeFormationClient"; import { LakeFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LakeFormationClient, - input: ListLFTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLFTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLFTags( +export const paginateListLFTags: ( config: LakeFormationPaginationConfiguration, input: ListLFTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLFTagsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LakeFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LakeFormation | LakeFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LakeFormationPaginationConfiguration, + ListLFTagsCommandInput, + ListLFTagsCommandOutput +>(LakeFormationClient, ListLFTagsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lakeformation/src/pagination/ListLakeFormationOptInsPaginator.ts b/clients/client-lakeformation/src/pagination/ListLakeFormationOptInsPaginator.ts index d4e29679f43c..259ff9987184 100644 --- a/clients/client-lakeformation/src/pagination/ListLakeFormationOptInsPaginator.ts +++ b/clients/client-lakeformation/src/pagination/ListLakeFormationOptInsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LakeFormationClient } from "../LakeFormationClient"; import { LakeFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LakeFormationClient, - input: ListLakeFormationOptInsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLakeFormationOptInsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLakeFormationOptIns( +export const paginateListLakeFormationOptIns: ( config: LakeFormationPaginationConfiguration, input: ListLakeFormationOptInsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLakeFormationOptInsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LakeFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LakeFormation | LakeFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LakeFormationPaginationConfiguration, + ListLakeFormationOptInsCommandInput, + ListLakeFormationOptInsCommandOutput +>(LakeFormationClient, ListLakeFormationOptInsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lakeformation/src/pagination/ListPermissionsPaginator.ts b/clients/client-lakeformation/src/pagination/ListPermissionsPaginator.ts index e5debb8c88ee..42d6ca369a7a 100644 --- a/clients/client-lakeformation/src/pagination/ListPermissionsPaginator.ts +++ b/clients/client-lakeformation/src/pagination/ListPermissionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LakeFormationClient } from "../LakeFormationClient"; import { LakeFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LakeFormationClient, - input: ListPermissionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPermissionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPermissions( +export const paginateListPermissions: ( config: LakeFormationPaginationConfiguration, input: ListPermissionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPermissionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LakeFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LakeFormation | LakeFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LakeFormationPaginationConfiguration, + ListPermissionsCommandInput, + ListPermissionsCommandOutput +>(LakeFormationClient, ListPermissionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lakeformation/src/pagination/ListResourcesPaginator.ts b/clients/client-lakeformation/src/pagination/ListResourcesPaginator.ts index ec9a8fe7a860..ceff8a824ca6 100644 --- a/clients/client-lakeformation/src/pagination/ListResourcesPaginator.ts +++ b/clients/client-lakeformation/src/pagination/ListResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LakeFormationClient } from "../LakeFormationClient"; import { LakeFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LakeFormationClient, - input: ListResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResources( +export const paginateListResources: ( config: LakeFormationPaginationConfiguration, input: ListResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LakeFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LakeFormation | LakeFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LakeFormationPaginationConfiguration, + ListResourcesCommandInput, + ListResourcesCommandOutput +>(LakeFormationClient, ListResourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lakeformation/src/pagination/ListTableStorageOptimizersPaginator.ts b/clients/client-lakeformation/src/pagination/ListTableStorageOptimizersPaginator.ts index f758d4671341..0596847c621e 100644 --- a/clients/client-lakeformation/src/pagination/ListTableStorageOptimizersPaginator.ts +++ b/clients/client-lakeformation/src/pagination/ListTableStorageOptimizersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LakeFormationClient } from "../LakeFormationClient"; import { LakeFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LakeFormationClient, - input: ListTableStorageOptimizersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTableStorageOptimizersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTableStorageOptimizers( +export const paginateListTableStorageOptimizers: ( config: LakeFormationPaginationConfiguration, input: ListTableStorageOptimizersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTableStorageOptimizersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LakeFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LakeFormation | LakeFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LakeFormationPaginationConfiguration, + ListTableStorageOptimizersCommandInput, + ListTableStorageOptimizersCommandOutput +>(LakeFormationClient, ListTableStorageOptimizersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lakeformation/src/pagination/ListTransactionsPaginator.ts b/clients/client-lakeformation/src/pagination/ListTransactionsPaginator.ts index 3ed1e4a5f4da..ac9d7d463eba 100644 --- a/clients/client-lakeformation/src/pagination/ListTransactionsPaginator.ts +++ b/clients/client-lakeformation/src/pagination/ListTransactionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LakeFormationClient } from "../LakeFormationClient"; import { LakeFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LakeFormationClient, - input: ListTransactionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTransactionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTransactions( +export const paginateListTransactions: ( config: LakeFormationPaginationConfiguration, input: ListTransactionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTransactionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LakeFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LakeFormation | LakeFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LakeFormationPaginationConfiguration, + ListTransactionsCommandInput, + ListTransactionsCommandOutput +>(LakeFormationClient, ListTransactionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lakeformation/src/pagination/SearchDatabasesByLFTagsPaginator.ts b/clients/client-lakeformation/src/pagination/SearchDatabasesByLFTagsPaginator.ts index 7aef06fab230..94d9f88f7ffc 100644 --- a/clients/client-lakeformation/src/pagination/SearchDatabasesByLFTagsPaginator.ts +++ b/clients/client-lakeformation/src/pagination/SearchDatabasesByLFTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LakeFormationClient } from "../LakeFormationClient"; import { LakeFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LakeFormationClient, - input: SearchDatabasesByLFTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchDatabasesByLFTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchDatabasesByLFTags( +export const paginateSearchDatabasesByLFTags: ( config: LakeFormationPaginationConfiguration, input: SearchDatabasesByLFTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchDatabasesByLFTagsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LakeFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LakeFormation | LakeFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LakeFormationPaginationConfiguration, + SearchDatabasesByLFTagsCommandInput, + SearchDatabasesByLFTagsCommandOutput +>(LakeFormationClient, SearchDatabasesByLFTagsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lakeformation/src/pagination/SearchTablesByLFTagsPaginator.ts b/clients/client-lakeformation/src/pagination/SearchTablesByLFTagsPaginator.ts index 2c50b7f8b9a6..c9e8f9d9b75a 100644 --- a/clients/client-lakeformation/src/pagination/SearchTablesByLFTagsPaginator.ts +++ b/clients/client-lakeformation/src/pagination/SearchTablesByLFTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LakeFormationClient } from "../LakeFormationClient"; import { LakeFormationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LakeFormationClient, - input: SearchTablesByLFTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchTablesByLFTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchTablesByLFTags( +export const paginateSearchTablesByLFTags: ( config: LakeFormationPaginationConfiguration, input: SearchTablesByLFTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchTablesByLFTagsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LakeFormationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LakeFormation | LakeFormationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LakeFormationPaginationConfiguration, + SearchTablesByLFTagsCommandInput, + SearchTablesByLFTagsCommandOutput +>(LakeFormationClient, SearchTablesByLFTagsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lambda/src/pagination/ListAliasesPaginator.ts b/clients/client-lambda/src/pagination/ListAliasesPaginator.ts index 9a8409d2ea07..0a666a6d6cfb 100644 --- a/clients/client-lambda/src/pagination/ListAliasesPaginator.ts +++ b/clients/client-lambda/src/pagination/ListAliasesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAliasesCommand, ListAliasesCommandInput, ListAliasesCommandOutput } from "../commands/ListAliasesCommand"; import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListAliasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAliasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAliases( +export const paginateListAliases: ( config: LambdaPaginationConfiguration, input: ListAliasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAliasesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof LambdaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Lambda | LambdaClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListAliasesCommandInput, + ListAliasesCommandOutput +>(LambdaClient, ListAliasesCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListCodeSigningConfigsPaginator.ts b/clients/client-lambda/src/pagination/ListCodeSigningConfigsPaginator.ts index 217426685969..724aa5405486 100644 --- a/clients/client-lambda/src/pagination/ListCodeSigningConfigsPaginator.ts +++ b/clients/client-lambda/src/pagination/ListCodeSigningConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListCodeSigningConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCodeSigningConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCodeSigningConfigs( +export const paginateListCodeSigningConfigs: ( config: LambdaPaginationConfiguration, input: ListCodeSigningConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCodeSigningConfigsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof LambdaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Lambda | LambdaClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListCodeSigningConfigsCommandInput, + ListCodeSigningConfigsCommandOutput +>(LambdaClient, ListCodeSigningConfigsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListEventSourceMappingsPaginator.ts b/clients/client-lambda/src/pagination/ListEventSourceMappingsPaginator.ts index a4bb6ee853f4..3e9e30459f98 100644 --- a/clients/client-lambda/src/pagination/ListEventSourceMappingsPaginator.ts +++ b/clients/client-lambda/src/pagination/ListEventSourceMappingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListEventSourceMappingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEventSourceMappingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEventSourceMappings( +export const paginateListEventSourceMappings: ( config: LambdaPaginationConfiguration, input: ListEventSourceMappingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEventSourceMappingsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof LambdaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Lambda | LambdaClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListEventSourceMappingsCommandInput, + ListEventSourceMappingsCommandOutput +>(LambdaClient, ListEventSourceMappingsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListFunctionEventInvokeConfigsPaginator.ts b/clients/client-lambda/src/pagination/ListFunctionEventInvokeConfigsPaginator.ts index cb90f205c2fc..22ad0f62d58e 100644 --- a/clients/client-lambda/src/pagination/ListFunctionEventInvokeConfigsPaginator.ts +++ b/clients/client-lambda/src/pagination/ListFunctionEventInvokeConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListFunctionEventInvokeConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFunctionEventInvokeConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFunctionEventInvokeConfigs( +export const paginateListFunctionEventInvokeConfigs: ( config: LambdaPaginationConfiguration, input: ListFunctionEventInvokeConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFunctionEventInvokeConfigsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof LambdaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Lambda | LambdaClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListFunctionEventInvokeConfigsCommandInput, + ListFunctionEventInvokeConfigsCommandOutput +>(LambdaClient, ListFunctionEventInvokeConfigsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListFunctionUrlConfigsPaginator.ts b/clients/client-lambda/src/pagination/ListFunctionUrlConfigsPaginator.ts index e8d69ad4449a..73c8b3999941 100644 --- a/clients/client-lambda/src/pagination/ListFunctionUrlConfigsPaginator.ts +++ b/clients/client-lambda/src/pagination/ListFunctionUrlConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListFunctionUrlConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFunctionUrlConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFunctionUrlConfigs( +export const paginateListFunctionUrlConfigs: ( config: LambdaPaginationConfiguration, input: ListFunctionUrlConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFunctionUrlConfigsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof LambdaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Lambda | LambdaClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListFunctionUrlConfigsCommandInput, + ListFunctionUrlConfigsCommandOutput +>(LambdaClient, ListFunctionUrlConfigsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListFunctionsByCodeSigningConfigPaginator.ts b/clients/client-lambda/src/pagination/ListFunctionsByCodeSigningConfigPaginator.ts index e711d3890c12..c9adaf398e09 100644 --- a/clients/client-lambda/src/pagination/ListFunctionsByCodeSigningConfigPaginator.ts +++ b/clients/client-lambda/src/pagination/ListFunctionsByCodeSigningConfigPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListFunctionsByCodeSigningConfigCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFunctionsByCodeSigningConfigCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFunctionsByCodeSigningConfig( +export const paginateListFunctionsByCodeSigningConfig: ( config: LambdaPaginationConfiguration, input: ListFunctionsByCodeSigningConfigCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFunctionsByCodeSigningConfigCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof LambdaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Lambda | LambdaClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListFunctionsByCodeSigningConfigCommandInput, + ListFunctionsByCodeSigningConfigCommandOutput +>(LambdaClient, ListFunctionsByCodeSigningConfigCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListFunctionsPaginator.ts b/clients/client-lambda/src/pagination/ListFunctionsPaginator.ts index c7fe58d52929..ead1ea818843 100644 --- a/clients/client-lambda/src/pagination/ListFunctionsPaginator.ts +++ b/clients/client-lambda/src/pagination/ListFunctionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListFunctionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFunctionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFunctions( +export const paginateListFunctions: ( config: LambdaPaginationConfiguration, input: ListFunctionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFunctionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof LambdaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Lambda | LambdaClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListFunctionsCommandInput, + ListFunctionsCommandOutput +>(LambdaClient, ListFunctionsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListLayerVersionsPaginator.ts b/clients/client-lambda/src/pagination/ListLayerVersionsPaginator.ts index 88fbca0b33cd..874f4eaf2b7f 100644 --- a/clients/client-lambda/src/pagination/ListLayerVersionsPaginator.ts +++ b/clients/client-lambda/src/pagination/ListLayerVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListLayerVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLayerVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLayerVersions( +export const paginateListLayerVersions: ( config: LambdaPaginationConfiguration, input: ListLayerVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLayerVersionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof LambdaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Lambda | LambdaClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListLayerVersionsCommandInput, + ListLayerVersionsCommandOutput +>(LambdaClient, ListLayerVersionsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListLayersPaginator.ts b/clients/client-lambda/src/pagination/ListLayersPaginator.ts index 9921b3978cf3..335efadfc3f8 100644 --- a/clients/client-lambda/src/pagination/ListLayersPaginator.ts +++ b/clients/client-lambda/src/pagination/ListLayersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListLayersCommand, ListLayersCommandInput, ListLayersCommandOutput } from "../commands/ListLayersCommand"; import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListLayersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLayersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLayers( +export const paginateListLayers: ( config: LambdaPaginationConfiguration, input: ListLayersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLayersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof LambdaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Lambda | LambdaClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListLayersCommandInput, + ListLayersCommandOutput +>(LambdaClient, ListLayersCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListProvisionedConcurrencyConfigsPaginator.ts b/clients/client-lambda/src/pagination/ListProvisionedConcurrencyConfigsPaginator.ts index 31b2c5ec7242..dd2a5ad6424d 100644 --- a/clients/client-lambda/src/pagination/ListProvisionedConcurrencyConfigsPaginator.ts +++ b/clients/client-lambda/src/pagination/ListProvisionedConcurrencyConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListProvisionedConcurrencyConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProvisionedConcurrencyConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProvisionedConcurrencyConfigs( +export const paginateListProvisionedConcurrencyConfigs: ( config: LambdaPaginationConfiguration, input: ListProvisionedConcurrencyConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProvisionedConcurrencyConfigsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof LambdaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Lambda | LambdaClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListProvisionedConcurrencyConfigsCommandInput, + ListProvisionedConcurrencyConfigsCommandOutput +>(LambdaClient, ListProvisionedConcurrencyConfigsCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-lambda/src/pagination/ListVersionsByFunctionPaginator.ts b/clients/client-lambda/src/pagination/ListVersionsByFunctionPaginator.ts index 473c1a434232..c029c78939af 100644 --- a/clients/client-lambda/src/pagination/ListVersionsByFunctionPaginator.ts +++ b/clients/client-lambda/src/pagination/ListVersionsByFunctionPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LambdaClient } from "../LambdaClient"; import { LambdaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LambdaClient, - input: ListVersionsByFunctionCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVersionsByFunctionCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVersionsByFunction( +export const paginateListVersionsByFunction: ( config: LambdaPaginationConfiguration, input: ListVersionsByFunctionCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVersionsByFunctionCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof LambdaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Lambda | LambdaClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LambdaPaginationConfiguration, + ListVersionsByFunctionCommandInput, + ListVersionsByFunctionCommandOutput +>(LambdaClient, ListVersionsByFunctionCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-launch-wizard/src/pagination/ListDeploymentEventsPaginator.ts b/clients/client-launch-wizard/src/pagination/ListDeploymentEventsPaginator.ts index c147faa4adf2..28029db66b09 100644 --- a/clients/client-launch-wizard/src/pagination/ListDeploymentEventsPaginator.ts +++ b/clients/client-launch-wizard/src/pagination/ListDeploymentEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LaunchWizardClient } from "../LaunchWizardClient"; import { LaunchWizardPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LaunchWizardClient, - input: ListDeploymentEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeploymentEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeploymentEvents( +export const paginateListDeploymentEvents: ( config: LaunchWizardPaginationConfiguration, input: ListDeploymentEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeploymentEventsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LaunchWizardClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LaunchWizard | LaunchWizardClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LaunchWizardPaginationConfiguration, + ListDeploymentEventsCommandInput, + ListDeploymentEventsCommandOutput +>(LaunchWizardClient, ListDeploymentEventsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-launch-wizard/src/pagination/ListDeploymentsPaginator.ts b/clients/client-launch-wizard/src/pagination/ListDeploymentsPaginator.ts index 7998d0c782f5..280b5529bd61 100644 --- a/clients/client-launch-wizard/src/pagination/ListDeploymentsPaginator.ts +++ b/clients/client-launch-wizard/src/pagination/ListDeploymentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LaunchWizardClient } from "../LaunchWizardClient"; import { LaunchWizardPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LaunchWizardClient, - input: ListDeploymentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeploymentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeployments( +export const paginateListDeployments: ( config: LaunchWizardPaginationConfiguration, input: ListDeploymentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeploymentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LaunchWizardClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LaunchWizard | LaunchWizardClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LaunchWizardPaginationConfiguration, + ListDeploymentsCommandInput, + ListDeploymentsCommandOutput +>(LaunchWizardClient, ListDeploymentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-launch-wizard/src/pagination/ListWorkloadDeploymentPatternsPaginator.ts b/clients/client-launch-wizard/src/pagination/ListWorkloadDeploymentPatternsPaginator.ts index 260cc8d9d423..0a0abc6befb0 100644 --- a/clients/client-launch-wizard/src/pagination/ListWorkloadDeploymentPatternsPaginator.ts +++ b/clients/client-launch-wizard/src/pagination/ListWorkloadDeploymentPatternsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LaunchWizardClient } from "../LaunchWizardClient"; import { LaunchWizardPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LaunchWizardClient, - input: ListWorkloadDeploymentPatternsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkloadDeploymentPatternsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkloadDeploymentPatterns( +export const paginateListWorkloadDeploymentPatterns: ( config: LaunchWizardPaginationConfiguration, input: ListWorkloadDeploymentPatternsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkloadDeploymentPatternsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LaunchWizardClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LaunchWizard | LaunchWizardClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LaunchWizardPaginationConfiguration, + ListWorkloadDeploymentPatternsCommandInput, + ListWorkloadDeploymentPatternsCommandOutput +>(LaunchWizardClient, ListWorkloadDeploymentPatternsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-launch-wizard/src/pagination/ListWorkloadsPaginator.ts b/clients/client-launch-wizard/src/pagination/ListWorkloadsPaginator.ts index e25d0ce57064..62c898eb83e8 100644 --- a/clients/client-launch-wizard/src/pagination/ListWorkloadsPaginator.ts +++ b/clients/client-launch-wizard/src/pagination/ListWorkloadsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LaunchWizardClient } from "../LaunchWizardClient"; import { LaunchWizardPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LaunchWizardClient, - input: ListWorkloadsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkloadsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkloads( +export const paginateListWorkloads: ( config: LaunchWizardPaginationConfiguration, input: ListWorkloadsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkloadsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LaunchWizardClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LaunchWizard | LaunchWizardClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LaunchWizardPaginationConfiguration, + ListWorkloadsCommandInput, + ListWorkloadsCommandOutput +>(LaunchWizardClient, ListWorkloadsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-model-building-service/src/pagination/GetBotAliasesPaginator.ts b/clients/client-lex-model-building-service/src/pagination/GetBotAliasesPaginator.ts index 74cb792d5a11..880d3bd287ce 100644 --- a/clients/client-lex-model-building-service/src/pagination/GetBotAliasesPaginator.ts +++ b/clients/client-lex-model-building-service/src/pagination/GetBotAliasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelBuildingServiceClient } from "../LexModelBuildingServiceClient"; import { LexModelBuildingServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelBuildingServiceClient, - input: GetBotAliasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetBotAliasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetBotAliases( +export const paginateGetBotAliases: ( config: LexModelBuildingServicePaginationConfiguration, input: GetBotAliasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetBotAliasesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelBuildingServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelBuildingService | LexModelBuildingServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelBuildingServicePaginationConfiguration, + GetBotAliasesCommandInput, + GetBotAliasesCommandOutput +>(LexModelBuildingServiceClient, GetBotAliasesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-model-building-service/src/pagination/GetBotChannelAssociationsPaginator.ts b/clients/client-lex-model-building-service/src/pagination/GetBotChannelAssociationsPaginator.ts index 0d9a1ba85288..0a2d040ed7e0 100644 --- a/clients/client-lex-model-building-service/src/pagination/GetBotChannelAssociationsPaginator.ts +++ b/clients/client-lex-model-building-service/src/pagination/GetBotChannelAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelBuildingServiceClient } from "../LexModelBuildingServiceClient"; import { LexModelBuildingServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelBuildingServiceClient, - input: GetBotChannelAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetBotChannelAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetBotChannelAssociations( +export const paginateGetBotChannelAssociations: ( config: LexModelBuildingServicePaginationConfiguration, input: GetBotChannelAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetBotChannelAssociationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelBuildingServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelBuildingService | LexModelBuildingServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelBuildingServicePaginationConfiguration, + GetBotChannelAssociationsCommandInput, + GetBotChannelAssociationsCommandOutput +>(LexModelBuildingServiceClient, GetBotChannelAssociationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-model-building-service/src/pagination/GetBotVersionsPaginator.ts b/clients/client-lex-model-building-service/src/pagination/GetBotVersionsPaginator.ts index 4074fe62f2a8..1fdac0cb956b 100644 --- a/clients/client-lex-model-building-service/src/pagination/GetBotVersionsPaginator.ts +++ b/clients/client-lex-model-building-service/src/pagination/GetBotVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelBuildingServiceClient } from "../LexModelBuildingServiceClient"; import { LexModelBuildingServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelBuildingServiceClient, - input: GetBotVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetBotVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetBotVersions( +export const paginateGetBotVersions: ( config: LexModelBuildingServicePaginationConfiguration, input: GetBotVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetBotVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelBuildingServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelBuildingService | LexModelBuildingServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelBuildingServicePaginationConfiguration, + GetBotVersionsCommandInput, + GetBotVersionsCommandOutput +>(LexModelBuildingServiceClient, GetBotVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-model-building-service/src/pagination/GetBotsPaginator.ts b/clients/client-lex-model-building-service/src/pagination/GetBotsPaginator.ts index 845e0b9679e4..2a966280442e 100644 --- a/clients/client-lex-model-building-service/src/pagination/GetBotsPaginator.ts +++ b/clients/client-lex-model-building-service/src/pagination/GetBotsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetBotsCommand, GetBotsCommandInput, GetBotsCommandOutput } from "../commands/GetBotsCommand"; import { LexModelBuildingServiceClient } from "../LexModelBuildingServiceClient"; import { LexModelBuildingServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelBuildingServiceClient, - input: GetBotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetBotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetBots( +export const paginateGetBots: ( config: LexModelBuildingServicePaginationConfiguration, input: GetBotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetBotsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelBuildingServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelBuildingService | LexModelBuildingServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelBuildingServicePaginationConfiguration, + GetBotsCommandInput, + GetBotsCommandOutput +>(LexModelBuildingServiceClient, GetBotsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-model-building-service/src/pagination/GetBuiltinIntentsPaginator.ts b/clients/client-lex-model-building-service/src/pagination/GetBuiltinIntentsPaginator.ts index cbd9549867e9..c20b5ffdf7ca 100644 --- a/clients/client-lex-model-building-service/src/pagination/GetBuiltinIntentsPaginator.ts +++ b/clients/client-lex-model-building-service/src/pagination/GetBuiltinIntentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelBuildingServiceClient } from "../LexModelBuildingServiceClient"; import { LexModelBuildingServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelBuildingServiceClient, - input: GetBuiltinIntentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetBuiltinIntentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetBuiltinIntents( +export const paginateGetBuiltinIntents: ( config: LexModelBuildingServicePaginationConfiguration, input: GetBuiltinIntentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetBuiltinIntentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelBuildingServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelBuildingService | LexModelBuildingServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelBuildingServicePaginationConfiguration, + GetBuiltinIntentsCommandInput, + GetBuiltinIntentsCommandOutput +>(LexModelBuildingServiceClient, GetBuiltinIntentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-model-building-service/src/pagination/GetBuiltinSlotTypesPaginator.ts b/clients/client-lex-model-building-service/src/pagination/GetBuiltinSlotTypesPaginator.ts index 658d24ed2be9..7693e63d2ce8 100644 --- a/clients/client-lex-model-building-service/src/pagination/GetBuiltinSlotTypesPaginator.ts +++ b/clients/client-lex-model-building-service/src/pagination/GetBuiltinSlotTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelBuildingServiceClient } from "../LexModelBuildingServiceClient"; import { LexModelBuildingServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelBuildingServiceClient, - input: GetBuiltinSlotTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetBuiltinSlotTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetBuiltinSlotTypes( +export const paginateGetBuiltinSlotTypes: ( config: LexModelBuildingServicePaginationConfiguration, input: GetBuiltinSlotTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetBuiltinSlotTypesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelBuildingServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelBuildingService | LexModelBuildingServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelBuildingServicePaginationConfiguration, + GetBuiltinSlotTypesCommandInput, + GetBuiltinSlotTypesCommandOutput +>(LexModelBuildingServiceClient, GetBuiltinSlotTypesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-model-building-service/src/pagination/GetIntentVersionsPaginator.ts b/clients/client-lex-model-building-service/src/pagination/GetIntentVersionsPaginator.ts index 6d87bf8e83c7..ab106abeebf1 100644 --- a/clients/client-lex-model-building-service/src/pagination/GetIntentVersionsPaginator.ts +++ b/clients/client-lex-model-building-service/src/pagination/GetIntentVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelBuildingServiceClient } from "../LexModelBuildingServiceClient"; import { LexModelBuildingServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelBuildingServiceClient, - input: GetIntentVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetIntentVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetIntentVersions( +export const paginateGetIntentVersions: ( config: LexModelBuildingServicePaginationConfiguration, input: GetIntentVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetIntentVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelBuildingServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelBuildingService | LexModelBuildingServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelBuildingServicePaginationConfiguration, + GetIntentVersionsCommandInput, + GetIntentVersionsCommandOutput +>(LexModelBuildingServiceClient, GetIntentVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-model-building-service/src/pagination/GetIntentsPaginator.ts b/clients/client-lex-model-building-service/src/pagination/GetIntentsPaginator.ts index 14eb20c0b4eb..5778eccfb690 100644 --- a/clients/client-lex-model-building-service/src/pagination/GetIntentsPaginator.ts +++ b/clients/client-lex-model-building-service/src/pagination/GetIntentsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetIntentsCommand, GetIntentsCommandInput, GetIntentsCommandOutput } from "../commands/GetIntentsCommand"; import { LexModelBuildingServiceClient } from "../LexModelBuildingServiceClient"; import { LexModelBuildingServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelBuildingServiceClient, - input: GetIntentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetIntentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetIntents( +export const paginateGetIntents: ( config: LexModelBuildingServicePaginationConfiguration, input: GetIntentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetIntentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelBuildingServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelBuildingService | LexModelBuildingServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelBuildingServicePaginationConfiguration, + GetIntentsCommandInput, + GetIntentsCommandOutput +>(LexModelBuildingServiceClient, GetIntentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-model-building-service/src/pagination/GetMigrationsPaginator.ts b/clients/client-lex-model-building-service/src/pagination/GetMigrationsPaginator.ts index 31feeeccdb1c..0929400e04c4 100644 --- a/clients/client-lex-model-building-service/src/pagination/GetMigrationsPaginator.ts +++ b/clients/client-lex-model-building-service/src/pagination/GetMigrationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelBuildingServiceClient } from "../LexModelBuildingServiceClient"; import { LexModelBuildingServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelBuildingServiceClient, - input: GetMigrationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetMigrationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetMigrations( +export const paginateGetMigrations: ( config: LexModelBuildingServicePaginationConfiguration, input: GetMigrationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetMigrationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelBuildingServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelBuildingService | LexModelBuildingServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelBuildingServicePaginationConfiguration, + GetMigrationsCommandInput, + GetMigrationsCommandOutput +>(LexModelBuildingServiceClient, GetMigrationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-model-building-service/src/pagination/GetSlotTypeVersionsPaginator.ts b/clients/client-lex-model-building-service/src/pagination/GetSlotTypeVersionsPaginator.ts index 83c4d3779296..aba1df4ace62 100644 --- a/clients/client-lex-model-building-service/src/pagination/GetSlotTypeVersionsPaginator.ts +++ b/clients/client-lex-model-building-service/src/pagination/GetSlotTypeVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelBuildingServiceClient } from "../LexModelBuildingServiceClient"; import { LexModelBuildingServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelBuildingServiceClient, - input: GetSlotTypeVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetSlotTypeVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetSlotTypeVersions( +export const paginateGetSlotTypeVersions: ( config: LexModelBuildingServicePaginationConfiguration, input: GetSlotTypeVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetSlotTypeVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelBuildingServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelBuildingService | LexModelBuildingServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelBuildingServicePaginationConfiguration, + GetSlotTypeVersionsCommandInput, + GetSlotTypeVersionsCommandOutput +>(LexModelBuildingServiceClient, GetSlotTypeVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-model-building-service/src/pagination/GetSlotTypesPaginator.ts b/clients/client-lex-model-building-service/src/pagination/GetSlotTypesPaginator.ts index beb3193cd963..74830737a5c6 100644 --- a/clients/client-lex-model-building-service/src/pagination/GetSlotTypesPaginator.ts +++ b/clients/client-lex-model-building-service/src/pagination/GetSlotTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelBuildingServiceClient } from "../LexModelBuildingServiceClient"; import { LexModelBuildingServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelBuildingServiceClient, - input: GetSlotTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetSlotTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetSlotTypes( +export const paginateGetSlotTypes: ( config: LexModelBuildingServicePaginationConfiguration, input: GetSlotTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetSlotTypesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelBuildingServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelBuildingService | LexModelBuildingServiceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelBuildingServicePaginationConfiguration, + GetSlotTypesCommandInput, + GetSlotTypesCommandOutput +>(LexModelBuildingServiceClient, GetSlotTypesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListAggregatedUtterancesPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListAggregatedUtterancesPaginator.ts index 0eecbfe9a0d5..99e8cf7c7372 100644 --- a/clients/client-lex-models-v2/src/pagination/ListAggregatedUtterancesPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListAggregatedUtterancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListAggregatedUtterancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAggregatedUtterancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAggregatedUtterances( +export const paginateListAggregatedUtterances: ( config: LexModelsV2PaginationConfiguration, input: ListAggregatedUtterancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAggregatedUtterancesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListAggregatedUtterancesCommandInput, + ListAggregatedUtterancesCommandOutput +>(LexModelsV2Client, ListAggregatedUtterancesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListBotAliasesPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListBotAliasesPaginator.ts index 3e31dfa83389..50ff18986dee 100644 --- a/clients/client-lex-models-v2/src/pagination/ListBotAliasesPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListBotAliasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListBotAliasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBotAliasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBotAliases( +export const paginateListBotAliases: ( config: LexModelsV2PaginationConfiguration, input: ListBotAliasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBotAliasesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListBotAliasesCommandInput, + ListBotAliasesCommandOutput +>(LexModelsV2Client, ListBotAliasesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListBotLocalesPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListBotLocalesPaginator.ts index f3661c7a77d8..b950cecc3611 100644 --- a/clients/client-lex-models-v2/src/pagination/ListBotLocalesPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListBotLocalesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListBotLocalesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBotLocalesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBotLocales( +export const paginateListBotLocales: ( config: LexModelsV2PaginationConfiguration, input: ListBotLocalesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBotLocalesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListBotLocalesCommandInput, + ListBotLocalesCommandOutput +>(LexModelsV2Client, ListBotLocalesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListBotRecommendationsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListBotRecommendationsPaginator.ts index e457e476d50c..4e7d2ce7f979 100644 --- a/clients/client-lex-models-v2/src/pagination/ListBotRecommendationsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListBotRecommendationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListBotRecommendationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBotRecommendationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBotRecommendations( +export const paginateListBotRecommendations: ( config: LexModelsV2PaginationConfiguration, input: ListBotRecommendationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBotRecommendationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListBotRecommendationsCommandInput, + ListBotRecommendationsCommandOutput +>(LexModelsV2Client, ListBotRecommendationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListBotResourceGenerationsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListBotResourceGenerationsPaginator.ts index 6156def3cdf8..d428699d80d3 100644 --- a/clients/client-lex-models-v2/src/pagination/ListBotResourceGenerationsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListBotResourceGenerationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListBotResourceGenerationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBotResourceGenerationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBotResourceGenerations( +export const paginateListBotResourceGenerations: ( config: LexModelsV2PaginationConfiguration, input: ListBotResourceGenerationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBotResourceGenerationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListBotResourceGenerationsCommandInput, + ListBotResourceGenerationsCommandOutput +>(LexModelsV2Client, ListBotResourceGenerationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListBotVersionsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListBotVersionsPaginator.ts index 7b03365dcb1d..e2a7ce1a38bf 100644 --- a/clients/client-lex-models-v2/src/pagination/ListBotVersionsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListBotVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListBotVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBotVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBotVersions( +export const paginateListBotVersions: ( config: LexModelsV2PaginationConfiguration, input: ListBotVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBotVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListBotVersionsCommandInput, + ListBotVersionsCommandOutput +>(LexModelsV2Client, ListBotVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListBotsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListBotsPaginator.ts index fabe0be0a6a0..a9c6d4c32b67 100644 --- a/clients/client-lex-models-v2/src/pagination/ListBotsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListBotsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListBotsCommand, ListBotsCommandInput, ListBotsCommandOutput } from "../commands/ListBotsCommand"; import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListBotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBots( +export const paginateListBots: ( config: LexModelsV2PaginationConfiguration, input: ListBotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBotsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListBotsCommandInput, + ListBotsCommandOutput +>(LexModelsV2Client, ListBotsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListBuiltInIntentsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListBuiltInIntentsPaginator.ts index e462aac099d5..862186d89aa2 100644 --- a/clients/client-lex-models-v2/src/pagination/ListBuiltInIntentsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListBuiltInIntentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListBuiltInIntentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBuiltInIntentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBuiltInIntents( +export const paginateListBuiltInIntents: ( config: LexModelsV2PaginationConfiguration, input: ListBuiltInIntentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBuiltInIntentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListBuiltInIntentsCommandInput, + ListBuiltInIntentsCommandOutput +>(LexModelsV2Client, ListBuiltInIntentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListBuiltInSlotTypesPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListBuiltInSlotTypesPaginator.ts index 267b37dbec7b..19b3c14158e4 100644 --- a/clients/client-lex-models-v2/src/pagination/ListBuiltInSlotTypesPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListBuiltInSlotTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListBuiltInSlotTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBuiltInSlotTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBuiltInSlotTypes( +export const paginateListBuiltInSlotTypes: ( config: LexModelsV2PaginationConfiguration, input: ListBuiltInSlotTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBuiltInSlotTypesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListBuiltInSlotTypesCommandInput, + ListBuiltInSlotTypesCommandOutput +>(LexModelsV2Client, ListBuiltInSlotTypesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListCustomVocabularyItemsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListCustomVocabularyItemsPaginator.ts index 00ddb34ffa31..68214f47cc12 100644 --- a/clients/client-lex-models-v2/src/pagination/ListCustomVocabularyItemsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListCustomVocabularyItemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListCustomVocabularyItemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomVocabularyItemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomVocabularyItems( +export const paginateListCustomVocabularyItems: ( config: LexModelsV2PaginationConfiguration, input: ListCustomVocabularyItemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomVocabularyItemsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListCustomVocabularyItemsCommandInput, + ListCustomVocabularyItemsCommandOutput +>(LexModelsV2Client, ListCustomVocabularyItemsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListExportsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListExportsPaginator.ts index b66dfa52ec76..576894621591 100644 --- a/clients/client-lex-models-v2/src/pagination/ListExportsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListExportsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListExportsCommand, ListExportsCommandInput, ListExportsCommandOutput } from "../commands/ListExportsCommand"; import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListExportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExports( +export const paginateListExports: ( config: LexModelsV2PaginationConfiguration, input: ListExportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExportsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListExportsCommandInput, + ListExportsCommandOutput +>(LexModelsV2Client, ListExportsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListImportsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListImportsPaginator.ts index 9cb133ea754e..bd7e24370db4 100644 --- a/clients/client-lex-models-v2/src/pagination/ListImportsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListImportsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListImportsCommand, ListImportsCommandInput, ListImportsCommandOutput } from "../commands/ListImportsCommand"; import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListImportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImports( +export const paginateListImports: ( config: LexModelsV2PaginationConfiguration, input: ListImportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImportsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListImportsCommandInput, + ListImportsCommandOutput +>(LexModelsV2Client, ListImportsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListIntentMetricsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListIntentMetricsPaginator.ts index b8f737474e09..c0cfbd4c2e37 100644 --- a/clients/client-lex-models-v2/src/pagination/ListIntentMetricsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListIntentMetricsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListIntentMetricsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIntentMetricsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIntentMetrics( +export const paginateListIntentMetrics: ( config: LexModelsV2PaginationConfiguration, input: ListIntentMetricsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIntentMetricsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListIntentMetricsCommandInput, + ListIntentMetricsCommandOutput +>(LexModelsV2Client, ListIntentMetricsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListIntentStageMetricsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListIntentStageMetricsPaginator.ts index 8674e2d4feeb..108e2db3f7de 100644 --- a/clients/client-lex-models-v2/src/pagination/ListIntentStageMetricsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListIntentStageMetricsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListIntentStageMetricsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIntentStageMetricsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIntentStageMetrics( +export const paginateListIntentStageMetrics: ( config: LexModelsV2PaginationConfiguration, input: ListIntentStageMetricsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIntentStageMetricsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListIntentStageMetricsCommandInput, + ListIntentStageMetricsCommandOutput +>(LexModelsV2Client, ListIntentStageMetricsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListIntentsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListIntentsPaginator.ts index 7479963f463a..d5db0b66389f 100644 --- a/clients/client-lex-models-v2/src/pagination/ListIntentsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListIntentsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListIntentsCommand, ListIntentsCommandInput, ListIntentsCommandOutput } from "../commands/ListIntentsCommand"; import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListIntentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIntentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIntents( +export const paginateListIntents: ( config: LexModelsV2PaginationConfiguration, input: ListIntentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIntentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListIntentsCommandInput, + ListIntentsCommandOutput +>(LexModelsV2Client, ListIntentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListRecommendedIntentsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListRecommendedIntentsPaginator.ts index 739aa330b795..34aa5309748e 100644 --- a/clients/client-lex-models-v2/src/pagination/ListRecommendedIntentsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListRecommendedIntentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListRecommendedIntentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecommendedIntentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecommendedIntents( +export const paginateListRecommendedIntents: ( config: LexModelsV2PaginationConfiguration, input: ListRecommendedIntentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecommendedIntentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListRecommendedIntentsCommandInput, + ListRecommendedIntentsCommandOutput +>(LexModelsV2Client, ListRecommendedIntentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListSessionAnalyticsDataPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListSessionAnalyticsDataPaginator.ts index 7433a146bdd9..f0e1a81737a7 100644 --- a/clients/client-lex-models-v2/src/pagination/ListSessionAnalyticsDataPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListSessionAnalyticsDataPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListSessionAnalyticsDataCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSessionAnalyticsDataCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSessionAnalyticsData( +export const paginateListSessionAnalyticsData: ( config: LexModelsV2PaginationConfiguration, input: ListSessionAnalyticsDataCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSessionAnalyticsDataCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListSessionAnalyticsDataCommandInput, + ListSessionAnalyticsDataCommandOutput +>(LexModelsV2Client, ListSessionAnalyticsDataCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListSessionMetricsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListSessionMetricsPaginator.ts index fffcfe4c556c..eadb49d78bc7 100644 --- a/clients/client-lex-models-v2/src/pagination/ListSessionMetricsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListSessionMetricsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListSessionMetricsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSessionMetricsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSessionMetrics( +export const paginateListSessionMetrics: ( config: LexModelsV2PaginationConfiguration, input: ListSessionMetricsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSessionMetricsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListSessionMetricsCommandInput, + ListSessionMetricsCommandOutput +>(LexModelsV2Client, ListSessionMetricsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListSlotTypesPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListSlotTypesPaginator.ts index b7e66f782025..667b8cfe51c9 100644 --- a/clients/client-lex-models-v2/src/pagination/ListSlotTypesPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListSlotTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListSlotTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSlotTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSlotTypes( +export const paginateListSlotTypes: ( config: LexModelsV2PaginationConfiguration, input: ListSlotTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSlotTypesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListSlotTypesCommandInput, + ListSlotTypesCommandOutput +>(LexModelsV2Client, ListSlotTypesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListSlotsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListSlotsPaginator.ts index 51182416e6bc..9b321166e28d 100644 --- a/clients/client-lex-models-v2/src/pagination/ListSlotsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListSlotsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListSlotsCommand, ListSlotsCommandInput, ListSlotsCommandOutput } from "../commands/ListSlotsCommand"; import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListSlotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSlotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSlots( +export const paginateListSlots: ( config: LexModelsV2PaginationConfiguration, input: ListSlotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSlotsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListSlotsCommandInput, + ListSlotsCommandOutput +>(LexModelsV2Client, ListSlotsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListTestExecutionResultItemsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListTestExecutionResultItemsPaginator.ts index fe786ab25054..5e70e1dd46c0 100644 --- a/clients/client-lex-models-v2/src/pagination/ListTestExecutionResultItemsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListTestExecutionResultItemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListTestExecutionResultItemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTestExecutionResultItemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTestExecutionResultItems( +export const paginateListTestExecutionResultItems: ( config: LexModelsV2PaginationConfiguration, input: ListTestExecutionResultItemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTestExecutionResultItemsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListTestExecutionResultItemsCommandInput, + ListTestExecutionResultItemsCommandOutput +>(LexModelsV2Client, ListTestExecutionResultItemsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListTestExecutionsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListTestExecutionsPaginator.ts index 200331f62ab1..f0289a4274c0 100644 --- a/clients/client-lex-models-v2/src/pagination/ListTestExecutionsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListTestExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListTestExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTestExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTestExecutions( +export const paginateListTestExecutions: ( config: LexModelsV2PaginationConfiguration, input: ListTestExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTestExecutionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListTestExecutionsCommandInput, + ListTestExecutionsCommandOutput +>(LexModelsV2Client, ListTestExecutionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListTestSetRecordsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListTestSetRecordsPaginator.ts index 833cc6bcb9d5..9e44947c2a18 100644 --- a/clients/client-lex-models-v2/src/pagination/ListTestSetRecordsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListTestSetRecordsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListTestSetRecordsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTestSetRecordsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTestSetRecords( +export const paginateListTestSetRecords: ( config: LexModelsV2PaginationConfiguration, input: ListTestSetRecordsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTestSetRecordsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListTestSetRecordsCommandInput, + ListTestSetRecordsCommandOutput +>(LexModelsV2Client, ListTestSetRecordsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListTestSetsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListTestSetsPaginator.ts index 9f1bfc5ad508..2ed339f05bdc 100644 --- a/clients/client-lex-models-v2/src/pagination/ListTestSetsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListTestSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListTestSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTestSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTestSets( +export const paginateListTestSets: ( config: LexModelsV2PaginationConfiguration, input: ListTestSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTestSetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListTestSetsCommandInput, + ListTestSetsCommandOutput +>(LexModelsV2Client, ListTestSetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListUtteranceAnalyticsDataPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListUtteranceAnalyticsDataPaginator.ts index 4fcee059bec4..7acb8b2b7b1f 100644 --- a/clients/client-lex-models-v2/src/pagination/ListUtteranceAnalyticsDataPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListUtteranceAnalyticsDataPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListUtteranceAnalyticsDataCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUtteranceAnalyticsDataCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUtteranceAnalyticsData( +export const paginateListUtteranceAnalyticsData: ( config: LexModelsV2PaginationConfiguration, input: ListUtteranceAnalyticsDataCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUtteranceAnalyticsDataCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListUtteranceAnalyticsDataCommandInput, + ListUtteranceAnalyticsDataCommandOutput +>(LexModelsV2Client, ListUtteranceAnalyticsDataCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-lex-models-v2/src/pagination/ListUtteranceMetricsPaginator.ts b/clients/client-lex-models-v2/src/pagination/ListUtteranceMetricsPaginator.ts index 63496fff831f..ea4334bf4c88 100644 --- a/clients/client-lex-models-v2/src/pagination/ListUtteranceMetricsPaginator.ts +++ b/clients/client-lex-models-v2/src/pagination/ListUtteranceMetricsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LexModelsV2Client } from "../LexModelsV2Client"; import { LexModelsV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LexModelsV2Client, - input: ListUtteranceMetricsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUtteranceMetricsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUtteranceMetrics( +export const paginateListUtteranceMetrics: ( config: LexModelsV2PaginationConfiguration, input: ListUtteranceMetricsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUtteranceMetricsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof LexModelsV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LexModelsV2 | LexModelsV2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LexModelsV2PaginationConfiguration, + ListUtteranceMetricsCommandInput, + ListUtteranceMetricsCommandOutput +>(LexModelsV2Client, ListUtteranceMetricsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-license-manager-linux-subscriptions/src/pagination/ListLinuxSubscriptionInstancesPaginator.ts b/clients/client-license-manager-linux-subscriptions/src/pagination/ListLinuxSubscriptionInstancesPaginator.ts index af3345f2c33e..5638336ee79f 100644 --- a/clients/client-license-manager-linux-subscriptions/src/pagination/ListLinuxSubscriptionInstancesPaginator.ts +++ b/clients/client-license-manager-linux-subscriptions/src/pagination/ListLinuxSubscriptionInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,44 +10,21 @@ import { import { LicenseManagerLinuxSubscriptionsClient } from "../LicenseManagerLinuxSubscriptionsClient"; import { LicenseManagerLinuxSubscriptionsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LicenseManagerLinuxSubscriptionsClient, - input: ListLinuxSubscriptionInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLinuxSubscriptionInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLinuxSubscriptionInstances( +export const paginateListLinuxSubscriptionInstances: ( config: LicenseManagerLinuxSubscriptionsPaginationConfiguration, input: ListLinuxSubscriptionInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLinuxSubscriptionInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LicenseManagerLinuxSubscriptionsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error( - "Invalid client, expected LicenseManagerLinuxSubscriptions | LicenseManagerLinuxSubscriptionsClient" - ); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LicenseManagerLinuxSubscriptionsPaginationConfiguration, + ListLinuxSubscriptionInstancesCommandInput, + ListLinuxSubscriptionInstancesCommandOutput +>( + LicenseManagerLinuxSubscriptionsClient, + ListLinuxSubscriptionInstancesCommand, + "NextToken", + "NextToken", + "MaxResults" +); diff --git a/clients/client-license-manager-linux-subscriptions/src/pagination/ListLinuxSubscriptionsPaginator.ts b/clients/client-license-manager-linux-subscriptions/src/pagination/ListLinuxSubscriptionsPaginator.ts index 94f59f3c589a..1378ff0db4ce 100644 --- a/clients/client-license-manager-linux-subscriptions/src/pagination/ListLinuxSubscriptionsPaginator.ts +++ b/clients/client-license-manager-linux-subscriptions/src/pagination/ListLinuxSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,44 +10,15 @@ import { import { LicenseManagerLinuxSubscriptionsClient } from "../LicenseManagerLinuxSubscriptionsClient"; import { LicenseManagerLinuxSubscriptionsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LicenseManagerLinuxSubscriptionsClient, - input: ListLinuxSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLinuxSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLinuxSubscriptions( +export const paginateListLinuxSubscriptions: ( config: LicenseManagerLinuxSubscriptionsPaginationConfiguration, input: ListLinuxSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLinuxSubscriptionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LicenseManagerLinuxSubscriptionsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error( - "Invalid client, expected LicenseManagerLinuxSubscriptions | LicenseManagerLinuxSubscriptionsClient" - ); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LicenseManagerLinuxSubscriptionsPaginationConfiguration, + ListLinuxSubscriptionsCommandInput, + ListLinuxSubscriptionsCommandOutput +>(LicenseManagerLinuxSubscriptionsClient, ListLinuxSubscriptionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-license-manager-user-subscriptions/src/pagination/ListIdentityProvidersPaginator.ts b/clients/client-license-manager-user-subscriptions/src/pagination/ListIdentityProvidersPaginator.ts index aa0a7cdc81f8..3439dace3609 100644 --- a/clients/client-license-manager-user-subscriptions/src/pagination/ListIdentityProvidersPaginator.ts +++ b/clients/client-license-manager-user-subscriptions/src/pagination/ListIdentityProvidersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,44 +10,15 @@ import { import { LicenseManagerUserSubscriptionsClient } from "../LicenseManagerUserSubscriptionsClient"; import { LicenseManagerUserSubscriptionsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LicenseManagerUserSubscriptionsClient, - input: ListIdentityProvidersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIdentityProvidersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIdentityProviders( +export const paginateListIdentityProviders: ( config: LicenseManagerUserSubscriptionsPaginationConfiguration, input: ListIdentityProvidersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIdentityProvidersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LicenseManagerUserSubscriptionsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error( - "Invalid client, expected LicenseManagerUserSubscriptions | LicenseManagerUserSubscriptionsClient" - ); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LicenseManagerUserSubscriptionsPaginationConfiguration, + ListIdentityProvidersCommandInput, + ListIdentityProvidersCommandOutput +>(LicenseManagerUserSubscriptionsClient, ListIdentityProvidersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-license-manager-user-subscriptions/src/pagination/ListInstancesPaginator.ts b/clients/client-license-manager-user-subscriptions/src/pagination/ListInstancesPaginator.ts index adb8f1c52d1c..774816650a81 100644 --- a/clients/client-license-manager-user-subscriptions/src/pagination/ListInstancesPaginator.ts +++ b/clients/client-license-manager-user-subscriptions/src/pagination/ListInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,44 +10,15 @@ import { import { LicenseManagerUserSubscriptionsClient } from "../LicenseManagerUserSubscriptionsClient"; import { LicenseManagerUserSubscriptionsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LicenseManagerUserSubscriptionsClient, - input: ListInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInstances( +export const paginateListInstances: ( config: LicenseManagerUserSubscriptionsPaginationConfiguration, input: ListInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LicenseManagerUserSubscriptionsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error( - "Invalid client, expected LicenseManagerUserSubscriptions | LicenseManagerUserSubscriptionsClient" - ); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LicenseManagerUserSubscriptionsPaginationConfiguration, + ListInstancesCommandInput, + ListInstancesCommandOutput +>(LicenseManagerUserSubscriptionsClient, ListInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-license-manager-user-subscriptions/src/pagination/ListProductSubscriptionsPaginator.ts b/clients/client-license-manager-user-subscriptions/src/pagination/ListProductSubscriptionsPaginator.ts index c94c4372b2f2..108136189418 100644 --- a/clients/client-license-manager-user-subscriptions/src/pagination/ListProductSubscriptionsPaginator.ts +++ b/clients/client-license-manager-user-subscriptions/src/pagination/ListProductSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,44 +10,15 @@ import { import { LicenseManagerUserSubscriptionsClient } from "../LicenseManagerUserSubscriptionsClient"; import { LicenseManagerUserSubscriptionsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LicenseManagerUserSubscriptionsClient, - input: ListProductSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProductSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProductSubscriptions( +export const paginateListProductSubscriptions: ( config: LicenseManagerUserSubscriptionsPaginationConfiguration, input: ListProductSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProductSubscriptionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LicenseManagerUserSubscriptionsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error( - "Invalid client, expected LicenseManagerUserSubscriptions | LicenseManagerUserSubscriptionsClient" - ); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LicenseManagerUserSubscriptionsPaginationConfiguration, + ListProductSubscriptionsCommandInput, + ListProductSubscriptionsCommandOutput +>(LicenseManagerUserSubscriptionsClient, ListProductSubscriptionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-license-manager-user-subscriptions/src/pagination/ListUserAssociationsPaginator.ts b/clients/client-license-manager-user-subscriptions/src/pagination/ListUserAssociationsPaginator.ts index 81c38805e398..1233f93689d8 100644 --- a/clients/client-license-manager-user-subscriptions/src/pagination/ListUserAssociationsPaginator.ts +++ b/clients/client-license-manager-user-subscriptions/src/pagination/ListUserAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,44 +10,15 @@ import { import { LicenseManagerUserSubscriptionsClient } from "../LicenseManagerUserSubscriptionsClient"; import { LicenseManagerUserSubscriptionsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LicenseManagerUserSubscriptionsClient, - input: ListUserAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUserAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUserAssociations( +export const paginateListUserAssociations: ( config: LicenseManagerUserSubscriptionsPaginationConfiguration, input: ListUserAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUserAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LicenseManagerUserSubscriptionsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error( - "Invalid client, expected LicenseManagerUserSubscriptions | LicenseManagerUserSubscriptionsClient" - ); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LicenseManagerUserSubscriptionsPaginationConfiguration, + ListUserAssociationsCommandInput, + ListUserAssociationsCommandOutput +>(LicenseManagerUserSubscriptionsClient, ListUserAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-location/src/pagination/GetDevicePositionHistoryPaginator.ts b/clients/client-location/src/pagination/GetDevicePositionHistoryPaginator.ts index c9eb3f42724a..1e75834cbc36 100644 --- a/clients/client-location/src/pagination/GetDevicePositionHistoryPaginator.ts +++ b/clients/client-location/src/pagination/GetDevicePositionHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LocationClient } from "../LocationClient"; import { LocationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LocationClient, - input: GetDevicePositionHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetDevicePositionHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetDevicePositionHistory( +export const paginateGetDevicePositionHistory: ( config: LocationPaginationConfiguration, input: GetDevicePositionHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetDevicePositionHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LocationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Location | LocationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LocationPaginationConfiguration, + GetDevicePositionHistoryCommandInput, + GetDevicePositionHistoryCommandOutput +>(LocationClient, GetDevicePositionHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-location/src/pagination/ListDevicePositionsPaginator.ts b/clients/client-location/src/pagination/ListDevicePositionsPaginator.ts index 8f29912a656a..e50c3e6f3a77 100644 --- a/clients/client-location/src/pagination/ListDevicePositionsPaginator.ts +++ b/clients/client-location/src/pagination/ListDevicePositionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LocationClient } from "../LocationClient"; import { LocationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LocationClient, - input: ListDevicePositionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDevicePositionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDevicePositions( +export const paginateListDevicePositions: ( config: LocationPaginationConfiguration, input: ListDevicePositionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDevicePositionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LocationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Location | LocationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LocationPaginationConfiguration, + ListDevicePositionsCommandInput, + ListDevicePositionsCommandOutput +>(LocationClient, ListDevicePositionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-location/src/pagination/ListGeofenceCollectionsPaginator.ts b/clients/client-location/src/pagination/ListGeofenceCollectionsPaginator.ts index a23675f5033b..a1e98233ffbb 100644 --- a/clients/client-location/src/pagination/ListGeofenceCollectionsPaginator.ts +++ b/clients/client-location/src/pagination/ListGeofenceCollectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LocationClient } from "../LocationClient"; import { LocationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LocationClient, - input: ListGeofenceCollectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGeofenceCollectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGeofenceCollections( +export const paginateListGeofenceCollections: ( config: LocationPaginationConfiguration, input: ListGeofenceCollectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGeofenceCollectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LocationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Location | LocationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LocationPaginationConfiguration, + ListGeofenceCollectionsCommandInput, + ListGeofenceCollectionsCommandOutput +>(LocationClient, ListGeofenceCollectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-location/src/pagination/ListGeofencesPaginator.ts b/clients/client-location/src/pagination/ListGeofencesPaginator.ts index cc3bc99f7b6a..87c774d4f9c1 100644 --- a/clients/client-location/src/pagination/ListGeofencesPaginator.ts +++ b/clients/client-location/src/pagination/ListGeofencesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LocationClient } from "../LocationClient"; import { LocationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LocationClient, - input: ListGeofencesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGeofencesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGeofences( +export const paginateListGeofences: ( config: LocationPaginationConfiguration, input: ListGeofencesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGeofencesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LocationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Location | LocationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LocationPaginationConfiguration, + ListGeofencesCommandInput, + ListGeofencesCommandOutput +>(LocationClient, ListGeofencesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-location/src/pagination/ListKeysPaginator.ts b/clients/client-location/src/pagination/ListKeysPaginator.ts index eb79985cbbd8..7f7e57fd494f 100644 --- a/clients/client-location/src/pagination/ListKeysPaginator.ts +++ b/clients/client-location/src/pagination/ListKeysPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListKeysCommand, ListKeysCommandInput, ListKeysCommandOutput } from "../commands/ListKeysCommand"; import { LocationClient } from "../LocationClient"; import { LocationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LocationClient, - input: ListKeysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKeysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKeys( +export const paginateListKeys: ( config: LocationPaginationConfiguration, input: ListKeysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKeysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LocationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Location | LocationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LocationPaginationConfiguration, + ListKeysCommandInput, + ListKeysCommandOutput +>(LocationClient, ListKeysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-location/src/pagination/ListMapsPaginator.ts b/clients/client-location/src/pagination/ListMapsPaginator.ts index 00bf10e9c2ce..3211d2695eea 100644 --- a/clients/client-location/src/pagination/ListMapsPaginator.ts +++ b/clients/client-location/src/pagination/ListMapsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListMapsCommand, ListMapsCommandInput, ListMapsCommandOutput } from "../commands/ListMapsCommand"; import { LocationClient } from "../LocationClient"; import { LocationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LocationClient, - input: ListMapsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMapsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMaps( +export const paginateListMaps: ( config: LocationPaginationConfiguration, input: ListMapsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMapsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LocationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Location | LocationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LocationPaginationConfiguration, + ListMapsCommandInput, + ListMapsCommandOutput +>(LocationClient, ListMapsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-location/src/pagination/ListPlaceIndexesPaginator.ts b/clients/client-location/src/pagination/ListPlaceIndexesPaginator.ts index ec41dd07fd44..8f277b5b47e8 100644 --- a/clients/client-location/src/pagination/ListPlaceIndexesPaginator.ts +++ b/clients/client-location/src/pagination/ListPlaceIndexesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LocationClient } from "../LocationClient"; import { LocationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LocationClient, - input: ListPlaceIndexesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPlaceIndexesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPlaceIndexes( +export const paginateListPlaceIndexes: ( config: LocationPaginationConfiguration, input: ListPlaceIndexesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPlaceIndexesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LocationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Location | LocationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LocationPaginationConfiguration, + ListPlaceIndexesCommandInput, + ListPlaceIndexesCommandOutput +>(LocationClient, ListPlaceIndexesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-location/src/pagination/ListRouteCalculatorsPaginator.ts b/clients/client-location/src/pagination/ListRouteCalculatorsPaginator.ts index d33f6157be96..857670b85a70 100644 --- a/clients/client-location/src/pagination/ListRouteCalculatorsPaginator.ts +++ b/clients/client-location/src/pagination/ListRouteCalculatorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LocationClient } from "../LocationClient"; import { LocationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LocationClient, - input: ListRouteCalculatorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRouteCalculatorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRouteCalculators( +export const paginateListRouteCalculators: ( config: LocationPaginationConfiguration, input: ListRouteCalculatorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRouteCalculatorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LocationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Location | LocationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LocationPaginationConfiguration, + ListRouteCalculatorsCommandInput, + ListRouteCalculatorsCommandOutput +>(LocationClient, ListRouteCalculatorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-location/src/pagination/ListTrackerConsumersPaginator.ts b/clients/client-location/src/pagination/ListTrackerConsumersPaginator.ts index c21ed7947ee9..a6ed2585afd1 100644 --- a/clients/client-location/src/pagination/ListTrackerConsumersPaginator.ts +++ b/clients/client-location/src/pagination/ListTrackerConsumersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LocationClient } from "../LocationClient"; import { LocationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LocationClient, - input: ListTrackerConsumersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTrackerConsumersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTrackerConsumers( +export const paginateListTrackerConsumers: ( config: LocationPaginationConfiguration, input: ListTrackerConsumersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTrackerConsumersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LocationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Location | LocationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LocationPaginationConfiguration, + ListTrackerConsumersCommandInput, + ListTrackerConsumersCommandOutput +>(LocationClient, ListTrackerConsumersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-location/src/pagination/ListTrackersPaginator.ts b/clients/client-location/src/pagination/ListTrackersPaginator.ts index deb7ec4bbba5..8fca10649641 100644 --- a/clients/client-location/src/pagination/ListTrackersPaginator.ts +++ b/clients/client-location/src/pagination/ListTrackersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LocationClient } from "../LocationClient"; import { LocationPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LocationClient, - input: ListTrackersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTrackersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTrackers( +export const paginateListTrackers: ( config: LocationPaginationConfiguration, input: ListTrackersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTrackersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LocationClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Location | LocationClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LocationPaginationConfiguration, + ListTrackersCommandInput, + ListTrackersCommandOutput +>(LocationClient, ListTrackersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutequipment/package.json b/clients/client-lookoutequipment/package.json index 207f72988b27..673db47ccbd6 100644 --- a/clients/client-lookoutequipment/package.json +++ b/clients/client-lookoutequipment/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-lookoutequipment/src/pagination/ListDataIngestionJobsPaginator.ts b/clients/client-lookoutequipment/src/pagination/ListDataIngestionJobsPaginator.ts index 9365a3160423..c06ed8088e59 100644 --- a/clients/client-lookoutequipment/src/pagination/ListDataIngestionJobsPaginator.ts +++ b/clients/client-lookoutequipment/src/pagination/ListDataIngestionJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutEquipmentClient } from "../LookoutEquipmentClient"; import { LookoutEquipmentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutEquipmentClient, - input: ListDataIngestionJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataIngestionJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataIngestionJobs( +export const paginateListDataIngestionJobs: ( config: LookoutEquipmentPaginationConfiguration, input: ListDataIngestionJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataIngestionJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutEquipmentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutEquipment | LookoutEquipmentClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutEquipmentPaginationConfiguration, + ListDataIngestionJobsCommandInput, + ListDataIngestionJobsCommandOutput +>(LookoutEquipmentClient, ListDataIngestionJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutequipment/src/pagination/ListDatasetsPaginator.ts b/clients/client-lookoutequipment/src/pagination/ListDatasetsPaginator.ts index d19ec81554c6..ec8d0ca16272 100644 --- a/clients/client-lookoutequipment/src/pagination/ListDatasetsPaginator.ts +++ b/clients/client-lookoutequipment/src/pagination/ListDatasetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutEquipmentClient } from "../LookoutEquipmentClient"; import { LookoutEquipmentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutEquipmentClient, - input: ListDatasetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasets( +export const paginateListDatasets: ( config: LookoutEquipmentPaginationConfiguration, input: ListDatasetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutEquipmentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutEquipment | LookoutEquipmentClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutEquipmentPaginationConfiguration, + ListDatasetsCommandInput, + ListDatasetsCommandOutput +>(LookoutEquipmentClient, ListDatasetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutequipment/src/pagination/ListInferenceEventsPaginator.ts b/clients/client-lookoutequipment/src/pagination/ListInferenceEventsPaginator.ts index c3a0d4e5962a..ba368a44e495 100644 --- a/clients/client-lookoutequipment/src/pagination/ListInferenceEventsPaginator.ts +++ b/clients/client-lookoutequipment/src/pagination/ListInferenceEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutEquipmentClient } from "../LookoutEquipmentClient"; import { LookoutEquipmentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutEquipmentClient, - input: ListInferenceEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInferenceEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInferenceEvents( +export const paginateListInferenceEvents: ( config: LookoutEquipmentPaginationConfiguration, input: ListInferenceEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInferenceEventsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutEquipmentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutEquipment | LookoutEquipmentClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutEquipmentPaginationConfiguration, + ListInferenceEventsCommandInput, + ListInferenceEventsCommandOutput +>(LookoutEquipmentClient, ListInferenceEventsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutequipment/src/pagination/ListInferenceExecutionsPaginator.ts b/clients/client-lookoutequipment/src/pagination/ListInferenceExecutionsPaginator.ts index 882113891387..c0a2a9c27014 100644 --- a/clients/client-lookoutequipment/src/pagination/ListInferenceExecutionsPaginator.ts +++ b/clients/client-lookoutequipment/src/pagination/ListInferenceExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutEquipmentClient } from "../LookoutEquipmentClient"; import { LookoutEquipmentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutEquipmentClient, - input: ListInferenceExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInferenceExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInferenceExecutions( +export const paginateListInferenceExecutions: ( config: LookoutEquipmentPaginationConfiguration, input: ListInferenceExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInferenceExecutionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutEquipmentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutEquipment | LookoutEquipmentClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutEquipmentPaginationConfiguration, + ListInferenceExecutionsCommandInput, + ListInferenceExecutionsCommandOutput +>(LookoutEquipmentClient, ListInferenceExecutionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutequipment/src/pagination/ListInferenceSchedulersPaginator.ts b/clients/client-lookoutequipment/src/pagination/ListInferenceSchedulersPaginator.ts index a6aaca219bff..fae705611c6a 100644 --- a/clients/client-lookoutequipment/src/pagination/ListInferenceSchedulersPaginator.ts +++ b/clients/client-lookoutequipment/src/pagination/ListInferenceSchedulersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutEquipmentClient } from "../LookoutEquipmentClient"; import { LookoutEquipmentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutEquipmentClient, - input: ListInferenceSchedulersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInferenceSchedulersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInferenceSchedulers( +export const paginateListInferenceSchedulers: ( config: LookoutEquipmentPaginationConfiguration, input: ListInferenceSchedulersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInferenceSchedulersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutEquipmentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutEquipment | LookoutEquipmentClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutEquipmentPaginationConfiguration, + ListInferenceSchedulersCommandInput, + ListInferenceSchedulersCommandOutput +>(LookoutEquipmentClient, ListInferenceSchedulersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutequipment/src/pagination/ListLabelGroupsPaginator.ts b/clients/client-lookoutequipment/src/pagination/ListLabelGroupsPaginator.ts index 0381c86bad0a..4204713b5f59 100644 --- a/clients/client-lookoutequipment/src/pagination/ListLabelGroupsPaginator.ts +++ b/clients/client-lookoutequipment/src/pagination/ListLabelGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutEquipmentClient } from "../LookoutEquipmentClient"; import { LookoutEquipmentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutEquipmentClient, - input: ListLabelGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLabelGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLabelGroups( +export const paginateListLabelGroups: ( config: LookoutEquipmentPaginationConfiguration, input: ListLabelGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLabelGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutEquipmentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutEquipment | LookoutEquipmentClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutEquipmentPaginationConfiguration, + ListLabelGroupsCommandInput, + ListLabelGroupsCommandOutput +>(LookoutEquipmentClient, ListLabelGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutequipment/src/pagination/ListLabelsPaginator.ts b/clients/client-lookoutequipment/src/pagination/ListLabelsPaginator.ts index dbc8eef99a2f..22a82fc94f5b 100644 --- a/clients/client-lookoutequipment/src/pagination/ListLabelsPaginator.ts +++ b/clients/client-lookoutequipment/src/pagination/ListLabelsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListLabelsCommand, ListLabelsCommandInput, ListLabelsCommandOutput } from "../commands/ListLabelsCommand"; import { LookoutEquipmentClient } from "../LookoutEquipmentClient"; import { LookoutEquipmentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutEquipmentClient, - input: ListLabelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLabelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLabels( +export const paginateListLabels: ( config: LookoutEquipmentPaginationConfiguration, input: ListLabelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLabelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutEquipmentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutEquipment | LookoutEquipmentClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutEquipmentPaginationConfiguration, + ListLabelsCommandInput, + ListLabelsCommandOutput +>(LookoutEquipmentClient, ListLabelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutequipment/src/pagination/ListModelVersionsPaginator.ts b/clients/client-lookoutequipment/src/pagination/ListModelVersionsPaginator.ts index 27cf3dda14a4..d5e50c16dd95 100644 --- a/clients/client-lookoutequipment/src/pagination/ListModelVersionsPaginator.ts +++ b/clients/client-lookoutequipment/src/pagination/ListModelVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutEquipmentClient } from "../LookoutEquipmentClient"; import { LookoutEquipmentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutEquipmentClient, - input: ListModelVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModelVersions( +export const paginateListModelVersions: ( config: LookoutEquipmentPaginationConfiguration, input: ListModelVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutEquipmentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutEquipment | LookoutEquipmentClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutEquipmentPaginationConfiguration, + ListModelVersionsCommandInput, + ListModelVersionsCommandOutput +>(LookoutEquipmentClient, ListModelVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutequipment/src/pagination/ListModelsPaginator.ts b/clients/client-lookoutequipment/src/pagination/ListModelsPaginator.ts index cf54fe391426..73cfd9a66df6 100644 --- a/clients/client-lookoutequipment/src/pagination/ListModelsPaginator.ts +++ b/clients/client-lookoutequipment/src/pagination/ListModelsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListModelsCommand, ListModelsCommandInput, ListModelsCommandOutput } from "../commands/ListModelsCommand"; import { LookoutEquipmentClient } from "../LookoutEquipmentClient"; import { LookoutEquipmentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutEquipmentClient, - input: ListModelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModels( +export const paginateListModels: ( config: LookoutEquipmentPaginationConfiguration, input: ListModelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutEquipmentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutEquipment | LookoutEquipmentClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutEquipmentPaginationConfiguration, + ListModelsCommandInput, + ListModelsCommandOutput +>(LookoutEquipmentClient, ListModelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutequipment/src/pagination/ListRetrainingSchedulersPaginator.ts b/clients/client-lookoutequipment/src/pagination/ListRetrainingSchedulersPaginator.ts index f747229cf0ed..6b2dde5e2283 100644 --- a/clients/client-lookoutequipment/src/pagination/ListRetrainingSchedulersPaginator.ts +++ b/clients/client-lookoutequipment/src/pagination/ListRetrainingSchedulersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutEquipmentClient } from "../LookoutEquipmentClient"; import { LookoutEquipmentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutEquipmentClient, - input: ListRetrainingSchedulersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRetrainingSchedulersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRetrainingSchedulers( +export const paginateListRetrainingSchedulers: ( config: LookoutEquipmentPaginationConfiguration, input: ListRetrainingSchedulersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRetrainingSchedulersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutEquipmentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutEquipment | LookoutEquipmentClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutEquipmentPaginationConfiguration, + ListRetrainingSchedulersCommandInput, + ListRetrainingSchedulersCommandOutput +>(LookoutEquipmentClient, ListRetrainingSchedulersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutequipment/src/pagination/ListSensorStatisticsPaginator.ts b/clients/client-lookoutequipment/src/pagination/ListSensorStatisticsPaginator.ts index 37907ff97225..67100fc69e7d 100644 --- a/clients/client-lookoutequipment/src/pagination/ListSensorStatisticsPaginator.ts +++ b/clients/client-lookoutequipment/src/pagination/ListSensorStatisticsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutEquipmentClient } from "../LookoutEquipmentClient"; import { LookoutEquipmentPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutEquipmentClient, - input: ListSensorStatisticsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSensorStatisticsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSensorStatistics( +export const paginateListSensorStatistics: ( config: LookoutEquipmentPaginationConfiguration, input: ListSensorStatisticsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSensorStatisticsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutEquipmentClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutEquipment | LookoutEquipmentClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutEquipmentPaginationConfiguration, + ListSensorStatisticsCommandInput, + ListSensorStatisticsCommandOutput +>(LookoutEquipmentClient, ListSensorStatisticsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutmetrics/src/pagination/DescribeAnomalyDetectionExecutionsPaginator.ts b/clients/client-lookoutmetrics/src/pagination/DescribeAnomalyDetectionExecutionsPaginator.ts index 52a4084130b7..5c67405180ef 100644 --- a/clients/client-lookoutmetrics/src/pagination/DescribeAnomalyDetectionExecutionsPaginator.ts +++ b/clients/client-lookoutmetrics/src/pagination/DescribeAnomalyDetectionExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutMetricsClient } from "../LookoutMetricsClient"; import { LookoutMetricsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutMetricsClient, - input: DescribeAnomalyDetectionExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAnomalyDetectionExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAnomalyDetectionExecutions( +export const paginateDescribeAnomalyDetectionExecutions: ( config: LookoutMetricsPaginationConfiguration, input: DescribeAnomalyDetectionExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAnomalyDetectionExecutionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutMetricsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutMetrics | LookoutMetricsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutMetricsPaginationConfiguration, + DescribeAnomalyDetectionExecutionsCommandInput, + DescribeAnomalyDetectionExecutionsCommandOutput +>(LookoutMetricsClient, DescribeAnomalyDetectionExecutionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutmetrics/src/pagination/GetFeedbackPaginator.ts b/clients/client-lookoutmetrics/src/pagination/GetFeedbackPaginator.ts index c205d9dd329a..74fd1935bd21 100644 --- a/clients/client-lookoutmetrics/src/pagination/GetFeedbackPaginator.ts +++ b/clients/client-lookoutmetrics/src/pagination/GetFeedbackPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetFeedbackCommand, GetFeedbackCommandInput, GetFeedbackCommandOutput } from "../commands/GetFeedbackCommand"; import { LookoutMetricsClient } from "../LookoutMetricsClient"; import { LookoutMetricsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutMetricsClient, - input: GetFeedbackCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetFeedbackCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetFeedback( +export const paginateGetFeedback: ( config: LookoutMetricsPaginationConfiguration, input: GetFeedbackCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetFeedbackCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutMetricsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutMetrics | LookoutMetricsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutMetricsPaginationConfiguration, + GetFeedbackCommandInput, + GetFeedbackCommandOutput +>(LookoutMetricsClient, GetFeedbackCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutmetrics/src/pagination/ListAlertsPaginator.ts b/clients/client-lookoutmetrics/src/pagination/ListAlertsPaginator.ts index 0b606347d323..f8cd59d66a87 100644 --- a/clients/client-lookoutmetrics/src/pagination/ListAlertsPaginator.ts +++ b/clients/client-lookoutmetrics/src/pagination/ListAlertsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAlertsCommand, ListAlertsCommandInput, ListAlertsCommandOutput } from "../commands/ListAlertsCommand"; import { LookoutMetricsClient } from "../LookoutMetricsClient"; import { LookoutMetricsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutMetricsClient, - input: ListAlertsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAlertsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAlerts( +export const paginateListAlerts: ( config: LookoutMetricsPaginationConfiguration, input: ListAlertsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAlertsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutMetricsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutMetrics | LookoutMetricsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutMetricsPaginationConfiguration, + ListAlertsCommandInput, + ListAlertsCommandOutput +>(LookoutMetricsClient, ListAlertsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutmetrics/src/pagination/ListAnomalyDetectorsPaginator.ts b/clients/client-lookoutmetrics/src/pagination/ListAnomalyDetectorsPaginator.ts index 712bbdfba598..730d9081cf4b 100644 --- a/clients/client-lookoutmetrics/src/pagination/ListAnomalyDetectorsPaginator.ts +++ b/clients/client-lookoutmetrics/src/pagination/ListAnomalyDetectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutMetricsClient } from "../LookoutMetricsClient"; import { LookoutMetricsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutMetricsClient, - input: ListAnomalyDetectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnomalyDetectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnomalyDetectors( +export const paginateListAnomalyDetectors: ( config: LookoutMetricsPaginationConfiguration, input: ListAnomalyDetectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnomalyDetectorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutMetricsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutMetrics | LookoutMetricsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutMetricsPaginationConfiguration, + ListAnomalyDetectorsCommandInput, + ListAnomalyDetectorsCommandOutput +>(LookoutMetricsClient, ListAnomalyDetectorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutmetrics/src/pagination/ListAnomalyGroupRelatedMetricsPaginator.ts b/clients/client-lookoutmetrics/src/pagination/ListAnomalyGroupRelatedMetricsPaginator.ts index 82e36acffb23..7f1cbcdd9e83 100644 --- a/clients/client-lookoutmetrics/src/pagination/ListAnomalyGroupRelatedMetricsPaginator.ts +++ b/clients/client-lookoutmetrics/src/pagination/ListAnomalyGroupRelatedMetricsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutMetricsClient } from "../LookoutMetricsClient"; import { LookoutMetricsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutMetricsClient, - input: ListAnomalyGroupRelatedMetricsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnomalyGroupRelatedMetricsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnomalyGroupRelatedMetrics( +export const paginateListAnomalyGroupRelatedMetrics: ( config: LookoutMetricsPaginationConfiguration, input: ListAnomalyGroupRelatedMetricsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnomalyGroupRelatedMetricsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutMetricsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutMetrics | LookoutMetricsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutMetricsPaginationConfiguration, + ListAnomalyGroupRelatedMetricsCommandInput, + ListAnomalyGroupRelatedMetricsCommandOutput +>(LookoutMetricsClient, ListAnomalyGroupRelatedMetricsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutmetrics/src/pagination/ListAnomalyGroupSummariesPaginator.ts b/clients/client-lookoutmetrics/src/pagination/ListAnomalyGroupSummariesPaginator.ts index bd27910baa1a..3ccc9066ee6f 100644 --- a/clients/client-lookoutmetrics/src/pagination/ListAnomalyGroupSummariesPaginator.ts +++ b/clients/client-lookoutmetrics/src/pagination/ListAnomalyGroupSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutMetricsClient } from "../LookoutMetricsClient"; import { LookoutMetricsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutMetricsClient, - input: ListAnomalyGroupSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnomalyGroupSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnomalyGroupSummaries( +export const paginateListAnomalyGroupSummaries: ( config: LookoutMetricsPaginationConfiguration, input: ListAnomalyGroupSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnomalyGroupSummariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutMetricsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutMetrics | LookoutMetricsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutMetricsPaginationConfiguration, + ListAnomalyGroupSummariesCommandInput, + ListAnomalyGroupSummariesCommandOutput +>(LookoutMetricsClient, ListAnomalyGroupSummariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutmetrics/src/pagination/ListAnomalyGroupTimeSeriesPaginator.ts b/clients/client-lookoutmetrics/src/pagination/ListAnomalyGroupTimeSeriesPaginator.ts index bf9af62c1568..4464ac738625 100644 --- a/clients/client-lookoutmetrics/src/pagination/ListAnomalyGroupTimeSeriesPaginator.ts +++ b/clients/client-lookoutmetrics/src/pagination/ListAnomalyGroupTimeSeriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutMetricsClient } from "../LookoutMetricsClient"; import { LookoutMetricsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutMetricsClient, - input: ListAnomalyGroupTimeSeriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnomalyGroupTimeSeriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnomalyGroupTimeSeries( +export const paginateListAnomalyGroupTimeSeries: ( config: LookoutMetricsPaginationConfiguration, input: ListAnomalyGroupTimeSeriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnomalyGroupTimeSeriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutMetricsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutMetrics | LookoutMetricsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutMetricsPaginationConfiguration, + ListAnomalyGroupTimeSeriesCommandInput, + ListAnomalyGroupTimeSeriesCommandOutput +>(LookoutMetricsClient, ListAnomalyGroupTimeSeriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutmetrics/src/pagination/ListMetricSetsPaginator.ts b/clients/client-lookoutmetrics/src/pagination/ListMetricSetsPaginator.ts index a8f068e16f27..8254f715ef9a 100644 --- a/clients/client-lookoutmetrics/src/pagination/ListMetricSetsPaginator.ts +++ b/clients/client-lookoutmetrics/src/pagination/ListMetricSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutMetricsClient } from "../LookoutMetricsClient"; import { LookoutMetricsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutMetricsClient, - input: ListMetricSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMetricSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMetricSets( +export const paginateListMetricSets: ( config: LookoutMetricsPaginationConfiguration, input: ListMetricSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMetricSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutMetricsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutMetrics | LookoutMetricsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutMetricsPaginationConfiguration, + ListMetricSetsCommandInput, + ListMetricSetsCommandOutput +>(LookoutMetricsClient, ListMetricSetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutvision/src/pagination/ListDatasetEntriesPaginator.ts b/clients/client-lookoutvision/src/pagination/ListDatasetEntriesPaginator.ts index 15223a298b4a..66c12b6e6921 100644 --- a/clients/client-lookoutvision/src/pagination/ListDatasetEntriesPaginator.ts +++ b/clients/client-lookoutvision/src/pagination/ListDatasetEntriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutVisionClient } from "../LookoutVisionClient"; import { LookoutVisionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutVisionClient, - input: ListDatasetEntriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetEntriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasetEntries( +export const paginateListDatasetEntries: ( config: LookoutVisionPaginationConfiguration, input: ListDatasetEntriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetEntriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutVisionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutVision | LookoutVisionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutVisionPaginationConfiguration, + ListDatasetEntriesCommandInput, + ListDatasetEntriesCommandOutput +>(LookoutVisionClient, ListDatasetEntriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutvision/src/pagination/ListModelPackagingJobsPaginator.ts b/clients/client-lookoutvision/src/pagination/ListModelPackagingJobsPaginator.ts index e0b8ae935209..17b2583aefd8 100644 --- a/clients/client-lookoutvision/src/pagination/ListModelPackagingJobsPaginator.ts +++ b/clients/client-lookoutvision/src/pagination/ListModelPackagingJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutVisionClient } from "../LookoutVisionClient"; import { LookoutVisionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutVisionClient, - input: ListModelPackagingJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelPackagingJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModelPackagingJobs( +export const paginateListModelPackagingJobs: ( config: LookoutVisionPaginationConfiguration, input: ListModelPackagingJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelPackagingJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutVisionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutVision | LookoutVisionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutVisionPaginationConfiguration, + ListModelPackagingJobsCommandInput, + ListModelPackagingJobsCommandOutput +>(LookoutVisionClient, ListModelPackagingJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutvision/src/pagination/ListModelsPaginator.ts b/clients/client-lookoutvision/src/pagination/ListModelsPaginator.ts index 5d3c77bb9cc7..79158e22f00c 100644 --- a/clients/client-lookoutvision/src/pagination/ListModelsPaginator.ts +++ b/clients/client-lookoutvision/src/pagination/ListModelsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListModelsCommand, ListModelsCommandInput, ListModelsCommandOutput } from "../commands/ListModelsCommand"; import { LookoutVisionClient } from "../LookoutVisionClient"; import { LookoutVisionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutVisionClient, - input: ListModelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModels( +export const paginateListModels: ( config: LookoutVisionPaginationConfiguration, input: ListModelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutVisionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutVision | LookoutVisionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutVisionPaginationConfiguration, + ListModelsCommandInput, + ListModelsCommandOutput +>(LookoutVisionClient, ListModelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-lookoutvision/src/pagination/ListProjectsPaginator.ts b/clients/client-lookoutvision/src/pagination/ListProjectsPaginator.ts index b993d176ecda..57fe2c9aa05d 100644 --- a/clients/client-lookoutvision/src/pagination/ListProjectsPaginator.ts +++ b/clients/client-lookoutvision/src/pagination/ListProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { LookoutVisionClient } from "../LookoutVisionClient"; import { LookoutVisionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: LookoutVisionClient, - input: ListProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProjects( +export const paginateListProjects: ( config: LookoutVisionPaginationConfiguration, input: ListProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProjectsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof LookoutVisionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected LookoutVision | LookoutVisionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + LookoutVisionPaginationConfiguration, + ListProjectsCommandInput, + ListProjectsCommandOutput +>(LookoutVisionClient, ListProjectsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-m2/src/pagination/ListApplicationVersionsPaginator.ts b/clients/client-m2/src/pagination/ListApplicationVersionsPaginator.ts index 8fb12c97fb34..77b86fa09466 100644 --- a/clients/client-m2/src/pagination/ListApplicationVersionsPaginator.ts +++ b/clients/client-m2/src/pagination/ListApplicationVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { M2Client } from "../M2Client"; import { M2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: M2Client, - input: ListApplicationVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationVersions( +export const paginateListApplicationVersions: ( config: M2PaginationConfiguration, input: ListApplicationVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof M2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected M2 | M2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + M2PaginationConfiguration, + ListApplicationVersionsCommandInput, + ListApplicationVersionsCommandOutput +>(M2Client, ListApplicationVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-m2/src/pagination/ListApplicationsPaginator.ts b/clients/client-m2/src/pagination/ListApplicationsPaginator.ts index 32df142ffd9e..5a14aa3c618d 100644 --- a/clients/client-m2/src/pagination/ListApplicationsPaginator.ts +++ b/clients/client-m2/src/pagination/ListApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { M2Client } from "../M2Client"; import { M2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: M2Client, - input: ListApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplications( +export const paginateListApplications: ( config: M2PaginationConfiguration, input: ListApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof M2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected M2 | M2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + M2PaginationConfiguration, + ListApplicationsCommandInput, + ListApplicationsCommandOutput +>(M2Client, ListApplicationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-m2/src/pagination/ListBatchJobDefinitionsPaginator.ts b/clients/client-m2/src/pagination/ListBatchJobDefinitionsPaginator.ts index c3cdb56f8376..02d70f155d37 100644 --- a/clients/client-m2/src/pagination/ListBatchJobDefinitionsPaginator.ts +++ b/clients/client-m2/src/pagination/ListBatchJobDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { M2Client } from "../M2Client"; import { M2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: M2Client, - input: ListBatchJobDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBatchJobDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBatchJobDefinitions( +export const paginateListBatchJobDefinitions: ( config: M2PaginationConfiguration, input: ListBatchJobDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBatchJobDefinitionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof M2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected M2 | M2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + M2PaginationConfiguration, + ListBatchJobDefinitionsCommandInput, + ListBatchJobDefinitionsCommandOutput +>(M2Client, ListBatchJobDefinitionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-m2/src/pagination/ListBatchJobExecutionsPaginator.ts b/clients/client-m2/src/pagination/ListBatchJobExecutionsPaginator.ts index f0b5bb0d931f..11bb7e44546d 100644 --- a/clients/client-m2/src/pagination/ListBatchJobExecutionsPaginator.ts +++ b/clients/client-m2/src/pagination/ListBatchJobExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { M2Client } from "../M2Client"; import { M2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: M2Client, - input: ListBatchJobExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBatchJobExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBatchJobExecutions( +export const paginateListBatchJobExecutions: ( config: M2PaginationConfiguration, input: ListBatchJobExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBatchJobExecutionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof M2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected M2 | M2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + M2PaginationConfiguration, + ListBatchJobExecutionsCommandInput, + ListBatchJobExecutionsCommandOutput +>(M2Client, ListBatchJobExecutionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-m2/src/pagination/ListDataSetImportHistoryPaginator.ts b/clients/client-m2/src/pagination/ListDataSetImportHistoryPaginator.ts index f94a5959eb3a..6871b1b6cf49 100644 --- a/clients/client-m2/src/pagination/ListDataSetImportHistoryPaginator.ts +++ b/clients/client-m2/src/pagination/ListDataSetImportHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { M2Client } from "../M2Client"; import { M2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: M2Client, - input: ListDataSetImportHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataSetImportHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataSetImportHistory( +export const paginateListDataSetImportHistory: ( config: M2PaginationConfiguration, input: ListDataSetImportHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataSetImportHistoryCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof M2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected M2 | M2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + M2PaginationConfiguration, + ListDataSetImportHistoryCommandInput, + ListDataSetImportHistoryCommandOutput +>(M2Client, ListDataSetImportHistoryCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-m2/src/pagination/ListDataSetsPaginator.ts b/clients/client-m2/src/pagination/ListDataSetsPaginator.ts index 547d50f477fc..3522398c9370 100644 --- a/clients/client-m2/src/pagination/ListDataSetsPaginator.ts +++ b/clients/client-m2/src/pagination/ListDataSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { M2Client } from "../M2Client"; import { M2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: M2Client, - input: ListDataSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataSets( +export const paginateListDataSets: ( config: M2PaginationConfiguration, input: ListDataSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataSetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof M2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected M2 | M2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + M2PaginationConfiguration, + ListDataSetsCommandInput, + ListDataSetsCommandOutput +>(M2Client, ListDataSetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-m2/src/pagination/ListDeploymentsPaginator.ts b/clients/client-m2/src/pagination/ListDeploymentsPaginator.ts index ed5ab82998b4..165934492f2c 100644 --- a/clients/client-m2/src/pagination/ListDeploymentsPaginator.ts +++ b/clients/client-m2/src/pagination/ListDeploymentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { M2Client } from "../M2Client"; import { M2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: M2Client, - input: ListDeploymentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeploymentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeployments( +export const paginateListDeployments: ( config: M2PaginationConfiguration, input: ListDeploymentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeploymentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof M2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected M2 | M2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + M2PaginationConfiguration, + ListDeploymentsCommandInput, + ListDeploymentsCommandOutput +>(M2Client, ListDeploymentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-m2/src/pagination/ListEngineVersionsPaginator.ts b/clients/client-m2/src/pagination/ListEngineVersionsPaginator.ts index 74c6460e4a2a..775bf87e8c8f 100644 --- a/clients/client-m2/src/pagination/ListEngineVersionsPaginator.ts +++ b/clients/client-m2/src/pagination/ListEngineVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { M2Client } from "../M2Client"; import { M2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: M2Client, - input: ListEngineVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEngineVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEngineVersions( +export const paginateListEngineVersions: ( config: M2PaginationConfiguration, input: ListEngineVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEngineVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof M2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected M2 | M2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + M2PaginationConfiguration, + ListEngineVersionsCommandInput, + ListEngineVersionsCommandOutput +>(M2Client, ListEngineVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-m2/src/pagination/ListEnvironmentsPaginator.ts b/clients/client-m2/src/pagination/ListEnvironmentsPaginator.ts index 7001057ed5bf..7bb01371efbc 100644 --- a/clients/client-m2/src/pagination/ListEnvironmentsPaginator.ts +++ b/clients/client-m2/src/pagination/ListEnvironmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { M2Client } from "../M2Client"; import { M2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: M2Client, - input: ListEnvironmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironments( +export const paginateListEnvironments: ( config: M2PaginationConfiguration, input: ListEnvironmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof M2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected M2 | M2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + M2PaginationConfiguration, + ListEnvironmentsCommandInput, + ListEnvironmentsCommandOutput +>(M2Client, ListEnvironmentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-machine-learning/package.json b/clients/client-machine-learning/package.json index d360e7bf23f9..b928978a9faa 100644 --- a/clients/client-machine-learning/package.json +++ b/clients/client-machine-learning/package.json @@ -35,6 +35,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-machine-learning/src/pagination/DescribeBatchPredictionsPaginator.ts b/clients/client-machine-learning/src/pagination/DescribeBatchPredictionsPaginator.ts index 37844a181d28..5da06dc24938 100644 --- a/clients/client-machine-learning/src/pagination/DescribeBatchPredictionsPaginator.ts +++ b/clients/client-machine-learning/src/pagination/DescribeBatchPredictionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MachineLearningClient } from "../MachineLearningClient"; import { MachineLearningPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MachineLearningClient, - input: DescribeBatchPredictionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeBatchPredictionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeBatchPredictions( +export const paginateDescribeBatchPredictions: ( config: MachineLearningPaginationConfiguration, input: DescribeBatchPredictionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeBatchPredictionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof MachineLearningClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MachineLearning | MachineLearningClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MachineLearningPaginationConfiguration, + DescribeBatchPredictionsCommandInput, + DescribeBatchPredictionsCommandOutput +>(MachineLearningClient, DescribeBatchPredictionsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-machine-learning/src/pagination/DescribeDataSourcesPaginator.ts b/clients/client-machine-learning/src/pagination/DescribeDataSourcesPaginator.ts index fc426b825d05..f9c8f79feda4 100644 --- a/clients/client-machine-learning/src/pagination/DescribeDataSourcesPaginator.ts +++ b/clients/client-machine-learning/src/pagination/DescribeDataSourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MachineLearningClient } from "../MachineLearningClient"; import { MachineLearningPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MachineLearningClient, - input: DescribeDataSourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDataSourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDataSources( +export const paginateDescribeDataSources: ( config: MachineLearningPaginationConfiguration, input: DescribeDataSourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDataSourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof MachineLearningClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MachineLearning | MachineLearningClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MachineLearningPaginationConfiguration, + DescribeDataSourcesCommandInput, + DescribeDataSourcesCommandOutput +>(MachineLearningClient, DescribeDataSourcesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-machine-learning/src/pagination/DescribeEvaluationsPaginator.ts b/clients/client-machine-learning/src/pagination/DescribeEvaluationsPaginator.ts index aaf2ee8568d5..e417dc423f67 100644 --- a/clients/client-machine-learning/src/pagination/DescribeEvaluationsPaginator.ts +++ b/clients/client-machine-learning/src/pagination/DescribeEvaluationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MachineLearningClient } from "../MachineLearningClient"; import { MachineLearningPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MachineLearningClient, - input: DescribeEvaluationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEvaluationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEvaluations( +export const paginateDescribeEvaluations: ( config: MachineLearningPaginationConfiguration, input: DescribeEvaluationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEvaluationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof MachineLearningClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MachineLearning | MachineLearningClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MachineLearningPaginationConfiguration, + DescribeEvaluationsCommandInput, + DescribeEvaluationsCommandOutput +>(MachineLearningClient, DescribeEvaluationsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-machine-learning/src/pagination/DescribeMLModelsPaginator.ts b/clients/client-machine-learning/src/pagination/DescribeMLModelsPaginator.ts index 181aff50aa23..6c6d68f7af05 100644 --- a/clients/client-machine-learning/src/pagination/DescribeMLModelsPaginator.ts +++ b/clients/client-machine-learning/src/pagination/DescribeMLModelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MachineLearningClient } from "../MachineLearningClient"; import { MachineLearningPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MachineLearningClient, - input: DescribeMLModelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMLModelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMLModels( +export const paginateDescribeMLModels: ( config: MachineLearningPaginationConfiguration, input: DescribeMLModelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMLModelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof MachineLearningClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MachineLearning | MachineLearningClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MachineLearningPaginationConfiguration, + DescribeMLModelsCommandInput, + DescribeMLModelsCommandOutput +>(MachineLearningClient, DescribeMLModelsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-macie2/src/pagination/DescribeBucketsPaginator.ts b/clients/client-macie2/src/pagination/DescribeBucketsPaginator.ts index 1d7f18170084..1a4581f84009 100644 --- a/clients/client-macie2/src/pagination/DescribeBucketsPaginator.ts +++ b/clients/client-macie2/src/pagination/DescribeBucketsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: DescribeBucketsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeBucketsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeBuckets( +export const paginateDescribeBuckets: ( config: Macie2PaginationConfiguration, input: DescribeBucketsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeBucketsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + DescribeBucketsCommandInput, + DescribeBucketsCommandOutput +>(Macie2Client, DescribeBucketsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-macie2/src/pagination/GetUsageStatisticsPaginator.ts b/clients/client-macie2/src/pagination/GetUsageStatisticsPaginator.ts index c6fc6461cc0d..e4a59565c840 100644 --- a/clients/client-macie2/src/pagination/GetUsageStatisticsPaginator.ts +++ b/clients/client-macie2/src/pagination/GetUsageStatisticsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: GetUsageStatisticsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetUsageStatisticsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetUsageStatistics( +export const paginateGetUsageStatistics: ( config: Macie2PaginationConfiguration, input: GetUsageStatisticsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetUsageStatisticsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + GetUsageStatisticsCommandInput, + GetUsageStatisticsCommandOutput +>(Macie2Client, GetUsageStatisticsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-macie2/src/pagination/ListAllowListsPaginator.ts b/clients/client-macie2/src/pagination/ListAllowListsPaginator.ts index 46ed0a7a6349..53a53353db10 100644 --- a/clients/client-macie2/src/pagination/ListAllowListsPaginator.ts +++ b/clients/client-macie2/src/pagination/ListAllowListsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: ListAllowListsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAllowListsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAllowLists( +export const paginateListAllowLists: ( config: Macie2PaginationConfiguration, input: ListAllowListsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAllowListsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + ListAllowListsCommandInput, + ListAllowListsCommandOutput +>(Macie2Client, ListAllowListsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-macie2/src/pagination/ListClassificationJobsPaginator.ts b/clients/client-macie2/src/pagination/ListClassificationJobsPaginator.ts index 2804ff5bf8e8..aed2431ae95a 100644 --- a/clients/client-macie2/src/pagination/ListClassificationJobsPaginator.ts +++ b/clients/client-macie2/src/pagination/ListClassificationJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: ListClassificationJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClassificationJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClassificationJobs( +export const paginateListClassificationJobs: ( config: Macie2PaginationConfiguration, input: ListClassificationJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClassificationJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + ListClassificationJobsCommandInput, + ListClassificationJobsCommandOutput +>(Macie2Client, ListClassificationJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-macie2/src/pagination/ListClassificationScopesPaginator.ts b/clients/client-macie2/src/pagination/ListClassificationScopesPaginator.ts index 342c62453007..5143d7883346 100644 --- a/clients/client-macie2/src/pagination/ListClassificationScopesPaginator.ts +++ b/clients/client-macie2/src/pagination/ListClassificationScopesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: ListClassificationScopesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClassificationScopesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClassificationScopes( +export const paginateListClassificationScopes: ( config: Macie2PaginationConfiguration, input: ListClassificationScopesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClassificationScopesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + ListClassificationScopesCommandInput, + ListClassificationScopesCommandOutput +>(Macie2Client, ListClassificationScopesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-macie2/src/pagination/ListCustomDataIdentifiersPaginator.ts b/clients/client-macie2/src/pagination/ListCustomDataIdentifiersPaginator.ts index a6c9f2532f97..0838debee96c 100644 --- a/clients/client-macie2/src/pagination/ListCustomDataIdentifiersPaginator.ts +++ b/clients/client-macie2/src/pagination/ListCustomDataIdentifiersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: ListCustomDataIdentifiersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomDataIdentifiersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomDataIdentifiers( +export const paginateListCustomDataIdentifiers: ( config: Macie2PaginationConfiguration, input: ListCustomDataIdentifiersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomDataIdentifiersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + ListCustomDataIdentifiersCommandInput, + ListCustomDataIdentifiersCommandOutput +>(Macie2Client, ListCustomDataIdentifiersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-macie2/src/pagination/ListFindingsFiltersPaginator.ts b/clients/client-macie2/src/pagination/ListFindingsFiltersPaginator.ts index e79591fa9252..5512808736e0 100644 --- a/clients/client-macie2/src/pagination/ListFindingsFiltersPaginator.ts +++ b/clients/client-macie2/src/pagination/ListFindingsFiltersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: ListFindingsFiltersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFindingsFiltersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFindingsFilters( +export const paginateListFindingsFilters: ( config: Macie2PaginationConfiguration, input: ListFindingsFiltersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFindingsFiltersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + ListFindingsFiltersCommandInput, + ListFindingsFiltersCommandOutput +>(Macie2Client, ListFindingsFiltersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-macie2/src/pagination/ListFindingsPaginator.ts b/clients/client-macie2/src/pagination/ListFindingsPaginator.ts index 1013f97fc5eb..f35981da7970 100644 --- a/clients/client-macie2/src/pagination/ListFindingsPaginator.ts +++ b/clients/client-macie2/src/pagination/ListFindingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: ListFindingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFindingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFindings( +export const paginateListFindings: ( config: Macie2PaginationConfiguration, input: ListFindingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFindingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + ListFindingsCommandInput, + ListFindingsCommandOutput +>(Macie2Client, ListFindingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-macie2/src/pagination/ListInvitationsPaginator.ts b/clients/client-macie2/src/pagination/ListInvitationsPaginator.ts index c4034fba8778..8011fc7a3466 100644 --- a/clients/client-macie2/src/pagination/ListInvitationsPaginator.ts +++ b/clients/client-macie2/src/pagination/ListInvitationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: ListInvitationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInvitationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInvitations( +export const paginateListInvitations: ( config: Macie2PaginationConfiguration, input: ListInvitationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInvitationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + ListInvitationsCommandInput, + ListInvitationsCommandOutput +>(Macie2Client, ListInvitationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-macie2/src/pagination/ListManagedDataIdentifiersPaginator.ts b/clients/client-macie2/src/pagination/ListManagedDataIdentifiersPaginator.ts index c583c8e3a429..2d922f276f9e 100644 --- a/clients/client-macie2/src/pagination/ListManagedDataIdentifiersPaginator.ts +++ b/clients/client-macie2/src/pagination/ListManagedDataIdentifiersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: ListManagedDataIdentifiersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListManagedDataIdentifiersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListManagedDataIdentifiers( +export const paginateListManagedDataIdentifiers: ( config: Macie2PaginationConfiguration, input: ListManagedDataIdentifiersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListManagedDataIdentifiersCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + ListManagedDataIdentifiersCommandInput, + ListManagedDataIdentifiersCommandOutput +>(Macie2Client, ListManagedDataIdentifiersCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-macie2/src/pagination/ListMembersPaginator.ts b/clients/client-macie2/src/pagination/ListMembersPaginator.ts index 9edbe11636ea..ce0cb3740974 100644 --- a/clients/client-macie2/src/pagination/ListMembersPaginator.ts +++ b/clients/client-macie2/src/pagination/ListMembersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListMembersCommand, ListMembersCommandInput, ListMembersCommandOutput } from "../commands/ListMembersCommand"; import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: ListMembersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMembersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMembers( +export const paginateListMembers: ( config: Macie2PaginationConfiguration, input: ListMembersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMembersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + ListMembersCommandInput, + ListMembersCommandOutput +>(Macie2Client, ListMembersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-macie2/src/pagination/ListOrganizationAdminAccountsPaginator.ts b/clients/client-macie2/src/pagination/ListOrganizationAdminAccountsPaginator.ts index 924c1184796f..0f8c3ad54bd0 100644 --- a/clients/client-macie2/src/pagination/ListOrganizationAdminAccountsPaginator.ts +++ b/clients/client-macie2/src/pagination/ListOrganizationAdminAccountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: ListOrganizationAdminAccountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOrganizationAdminAccountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOrganizationAdminAccounts( +export const paginateListOrganizationAdminAccounts: ( config: Macie2PaginationConfiguration, input: ListOrganizationAdminAccountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOrganizationAdminAccountsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + ListOrganizationAdminAccountsCommandInput, + ListOrganizationAdminAccountsCommandOutput +>(Macie2Client, ListOrganizationAdminAccountsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-macie2/src/pagination/ListResourceProfileArtifactsPaginator.ts b/clients/client-macie2/src/pagination/ListResourceProfileArtifactsPaginator.ts index ea72f0365ad3..86d78a5648fa 100644 --- a/clients/client-macie2/src/pagination/ListResourceProfileArtifactsPaginator.ts +++ b/clients/client-macie2/src/pagination/ListResourceProfileArtifactsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: ListResourceProfileArtifactsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourceProfileArtifactsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourceProfileArtifacts( +export const paginateListResourceProfileArtifacts: ( config: Macie2PaginationConfiguration, input: ListResourceProfileArtifactsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourceProfileArtifactsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + ListResourceProfileArtifactsCommandInput, + ListResourceProfileArtifactsCommandOutput +>(Macie2Client, ListResourceProfileArtifactsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-macie2/src/pagination/ListResourceProfileDetectionsPaginator.ts b/clients/client-macie2/src/pagination/ListResourceProfileDetectionsPaginator.ts index 3664b0c86bc7..22207963112d 100644 --- a/clients/client-macie2/src/pagination/ListResourceProfileDetectionsPaginator.ts +++ b/clients/client-macie2/src/pagination/ListResourceProfileDetectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: ListResourceProfileDetectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourceProfileDetectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourceProfileDetections( +export const paginateListResourceProfileDetections: ( config: Macie2PaginationConfiguration, input: ListResourceProfileDetectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourceProfileDetectionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + ListResourceProfileDetectionsCommandInput, + ListResourceProfileDetectionsCommandOutput +>(Macie2Client, ListResourceProfileDetectionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-macie2/src/pagination/ListSensitivityInspectionTemplatesPaginator.ts b/clients/client-macie2/src/pagination/ListSensitivityInspectionTemplatesPaginator.ts index 23232dbd027b..835364905c28 100644 --- a/clients/client-macie2/src/pagination/ListSensitivityInspectionTemplatesPaginator.ts +++ b/clients/client-macie2/src/pagination/ListSensitivityInspectionTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: ListSensitivityInspectionTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSensitivityInspectionTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSensitivityInspectionTemplates( +export const paginateListSensitivityInspectionTemplates: ( config: Macie2PaginationConfiguration, input: ListSensitivityInspectionTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSensitivityInspectionTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + ListSensitivityInspectionTemplatesCommandInput, + ListSensitivityInspectionTemplatesCommandOutput +>(Macie2Client, ListSensitivityInspectionTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-macie2/src/pagination/SearchResourcesPaginator.ts b/clients/client-macie2/src/pagination/SearchResourcesPaginator.ts index 2dc20ed85f3e..0f6d95165054 100644 --- a/clients/client-macie2/src/pagination/SearchResourcesPaginator.ts +++ b/clients/client-macie2/src/pagination/SearchResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Macie2Client } from "../Macie2Client"; import { Macie2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Macie2Client, - input: SearchResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchResources( +export const paginateSearchResources: ( config: Macie2PaginationConfiguration, input: SearchResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof Macie2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Macie2 | Macie2Client"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Macie2PaginationConfiguration, + SearchResourcesCommandInput, + SearchResourcesCommandOutput +>(Macie2Client, SearchResourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-managedblockchain-query/src/pagination/ListAssetContractsPaginator.ts b/clients/client-managedblockchain-query/src/pagination/ListAssetContractsPaginator.ts index 2537a8cb2948..78e9f278142c 100644 --- a/clients/client-managedblockchain-query/src/pagination/ListAssetContractsPaginator.ts +++ b/clients/client-managedblockchain-query/src/pagination/ListAssetContractsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ManagedBlockchainQueryClient } from "../ManagedBlockchainQueryClient"; import { ManagedBlockchainQueryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ManagedBlockchainQueryClient, - input: ListAssetContractsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssetContractsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssetContracts( +export const paginateListAssetContracts: ( config: ManagedBlockchainQueryPaginationConfiguration, input: ListAssetContractsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssetContractsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ManagedBlockchainQueryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ManagedBlockchainQuery | ManagedBlockchainQueryClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ManagedBlockchainQueryPaginationConfiguration, + ListAssetContractsCommandInput, + ListAssetContractsCommandOutput +>(ManagedBlockchainQueryClient, ListAssetContractsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-managedblockchain-query/src/pagination/ListTokenBalancesPaginator.ts b/clients/client-managedblockchain-query/src/pagination/ListTokenBalancesPaginator.ts index fa86e4428fd4..c41868f79920 100644 --- a/clients/client-managedblockchain-query/src/pagination/ListTokenBalancesPaginator.ts +++ b/clients/client-managedblockchain-query/src/pagination/ListTokenBalancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ManagedBlockchainQueryClient } from "../ManagedBlockchainQueryClient"; import { ManagedBlockchainQueryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ManagedBlockchainQueryClient, - input: ListTokenBalancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTokenBalancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTokenBalances( +export const paginateListTokenBalances: ( config: ManagedBlockchainQueryPaginationConfiguration, input: ListTokenBalancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTokenBalancesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ManagedBlockchainQueryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ManagedBlockchainQuery | ManagedBlockchainQueryClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ManagedBlockchainQueryPaginationConfiguration, + ListTokenBalancesCommandInput, + ListTokenBalancesCommandOutput +>(ManagedBlockchainQueryClient, ListTokenBalancesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-managedblockchain-query/src/pagination/ListTransactionEventsPaginator.ts b/clients/client-managedblockchain-query/src/pagination/ListTransactionEventsPaginator.ts index fe0a1e07905c..2538b63049e0 100644 --- a/clients/client-managedblockchain-query/src/pagination/ListTransactionEventsPaginator.ts +++ b/clients/client-managedblockchain-query/src/pagination/ListTransactionEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ManagedBlockchainQueryClient } from "../ManagedBlockchainQueryClient"; import { ManagedBlockchainQueryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ManagedBlockchainQueryClient, - input: ListTransactionEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTransactionEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTransactionEvents( +export const paginateListTransactionEvents: ( config: ManagedBlockchainQueryPaginationConfiguration, input: ListTransactionEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTransactionEventsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ManagedBlockchainQueryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ManagedBlockchainQuery | ManagedBlockchainQueryClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ManagedBlockchainQueryPaginationConfiguration, + ListTransactionEventsCommandInput, + ListTransactionEventsCommandOutput +>(ManagedBlockchainQueryClient, ListTransactionEventsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-managedblockchain-query/src/pagination/ListTransactionsPaginator.ts b/clients/client-managedblockchain-query/src/pagination/ListTransactionsPaginator.ts index 09a3d5e9528a..41c6d1faca74 100644 --- a/clients/client-managedblockchain-query/src/pagination/ListTransactionsPaginator.ts +++ b/clients/client-managedblockchain-query/src/pagination/ListTransactionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ManagedBlockchainQueryClient } from "../ManagedBlockchainQueryClient"; import { ManagedBlockchainQueryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ManagedBlockchainQueryClient, - input: ListTransactionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTransactionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTransactions( +export const paginateListTransactions: ( config: ManagedBlockchainQueryPaginationConfiguration, input: ListTransactionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTransactionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ManagedBlockchainQueryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ManagedBlockchainQuery | ManagedBlockchainQueryClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ManagedBlockchainQueryPaginationConfiguration, + ListTransactionsCommandInput, + ListTransactionsCommandOutput +>(ManagedBlockchainQueryClient, ListTransactionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-managedblockchain/src/pagination/ListAccessorsPaginator.ts b/clients/client-managedblockchain/src/pagination/ListAccessorsPaginator.ts index 232a437cf48c..a62ade801480 100644 --- a/clients/client-managedblockchain/src/pagination/ListAccessorsPaginator.ts +++ b/clients/client-managedblockchain/src/pagination/ListAccessorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ManagedBlockchainClient } from "../ManagedBlockchainClient"; import { ManagedBlockchainPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ManagedBlockchainClient, - input: ListAccessorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessors( +export const paginateListAccessors: ( config: ManagedBlockchainPaginationConfiguration, input: ListAccessorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ManagedBlockchainClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ManagedBlockchain | ManagedBlockchainClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ManagedBlockchainPaginationConfiguration, + ListAccessorsCommandInput, + ListAccessorsCommandOutput +>(ManagedBlockchainClient, ListAccessorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-managedblockchain/src/pagination/ListInvitationsPaginator.ts b/clients/client-managedblockchain/src/pagination/ListInvitationsPaginator.ts index fb115062147e..eb92859e4402 100644 --- a/clients/client-managedblockchain/src/pagination/ListInvitationsPaginator.ts +++ b/clients/client-managedblockchain/src/pagination/ListInvitationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ManagedBlockchainClient } from "../ManagedBlockchainClient"; import { ManagedBlockchainPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ManagedBlockchainClient, - input: ListInvitationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInvitationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInvitations( +export const paginateListInvitations: ( config: ManagedBlockchainPaginationConfiguration, input: ListInvitationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInvitationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ManagedBlockchainClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ManagedBlockchain | ManagedBlockchainClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ManagedBlockchainPaginationConfiguration, + ListInvitationsCommandInput, + ListInvitationsCommandOutput +>(ManagedBlockchainClient, ListInvitationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-managedblockchain/src/pagination/ListMembersPaginator.ts b/clients/client-managedblockchain/src/pagination/ListMembersPaginator.ts index a0def0427e2f..7216918d04b5 100644 --- a/clients/client-managedblockchain/src/pagination/ListMembersPaginator.ts +++ b/clients/client-managedblockchain/src/pagination/ListMembersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListMembersCommand, ListMembersCommandInput, ListMembersCommandOutput } from "../commands/ListMembersCommand"; import { ManagedBlockchainClient } from "../ManagedBlockchainClient"; import { ManagedBlockchainPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ManagedBlockchainClient, - input: ListMembersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMembersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMembers( +export const paginateListMembers: ( config: ManagedBlockchainPaginationConfiguration, input: ListMembersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMembersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ManagedBlockchainClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ManagedBlockchain | ManagedBlockchainClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ManagedBlockchainPaginationConfiguration, + ListMembersCommandInput, + ListMembersCommandOutput +>(ManagedBlockchainClient, ListMembersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-managedblockchain/src/pagination/ListNetworksPaginator.ts b/clients/client-managedblockchain/src/pagination/ListNetworksPaginator.ts index a3b3dac8f992..c0eec6ea69a2 100644 --- a/clients/client-managedblockchain/src/pagination/ListNetworksPaginator.ts +++ b/clients/client-managedblockchain/src/pagination/ListNetworksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ManagedBlockchainClient } from "../ManagedBlockchainClient"; import { ManagedBlockchainPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ManagedBlockchainClient, - input: ListNetworksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNetworksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNetworks( +export const paginateListNetworks: ( config: ManagedBlockchainPaginationConfiguration, input: ListNetworksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNetworksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ManagedBlockchainClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ManagedBlockchain | ManagedBlockchainClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ManagedBlockchainPaginationConfiguration, + ListNetworksCommandInput, + ListNetworksCommandOutput +>(ManagedBlockchainClient, ListNetworksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-managedblockchain/src/pagination/ListNodesPaginator.ts b/clients/client-managedblockchain/src/pagination/ListNodesPaginator.ts index 69cea5559d1a..59899cfcc0e0 100644 --- a/clients/client-managedblockchain/src/pagination/ListNodesPaginator.ts +++ b/clients/client-managedblockchain/src/pagination/ListNodesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListNodesCommand, ListNodesCommandInput, ListNodesCommandOutput } from "../commands/ListNodesCommand"; import { ManagedBlockchainClient } from "../ManagedBlockchainClient"; import { ManagedBlockchainPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ManagedBlockchainClient, - input: ListNodesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNodesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNodes( +export const paginateListNodes: ( config: ManagedBlockchainPaginationConfiguration, input: ListNodesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNodesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ManagedBlockchainClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ManagedBlockchain | ManagedBlockchainClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ManagedBlockchainPaginationConfiguration, + ListNodesCommandInput, + ListNodesCommandOutput +>(ManagedBlockchainClient, ListNodesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-managedblockchain/src/pagination/ListProposalVotesPaginator.ts b/clients/client-managedblockchain/src/pagination/ListProposalVotesPaginator.ts index fd563695fa3b..b0aef69e070c 100644 --- a/clients/client-managedblockchain/src/pagination/ListProposalVotesPaginator.ts +++ b/clients/client-managedblockchain/src/pagination/ListProposalVotesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ManagedBlockchainClient } from "../ManagedBlockchainClient"; import { ManagedBlockchainPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ManagedBlockchainClient, - input: ListProposalVotesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProposalVotesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProposalVotes( +export const paginateListProposalVotes: ( config: ManagedBlockchainPaginationConfiguration, input: ListProposalVotesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProposalVotesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ManagedBlockchainClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ManagedBlockchain | ManagedBlockchainClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ManagedBlockchainPaginationConfiguration, + ListProposalVotesCommandInput, + ListProposalVotesCommandOutput +>(ManagedBlockchainClient, ListProposalVotesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-managedblockchain/src/pagination/ListProposalsPaginator.ts b/clients/client-managedblockchain/src/pagination/ListProposalsPaginator.ts index a05257500a85..b30dbe222a8c 100644 --- a/clients/client-managedblockchain/src/pagination/ListProposalsPaginator.ts +++ b/clients/client-managedblockchain/src/pagination/ListProposalsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ManagedBlockchainClient } from "../ManagedBlockchainClient"; import { ManagedBlockchainPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ManagedBlockchainClient, - input: ListProposalsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProposalsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProposals( +export const paginateListProposals: ( config: ManagedBlockchainPaginationConfiguration, input: ListProposalsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProposalsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ManagedBlockchainClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ManagedBlockchain | ManagedBlockchainClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ManagedBlockchainPaginationConfiguration, + ListProposalsCommandInput, + ListProposalsCommandOutput +>(ManagedBlockchainClient, ListProposalsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-marketplace-agreement/package.json b/clients/client-marketplace-agreement/package.json index 41374cea16d5..4d30b253c793 100644 --- a/clients/client-marketplace-agreement/package.json +++ b/clients/client-marketplace-agreement/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-marketplace-agreement/src/pagination/GetAgreementTermsPaginator.ts b/clients/client-marketplace-agreement/src/pagination/GetAgreementTermsPaginator.ts index 9fe2f21506f8..02d21b577db3 100644 --- a/clients/client-marketplace-agreement/src/pagination/GetAgreementTermsPaginator.ts +++ b/clients/client-marketplace-agreement/src/pagination/GetAgreementTermsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MarketplaceAgreementClient } from "../MarketplaceAgreementClient"; import { MarketplaceAgreementPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MarketplaceAgreementClient, - input: GetAgreementTermsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetAgreementTermsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetAgreementTerms( +export const paginateGetAgreementTerms: ( config: MarketplaceAgreementPaginationConfiguration, input: GetAgreementTermsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetAgreementTermsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MarketplaceAgreementClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MarketplaceAgreement | MarketplaceAgreementClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MarketplaceAgreementPaginationConfiguration, + GetAgreementTermsCommandInput, + GetAgreementTermsCommandOutput +>(MarketplaceAgreementClient, GetAgreementTermsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-marketplace-agreement/src/pagination/SearchAgreementsPaginator.ts b/clients/client-marketplace-agreement/src/pagination/SearchAgreementsPaginator.ts index 167c88986840..cc57abd1b899 100644 --- a/clients/client-marketplace-agreement/src/pagination/SearchAgreementsPaginator.ts +++ b/clients/client-marketplace-agreement/src/pagination/SearchAgreementsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MarketplaceAgreementClient } from "../MarketplaceAgreementClient"; import { MarketplaceAgreementPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MarketplaceAgreementClient, - input: SearchAgreementsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchAgreementsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchAgreements( +export const paginateSearchAgreements: ( config: MarketplaceAgreementPaginationConfiguration, input: SearchAgreementsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchAgreementsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MarketplaceAgreementClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MarketplaceAgreement | MarketplaceAgreementClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MarketplaceAgreementPaginationConfiguration, + SearchAgreementsCommandInput, + SearchAgreementsCommandOutput +>(MarketplaceAgreementClient, SearchAgreementsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-marketplace-catalog/src/pagination/ListChangeSetsPaginator.ts b/clients/client-marketplace-catalog/src/pagination/ListChangeSetsPaginator.ts index 38ca44d28710..cf0e292daa9b 100644 --- a/clients/client-marketplace-catalog/src/pagination/ListChangeSetsPaginator.ts +++ b/clients/client-marketplace-catalog/src/pagination/ListChangeSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MarketplaceCatalogClient } from "../MarketplaceCatalogClient"; import { MarketplaceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MarketplaceCatalogClient, - input: ListChangeSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChangeSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChangeSets( +export const paginateListChangeSets: ( config: MarketplaceCatalogPaginationConfiguration, input: ListChangeSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChangeSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MarketplaceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MarketplaceCatalog | MarketplaceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MarketplaceCatalogPaginationConfiguration, + ListChangeSetsCommandInput, + ListChangeSetsCommandOutput +>(MarketplaceCatalogClient, ListChangeSetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-marketplace-catalog/src/pagination/ListEntitiesPaginator.ts b/clients/client-marketplace-catalog/src/pagination/ListEntitiesPaginator.ts index 1745bf8601d7..953809e20d3d 100644 --- a/clients/client-marketplace-catalog/src/pagination/ListEntitiesPaginator.ts +++ b/clients/client-marketplace-catalog/src/pagination/ListEntitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MarketplaceCatalogClient } from "../MarketplaceCatalogClient"; import { MarketplaceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MarketplaceCatalogClient, - input: ListEntitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEntitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEntities( +export const paginateListEntities: ( config: MarketplaceCatalogPaginationConfiguration, input: ListEntitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEntitiesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MarketplaceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MarketplaceCatalog | MarketplaceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MarketplaceCatalogPaginationConfiguration, + ListEntitiesCommandInput, + ListEntitiesCommandOutput +>(MarketplaceCatalogClient, ListEntitiesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-marketplace-entitlement-service/package.json b/clients/client-marketplace-entitlement-service/package.json index 5ed2f8c26653..700ea6c0a379 100644 --- a/clients/client-marketplace-entitlement-service/package.json +++ b/clients/client-marketplace-entitlement-service/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-marketplace-entitlement-service/src/pagination/GetEntitlementsPaginator.ts b/clients/client-marketplace-entitlement-service/src/pagination/GetEntitlementsPaginator.ts index 1df2ba06f777..7a8d20789223 100644 --- a/clients/client-marketplace-entitlement-service/src/pagination/GetEntitlementsPaginator.ts +++ b/clients/client-marketplace-entitlement-service/src/pagination/GetEntitlementsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MarketplaceEntitlementServiceClient } from "../MarketplaceEntitlementServiceClient"; import { MarketplaceEntitlementServicePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MarketplaceEntitlementServiceClient, - input: GetEntitlementsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetEntitlementsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetEntitlements( +export const paginateGetEntitlements: ( config: MarketplaceEntitlementServicePaginationConfiguration, input: GetEntitlementsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetEntitlementsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MarketplaceEntitlementServiceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MarketplaceEntitlementService | MarketplaceEntitlementServiceClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MarketplaceEntitlementServicePaginationConfiguration, + GetEntitlementsCommandInput, + GetEntitlementsCommandOutput +>(MarketplaceEntitlementServiceClient, GetEntitlementsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediaconnect/src/pagination/ListBridgesPaginator.ts b/clients/client-mediaconnect/src/pagination/ListBridgesPaginator.ts index 16d85a4fd351..7f89b56f5f8c 100644 --- a/clients/client-mediaconnect/src/pagination/ListBridgesPaginator.ts +++ b/clients/client-mediaconnect/src/pagination/ListBridgesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListBridgesCommand, ListBridgesCommandInput, ListBridgesCommandOutput } from "../commands/ListBridgesCommand"; import { MediaConnectClient } from "../MediaConnectClient"; import { MediaConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaConnectClient, - input: ListBridgesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBridgesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBridges( +export const paginateListBridges: ( config: MediaConnectPaginationConfiguration, input: ListBridgesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBridgesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaConnect | MediaConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaConnectPaginationConfiguration, + ListBridgesCommandInput, + ListBridgesCommandOutput +>(MediaConnectClient, ListBridgesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediaconnect/src/pagination/ListEntitlementsPaginator.ts b/clients/client-mediaconnect/src/pagination/ListEntitlementsPaginator.ts index acc98c45ea2b..6f6268e99185 100644 --- a/clients/client-mediaconnect/src/pagination/ListEntitlementsPaginator.ts +++ b/clients/client-mediaconnect/src/pagination/ListEntitlementsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaConnectClient } from "../MediaConnectClient"; import { MediaConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaConnectClient, - input: ListEntitlementsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEntitlementsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEntitlements( +export const paginateListEntitlements: ( config: MediaConnectPaginationConfiguration, input: ListEntitlementsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEntitlementsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaConnect | MediaConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaConnectPaginationConfiguration, + ListEntitlementsCommandInput, + ListEntitlementsCommandOutput +>(MediaConnectClient, ListEntitlementsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediaconnect/src/pagination/ListFlowsPaginator.ts b/clients/client-mediaconnect/src/pagination/ListFlowsPaginator.ts index 31d633e33d19..6f20474eb63b 100644 --- a/clients/client-mediaconnect/src/pagination/ListFlowsPaginator.ts +++ b/clients/client-mediaconnect/src/pagination/ListFlowsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListFlowsCommand, ListFlowsCommandInput, ListFlowsCommandOutput } from "../commands/ListFlowsCommand"; import { MediaConnectClient } from "../MediaConnectClient"; import { MediaConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaConnectClient, - input: ListFlowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFlowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFlows( +export const paginateListFlows: ( config: MediaConnectPaginationConfiguration, input: ListFlowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFlowsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaConnect | MediaConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaConnectPaginationConfiguration, + ListFlowsCommandInput, + ListFlowsCommandOutput +>(MediaConnectClient, ListFlowsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediaconnect/src/pagination/ListGatewayInstancesPaginator.ts b/clients/client-mediaconnect/src/pagination/ListGatewayInstancesPaginator.ts index d64046882aaa..9363d7b7be83 100644 --- a/clients/client-mediaconnect/src/pagination/ListGatewayInstancesPaginator.ts +++ b/clients/client-mediaconnect/src/pagination/ListGatewayInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaConnectClient } from "../MediaConnectClient"; import { MediaConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaConnectClient, - input: ListGatewayInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGatewayInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGatewayInstances( +export const paginateListGatewayInstances: ( config: MediaConnectPaginationConfiguration, input: ListGatewayInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGatewayInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaConnect | MediaConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaConnectPaginationConfiguration, + ListGatewayInstancesCommandInput, + ListGatewayInstancesCommandOutput +>(MediaConnectClient, ListGatewayInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediaconnect/src/pagination/ListGatewaysPaginator.ts b/clients/client-mediaconnect/src/pagination/ListGatewaysPaginator.ts index 515d95a44e80..23d88b0f4bd6 100644 --- a/clients/client-mediaconnect/src/pagination/ListGatewaysPaginator.ts +++ b/clients/client-mediaconnect/src/pagination/ListGatewaysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaConnectClient } from "../MediaConnectClient"; import { MediaConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaConnectClient, - input: ListGatewaysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGatewaysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGateways( +export const paginateListGateways: ( config: MediaConnectPaginationConfiguration, input: ListGatewaysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGatewaysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaConnect | MediaConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaConnectPaginationConfiguration, + ListGatewaysCommandInput, + ListGatewaysCommandOutput +>(MediaConnectClient, ListGatewaysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediaconnect/src/pagination/ListOfferingsPaginator.ts b/clients/client-mediaconnect/src/pagination/ListOfferingsPaginator.ts index 6cd5ada8540e..3c89afa143bf 100644 --- a/clients/client-mediaconnect/src/pagination/ListOfferingsPaginator.ts +++ b/clients/client-mediaconnect/src/pagination/ListOfferingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaConnectClient } from "../MediaConnectClient"; import { MediaConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaConnectClient, - input: ListOfferingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOfferingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOfferings( +export const paginateListOfferings: ( config: MediaConnectPaginationConfiguration, input: ListOfferingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOfferingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaConnect | MediaConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaConnectPaginationConfiguration, + ListOfferingsCommandInput, + ListOfferingsCommandOutput +>(MediaConnectClient, ListOfferingsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediaconnect/src/pagination/ListReservationsPaginator.ts b/clients/client-mediaconnect/src/pagination/ListReservationsPaginator.ts index f44620d8fd6a..ac23e76d46f6 100644 --- a/clients/client-mediaconnect/src/pagination/ListReservationsPaginator.ts +++ b/clients/client-mediaconnect/src/pagination/ListReservationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaConnectClient } from "../MediaConnectClient"; import { MediaConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaConnectClient, - input: ListReservationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReservationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReservations( +export const paginateListReservations: ( config: MediaConnectPaginationConfiguration, input: ListReservationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReservationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaConnect | MediaConnectClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaConnectPaginationConfiguration, + ListReservationsCommandInput, + ListReservationsCommandOutput +>(MediaConnectClient, ListReservationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediaconvert/src/pagination/DescribeEndpointsPaginator.ts b/clients/client-mediaconvert/src/pagination/DescribeEndpointsPaginator.ts index 0bfc28fc0847..13cd53b742a2 100644 --- a/clients/client-mediaconvert/src/pagination/DescribeEndpointsPaginator.ts +++ b/clients/client-mediaconvert/src/pagination/DescribeEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaConvertClient } from "../MediaConvertClient"; import { MediaConvertPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaConvertClient, - input: DescribeEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEndpoints( +export const paginateDescribeEndpoints: ( config: MediaConvertPaginationConfiguration, input: DescribeEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaConvertClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaConvert | MediaConvertClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaConvertPaginationConfiguration, + DescribeEndpointsCommandInput, + DescribeEndpointsCommandOutput +>(MediaConvertClient, DescribeEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediaconvert/src/pagination/ListJobTemplatesPaginator.ts b/clients/client-mediaconvert/src/pagination/ListJobTemplatesPaginator.ts index 0d090756d280..a24f5a2802b3 100644 --- a/clients/client-mediaconvert/src/pagination/ListJobTemplatesPaginator.ts +++ b/clients/client-mediaconvert/src/pagination/ListJobTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaConvertClient } from "../MediaConvertClient"; import { MediaConvertPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaConvertClient, - input: ListJobTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobTemplates( +export const paginateListJobTemplates: ( config: MediaConvertPaginationConfiguration, input: ListJobTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobTemplatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaConvertClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaConvert | MediaConvertClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaConvertPaginationConfiguration, + ListJobTemplatesCommandInput, + ListJobTemplatesCommandOutput +>(MediaConvertClient, ListJobTemplatesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediaconvert/src/pagination/ListJobsPaginator.ts b/clients/client-mediaconvert/src/pagination/ListJobsPaginator.ts index d6a016c4c42a..7a5989f5106f 100644 --- a/clients/client-mediaconvert/src/pagination/ListJobsPaginator.ts +++ b/clients/client-mediaconvert/src/pagination/ListJobsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListJobsCommand, ListJobsCommandInput, ListJobsCommandOutput } from "../commands/ListJobsCommand"; import { MediaConvertClient } from "../MediaConvertClient"; import { MediaConvertPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaConvertClient, - input: ListJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobs( +export const paginateListJobs: ( config: MediaConvertPaginationConfiguration, input: ListJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaConvertClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaConvert | MediaConvertClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaConvertPaginationConfiguration, + ListJobsCommandInput, + ListJobsCommandOutput +>(MediaConvertClient, ListJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediaconvert/src/pagination/ListPresetsPaginator.ts b/clients/client-mediaconvert/src/pagination/ListPresetsPaginator.ts index dec9994fd0f0..4ab54c139386 100644 --- a/clients/client-mediaconvert/src/pagination/ListPresetsPaginator.ts +++ b/clients/client-mediaconvert/src/pagination/ListPresetsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListPresetsCommand, ListPresetsCommandInput, ListPresetsCommandOutput } from "../commands/ListPresetsCommand"; import { MediaConvertClient } from "../MediaConvertClient"; import { MediaConvertPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaConvertClient, - input: ListPresetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPresetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPresets( +export const paginateListPresets: ( config: MediaConvertPaginationConfiguration, input: ListPresetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPresetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaConvertClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaConvert | MediaConvertClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaConvertPaginationConfiguration, + ListPresetsCommandInput, + ListPresetsCommandOutput +>(MediaConvertClient, ListPresetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediaconvert/src/pagination/ListQueuesPaginator.ts b/clients/client-mediaconvert/src/pagination/ListQueuesPaginator.ts index b03973b259a5..97205a5d1522 100644 --- a/clients/client-mediaconvert/src/pagination/ListQueuesPaginator.ts +++ b/clients/client-mediaconvert/src/pagination/ListQueuesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListQueuesCommand, ListQueuesCommandInput, ListQueuesCommandOutput } from "../commands/ListQueuesCommand"; import { MediaConvertClient } from "../MediaConvertClient"; import { MediaConvertPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaConvertClient, - input: ListQueuesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListQueuesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListQueues( +export const paginateListQueues: ( config: MediaConvertPaginationConfiguration, input: ListQueuesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListQueuesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaConvertClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaConvert | MediaConvertClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaConvertPaginationConfiguration, + ListQueuesCommandInput, + ListQueuesCommandOutput +>(MediaConvertClient, ListQueuesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-medialive/src/pagination/DescribeSchedulePaginator.ts b/clients/client-medialive/src/pagination/DescribeSchedulePaginator.ts index 0075b9281df1..eb550aebb16d 100644 --- a/clients/client-medialive/src/pagination/DescribeSchedulePaginator.ts +++ b/clients/client-medialive/src/pagination/DescribeSchedulePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaLiveClient } from "../MediaLiveClient"; import { MediaLivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaLiveClient, - input: DescribeScheduleCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeScheduleCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSchedule( +export const paginateDescribeSchedule: ( config: MediaLivePaginationConfiguration, input: DescribeScheduleCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeScheduleCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaLiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaLive | MediaLiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaLivePaginationConfiguration, + DescribeScheduleCommandInput, + DescribeScheduleCommandOutput +>(MediaLiveClient, DescribeScheduleCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-medialive/src/pagination/ListChannelsPaginator.ts b/clients/client-medialive/src/pagination/ListChannelsPaginator.ts index 6668a9efe578..55d31c202827 100644 --- a/clients/client-medialive/src/pagination/ListChannelsPaginator.ts +++ b/clients/client-medialive/src/pagination/ListChannelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaLiveClient } from "../MediaLiveClient"; import { MediaLivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaLiveClient, - input: ListChannelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannels( +export const paginateListChannels: ( config: MediaLivePaginationConfiguration, input: ListChannelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaLiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaLive | MediaLiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaLivePaginationConfiguration, + ListChannelsCommandInput, + ListChannelsCommandOutput +>(MediaLiveClient, ListChannelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-medialive/src/pagination/ListInputDeviceTransfersPaginator.ts b/clients/client-medialive/src/pagination/ListInputDeviceTransfersPaginator.ts index 9233dd42a7d1..df459f45f20b 100644 --- a/clients/client-medialive/src/pagination/ListInputDeviceTransfersPaginator.ts +++ b/clients/client-medialive/src/pagination/ListInputDeviceTransfersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaLiveClient } from "../MediaLiveClient"; import { MediaLivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaLiveClient, - input: ListInputDeviceTransfersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInputDeviceTransfersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInputDeviceTransfers( +export const paginateListInputDeviceTransfers: ( config: MediaLivePaginationConfiguration, input: ListInputDeviceTransfersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInputDeviceTransfersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaLiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaLive | MediaLiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaLivePaginationConfiguration, + ListInputDeviceTransfersCommandInput, + ListInputDeviceTransfersCommandOutput +>(MediaLiveClient, ListInputDeviceTransfersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-medialive/src/pagination/ListInputDevicesPaginator.ts b/clients/client-medialive/src/pagination/ListInputDevicesPaginator.ts index c89572958b47..18bf1ddaac09 100644 --- a/clients/client-medialive/src/pagination/ListInputDevicesPaginator.ts +++ b/clients/client-medialive/src/pagination/ListInputDevicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaLiveClient } from "../MediaLiveClient"; import { MediaLivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaLiveClient, - input: ListInputDevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInputDevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInputDevices( +export const paginateListInputDevices: ( config: MediaLivePaginationConfiguration, input: ListInputDevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInputDevicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaLiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaLive | MediaLiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaLivePaginationConfiguration, + ListInputDevicesCommandInput, + ListInputDevicesCommandOutput +>(MediaLiveClient, ListInputDevicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-medialive/src/pagination/ListInputSecurityGroupsPaginator.ts b/clients/client-medialive/src/pagination/ListInputSecurityGroupsPaginator.ts index 7f2ed54c8f83..8171015e737a 100644 --- a/clients/client-medialive/src/pagination/ListInputSecurityGroupsPaginator.ts +++ b/clients/client-medialive/src/pagination/ListInputSecurityGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaLiveClient } from "../MediaLiveClient"; import { MediaLivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaLiveClient, - input: ListInputSecurityGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInputSecurityGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInputSecurityGroups( +export const paginateListInputSecurityGroups: ( config: MediaLivePaginationConfiguration, input: ListInputSecurityGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInputSecurityGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaLiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaLive | MediaLiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaLivePaginationConfiguration, + ListInputSecurityGroupsCommandInput, + ListInputSecurityGroupsCommandOutput +>(MediaLiveClient, ListInputSecurityGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-medialive/src/pagination/ListInputsPaginator.ts b/clients/client-medialive/src/pagination/ListInputsPaginator.ts index 6a3cc8c858f1..7a5558258fe2 100644 --- a/clients/client-medialive/src/pagination/ListInputsPaginator.ts +++ b/clients/client-medialive/src/pagination/ListInputsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListInputsCommand, ListInputsCommandInput, ListInputsCommandOutput } from "../commands/ListInputsCommand"; import { MediaLiveClient } from "../MediaLiveClient"; import { MediaLivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaLiveClient, - input: ListInputsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInputsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInputs( +export const paginateListInputs: ( config: MediaLivePaginationConfiguration, input: ListInputsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInputsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaLiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaLive | MediaLiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaLivePaginationConfiguration, + ListInputsCommandInput, + ListInputsCommandOutput +>(MediaLiveClient, ListInputsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-medialive/src/pagination/ListMultiplexProgramsPaginator.ts b/clients/client-medialive/src/pagination/ListMultiplexProgramsPaginator.ts index 2ed65d3373f9..d7faa51f595d 100644 --- a/clients/client-medialive/src/pagination/ListMultiplexProgramsPaginator.ts +++ b/clients/client-medialive/src/pagination/ListMultiplexProgramsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaLiveClient } from "../MediaLiveClient"; import { MediaLivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaLiveClient, - input: ListMultiplexProgramsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMultiplexProgramsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMultiplexPrograms( +export const paginateListMultiplexPrograms: ( config: MediaLivePaginationConfiguration, input: ListMultiplexProgramsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMultiplexProgramsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaLiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaLive | MediaLiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaLivePaginationConfiguration, + ListMultiplexProgramsCommandInput, + ListMultiplexProgramsCommandOutput +>(MediaLiveClient, ListMultiplexProgramsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-medialive/src/pagination/ListMultiplexesPaginator.ts b/clients/client-medialive/src/pagination/ListMultiplexesPaginator.ts index 7223ff950b1e..2e1a7b2b5f3c 100644 --- a/clients/client-medialive/src/pagination/ListMultiplexesPaginator.ts +++ b/clients/client-medialive/src/pagination/ListMultiplexesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaLiveClient } from "../MediaLiveClient"; import { MediaLivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaLiveClient, - input: ListMultiplexesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMultiplexesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMultiplexes( +export const paginateListMultiplexes: ( config: MediaLivePaginationConfiguration, input: ListMultiplexesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMultiplexesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaLiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaLive | MediaLiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaLivePaginationConfiguration, + ListMultiplexesCommandInput, + ListMultiplexesCommandOutput +>(MediaLiveClient, ListMultiplexesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-medialive/src/pagination/ListOfferingsPaginator.ts b/clients/client-medialive/src/pagination/ListOfferingsPaginator.ts index 100f41c278d6..607ee3b544f9 100644 --- a/clients/client-medialive/src/pagination/ListOfferingsPaginator.ts +++ b/clients/client-medialive/src/pagination/ListOfferingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaLiveClient } from "../MediaLiveClient"; import { MediaLivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaLiveClient, - input: ListOfferingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOfferingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOfferings( +export const paginateListOfferings: ( config: MediaLivePaginationConfiguration, input: ListOfferingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOfferingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaLiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaLive | MediaLiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaLivePaginationConfiguration, + ListOfferingsCommandInput, + ListOfferingsCommandOutput +>(MediaLiveClient, ListOfferingsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-medialive/src/pagination/ListReservationsPaginator.ts b/clients/client-medialive/src/pagination/ListReservationsPaginator.ts index b70c6918167f..abfe51d34fc3 100644 --- a/clients/client-medialive/src/pagination/ListReservationsPaginator.ts +++ b/clients/client-medialive/src/pagination/ListReservationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaLiveClient } from "../MediaLiveClient"; import { MediaLivePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaLiveClient, - input: ListReservationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReservationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReservations( +export const paginateListReservations: ( config: MediaLivePaginationConfiguration, input: ListReservationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReservationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaLiveClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaLive | MediaLiveClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaLivePaginationConfiguration, + ListReservationsCommandInput, + ListReservationsCommandOutput +>(MediaLiveClient, ListReservationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediapackage-vod/src/pagination/ListAssetsPaginator.ts b/clients/client-mediapackage-vod/src/pagination/ListAssetsPaginator.ts index fb18ce7a98f3..17750e8c8c6e 100644 --- a/clients/client-mediapackage-vod/src/pagination/ListAssetsPaginator.ts +++ b/clients/client-mediapackage-vod/src/pagination/ListAssetsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAssetsCommand, ListAssetsCommandInput, ListAssetsCommandOutput } from "../commands/ListAssetsCommand"; import { MediaPackageVodClient } from "../MediaPackageVodClient"; import { MediaPackageVodPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaPackageVodClient, - input: ListAssetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssets( +export const paginateListAssets: ( config: MediaPackageVodPaginationConfiguration, input: ListAssetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaPackageVodClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaPackageVod | MediaPackageVodClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaPackageVodPaginationConfiguration, + ListAssetsCommandInput, + ListAssetsCommandOutput +>(MediaPackageVodClient, ListAssetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediapackage-vod/src/pagination/ListPackagingConfigurationsPaginator.ts b/clients/client-mediapackage-vod/src/pagination/ListPackagingConfigurationsPaginator.ts index 8fc6193fb314..dccfd4b73226 100644 --- a/clients/client-mediapackage-vod/src/pagination/ListPackagingConfigurationsPaginator.ts +++ b/clients/client-mediapackage-vod/src/pagination/ListPackagingConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaPackageVodClient } from "../MediaPackageVodClient"; import { MediaPackageVodPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaPackageVodClient, - input: ListPackagingConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPackagingConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPackagingConfigurations( +export const paginateListPackagingConfigurations: ( config: MediaPackageVodPaginationConfiguration, input: ListPackagingConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPackagingConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaPackageVodClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaPackageVod | MediaPackageVodClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaPackageVodPaginationConfiguration, + ListPackagingConfigurationsCommandInput, + ListPackagingConfigurationsCommandOutput +>(MediaPackageVodClient, ListPackagingConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediapackage-vod/src/pagination/ListPackagingGroupsPaginator.ts b/clients/client-mediapackage-vod/src/pagination/ListPackagingGroupsPaginator.ts index 3734e5a805d0..f860bb131c5a 100644 --- a/clients/client-mediapackage-vod/src/pagination/ListPackagingGroupsPaginator.ts +++ b/clients/client-mediapackage-vod/src/pagination/ListPackagingGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaPackageVodClient } from "../MediaPackageVodClient"; import { MediaPackageVodPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaPackageVodClient, - input: ListPackagingGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPackagingGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPackagingGroups( +export const paginateListPackagingGroups: ( config: MediaPackageVodPaginationConfiguration, input: ListPackagingGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPackagingGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaPackageVodClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaPackageVod | MediaPackageVodClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaPackageVodPaginationConfiguration, + ListPackagingGroupsCommandInput, + ListPackagingGroupsCommandOutput +>(MediaPackageVodClient, ListPackagingGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediapackage/src/pagination/ListChannelsPaginator.ts b/clients/client-mediapackage/src/pagination/ListChannelsPaginator.ts index c3f860e6bac5..787595acddd3 100644 --- a/clients/client-mediapackage/src/pagination/ListChannelsPaginator.ts +++ b/clients/client-mediapackage/src/pagination/ListChannelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaPackageClient } from "../MediaPackageClient"; import { MediaPackagePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaPackageClient, - input: ListChannelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannels( +export const paginateListChannels: ( config: MediaPackagePaginationConfiguration, input: ListChannelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaPackageClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaPackage | MediaPackageClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaPackagePaginationConfiguration, + ListChannelsCommandInput, + ListChannelsCommandOutput +>(MediaPackageClient, ListChannelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediapackage/src/pagination/ListHarvestJobsPaginator.ts b/clients/client-mediapackage/src/pagination/ListHarvestJobsPaginator.ts index 45ca025fa756..c559fea131f6 100644 --- a/clients/client-mediapackage/src/pagination/ListHarvestJobsPaginator.ts +++ b/clients/client-mediapackage/src/pagination/ListHarvestJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaPackageClient } from "../MediaPackageClient"; import { MediaPackagePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaPackageClient, - input: ListHarvestJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHarvestJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHarvestJobs( +export const paginateListHarvestJobs: ( config: MediaPackagePaginationConfiguration, input: ListHarvestJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHarvestJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaPackageClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaPackage | MediaPackageClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaPackagePaginationConfiguration, + ListHarvestJobsCommandInput, + ListHarvestJobsCommandOutput +>(MediaPackageClient, ListHarvestJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediapackage/src/pagination/ListOriginEndpointsPaginator.ts b/clients/client-mediapackage/src/pagination/ListOriginEndpointsPaginator.ts index 215d5cb3b57f..4e18509ed48b 100644 --- a/clients/client-mediapackage/src/pagination/ListOriginEndpointsPaginator.ts +++ b/clients/client-mediapackage/src/pagination/ListOriginEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaPackageClient } from "../MediaPackageClient"; import { MediaPackagePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaPackageClient, - input: ListOriginEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOriginEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOriginEndpoints( +export const paginateListOriginEndpoints: ( config: MediaPackagePaginationConfiguration, input: ListOriginEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOriginEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaPackageClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaPackage | MediaPackageClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaPackagePaginationConfiguration, + ListOriginEndpointsCommandInput, + ListOriginEndpointsCommandOutput +>(MediaPackageClient, ListOriginEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediapackagev2/src/pagination/ListChannelGroupsPaginator.ts b/clients/client-mediapackagev2/src/pagination/ListChannelGroupsPaginator.ts index 86cc580954e6..de4c714cbc2d 100644 --- a/clients/client-mediapackagev2/src/pagination/ListChannelGroupsPaginator.ts +++ b/clients/client-mediapackagev2/src/pagination/ListChannelGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaPackageV2Client } from "../MediaPackageV2Client"; import { MediaPackageV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaPackageV2Client, - input: ListChannelGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannelGroups( +export const paginateListChannelGroups: ( config: MediaPackageV2PaginationConfiguration, input: ListChannelGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaPackageV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaPackageV2 | MediaPackageV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaPackageV2PaginationConfiguration, + ListChannelGroupsCommandInput, + ListChannelGroupsCommandOutput +>(MediaPackageV2Client, ListChannelGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediapackagev2/src/pagination/ListChannelsPaginator.ts b/clients/client-mediapackagev2/src/pagination/ListChannelsPaginator.ts index f75437f22957..04fbccbd4e93 100644 --- a/clients/client-mediapackagev2/src/pagination/ListChannelsPaginator.ts +++ b/clients/client-mediapackagev2/src/pagination/ListChannelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaPackageV2Client } from "../MediaPackageV2Client"; import { MediaPackageV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaPackageV2Client, - input: ListChannelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannels( +export const paginateListChannels: ( config: MediaPackageV2PaginationConfiguration, input: ListChannelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaPackageV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaPackageV2 | MediaPackageV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaPackageV2PaginationConfiguration, + ListChannelsCommandInput, + ListChannelsCommandOutput +>(MediaPackageV2Client, ListChannelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediapackagev2/src/pagination/ListOriginEndpointsPaginator.ts b/clients/client-mediapackagev2/src/pagination/ListOriginEndpointsPaginator.ts index fc79da06720a..1f4aaafd8c0a 100644 --- a/clients/client-mediapackagev2/src/pagination/ListOriginEndpointsPaginator.ts +++ b/clients/client-mediapackagev2/src/pagination/ListOriginEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaPackageV2Client } from "../MediaPackageV2Client"; import { MediaPackageV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaPackageV2Client, - input: ListOriginEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOriginEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOriginEndpoints( +export const paginateListOriginEndpoints: ( config: MediaPackageV2PaginationConfiguration, input: ListOriginEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOriginEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaPackageV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaPackageV2 | MediaPackageV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaPackageV2PaginationConfiguration, + ListOriginEndpointsCommandInput, + ListOriginEndpointsCommandOutput +>(MediaPackageV2Client, ListOriginEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediastore-data/src/pagination/ListItemsPaginator.ts b/clients/client-mediastore-data/src/pagination/ListItemsPaginator.ts index 6108e9623e6a..2a0e82278b1b 100644 --- a/clients/client-mediastore-data/src/pagination/ListItemsPaginator.ts +++ b/clients/client-mediastore-data/src/pagination/ListItemsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListItemsCommand, ListItemsCommandInput, ListItemsCommandOutput } from "../commands/ListItemsCommand"; import { MediaStoreDataClient } from "../MediaStoreDataClient"; import { MediaStoreDataPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaStoreDataClient, - input: ListItemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListItemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListItems( +export const paginateListItems: ( config: MediaStoreDataPaginationConfiguration, input: ListItemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListItemsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaStoreDataClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaStoreData | MediaStoreDataClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaStoreDataPaginationConfiguration, + ListItemsCommandInput, + ListItemsCommandOutput +>(MediaStoreDataClient, ListItemsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediastore/package.json b/clients/client-mediastore/package.json index f9a53769b9ae..f2f138a3b0f5 100644 --- a/clients/client-mediastore/package.json +++ b/clients/client-mediastore/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-mediastore/src/pagination/ListContainersPaginator.ts b/clients/client-mediastore/src/pagination/ListContainersPaginator.ts index a47e60481144..259002deea4f 100644 --- a/clients/client-mediastore/src/pagination/ListContainersPaginator.ts +++ b/clients/client-mediastore/src/pagination/ListContainersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaStoreClient } from "../MediaStoreClient"; import { MediaStorePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaStoreClient, - input: ListContainersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContainersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContainers( +export const paginateListContainers: ( config: MediaStorePaginationConfiguration, input: ListContainersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContainersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaStoreClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaStore | MediaStoreClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaStorePaginationConfiguration, + ListContainersCommandInput, + ListContainersCommandOutput +>(MediaStoreClient, ListContainersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediatailor/src/pagination/GetChannelSchedulePaginator.ts b/clients/client-mediatailor/src/pagination/GetChannelSchedulePaginator.ts index ab1071128744..91218c018b7f 100644 --- a/clients/client-mediatailor/src/pagination/GetChannelSchedulePaginator.ts +++ b/clients/client-mediatailor/src/pagination/GetChannelSchedulePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaTailorClient } from "../MediaTailorClient"; import { MediaTailorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaTailorClient, - input: GetChannelScheduleCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetChannelScheduleCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetChannelSchedule( +export const paginateGetChannelSchedule: ( config: MediaTailorPaginationConfiguration, input: GetChannelScheduleCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetChannelScheduleCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaTailorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaTailor | MediaTailorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaTailorPaginationConfiguration, + GetChannelScheduleCommandInput, + GetChannelScheduleCommandOutput +>(MediaTailorClient, GetChannelScheduleCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediatailor/src/pagination/ListAlertsPaginator.ts b/clients/client-mediatailor/src/pagination/ListAlertsPaginator.ts index 1aebff5d8205..d0038fdd36f6 100644 --- a/clients/client-mediatailor/src/pagination/ListAlertsPaginator.ts +++ b/clients/client-mediatailor/src/pagination/ListAlertsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAlertsCommand, ListAlertsCommandInput, ListAlertsCommandOutput } from "../commands/ListAlertsCommand"; import { MediaTailorClient } from "../MediaTailorClient"; import { MediaTailorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaTailorClient, - input: ListAlertsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAlertsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAlerts( +export const paginateListAlerts: ( config: MediaTailorPaginationConfiguration, input: ListAlertsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAlertsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaTailorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaTailor | MediaTailorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaTailorPaginationConfiguration, + ListAlertsCommandInput, + ListAlertsCommandOutput +>(MediaTailorClient, ListAlertsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediatailor/src/pagination/ListChannelsPaginator.ts b/clients/client-mediatailor/src/pagination/ListChannelsPaginator.ts index 41d748dda513..caa1504ad621 100644 --- a/clients/client-mediatailor/src/pagination/ListChannelsPaginator.ts +++ b/clients/client-mediatailor/src/pagination/ListChannelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaTailorClient } from "../MediaTailorClient"; import { MediaTailorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaTailorClient, - input: ListChannelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChannelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChannels( +export const paginateListChannels: ( config: MediaTailorPaginationConfiguration, input: ListChannelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChannelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaTailorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaTailor | MediaTailorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaTailorPaginationConfiguration, + ListChannelsCommandInput, + ListChannelsCommandOutput +>(MediaTailorClient, ListChannelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediatailor/src/pagination/ListLiveSourcesPaginator.ts b/clients/client-mediatailor/src/pagination/ListLiveSourcesPaginator.ts index d16a8bdd6aa1..6b8d0321b9b8 100644 --- a/clients/client-mediatailor/src/pagination/ListLiveSourcesPaginator.ts +++ b/clients/client-mediatailor/src/pagination/ListLiveSourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaTailorClient } from "../MediaTailorClient"; import { MediaTailorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaTailorClient, - input: ListLiveSourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLiveSourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLiveSources( +export const paginateListLiveSources: ( config: MediaTailorPaginationConfiguration, input: ListLiveSourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLiveSourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaTailorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaTailor | MediaTailorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaTailorPaginationConfiguration, + ListLiveSourcesCommandInput, + ListLiveSourcesCommandOutput +>(MediaTailorClient, ListLiveSourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediatailor/src/pagination/ListPlaybackConfigurationsPaginator.ts b/clients/client-mediatailor/src/pagination/ListPlaybackConfigurationsPaginator.ts index a61c2fce6757..25fe1315c260 100644 --- a/clients/client-mediatailor/src/pagination/ListPlaybackConfigurationsPaginator.ts +++ b/clients/client-mediatailor/src/pagination/ListPlaybackConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaTailorClient } from "../MediaTailorClient"; import { MediaTailorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaTailorClient, - input: ListPlaybackConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPlaybackConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPlaybackConfigurations( +export const paginateListPlaybackConfigurations: ( config: MediaTailorPaginationConfiguration, input: ListPlaybackConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPlaybackConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaTailorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaTailor | MediaTailorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaTailorPaginationConfiguration, + ListPlaybackConfigurationsCommandInput, + ListPlaybackConfigurationsCommandOutput +>(MediaTailorClient, ListPlaybackConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediatailor/src/pagination/ListPrefetchSchedulesPaginator.ts b/clients/client-mediatailor/src/pagination/ListPrefetchSchedulesPaginator.ts index 38382533f539..7b1d75059020 100644 --- a/clients/client-mediatailor/src/pagination/ListPrefetchSchedulesPaginator.ts +++ b/clients/client-mediatailor/src/pagination/ListPrefetchSchedulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaTailorClient } from "../MediaTailorClient"; import { MediaTailorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaTailorClient, - input: ListPrefetchSchedulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPrefetchSchedulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPrefetchSchedules( +export const paginateListPrefetchSchedules: ( config: MediaTailorPaginationConfiguration, input: ListPrefetchSchedulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPrefetchSchedulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaTailorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaTailor | MediaTailorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaTailorPaginationConfiguration, + ListPrefetchSchedulesCommandInput, + ListPrefetchSchedulesCommandOutput +>(MediaTailorClient, ListPrefetchSchedulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediatailor/src/pagination/ListSourceLocationsPaginator.ts b/clients/client-mediatailor/src/pagination/ListSourceLocationsPaginator.ts index 89d623797941..8b5ad3c495aa 100644 --- a/clients/client-mediatailor/src/pagination/ListSourceLocationsPaginator.ts +++ b/clients/client-mediatailor/src/pagination/ListSourceLocationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaTailorClient } from "../MediaTailorClient"; import { MediaTailorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaTailorClient, - input: ListSourceLocationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSourceLocationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSourceLocations( +export const paginateListSourceLocations: ( config: MediaTailorPaginationConfiguration, input: ListSourceLocationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSourceLocationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaTailorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaTailor | MediaTailorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaTailorPaginationConfiguration, + ListSourceLocationsCommandInput, + ListSourceLocationsCommandOutput +>(MediaTailorClient, ListSourceLocationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mediatailor/src/pagination/ListVodSourcesPaginator.ts b/clients/client-mediatailor/src/pagination/ListVodSourcesPaginator.ts index 7cb71ecb9357..4c0caba17f07 100644 --- a/clients/client-mediatailor/src/pagination/ListVodSourcesPaginator.ts +++ b/clients/client-mediatailor/src/pagination/ListVodSourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MediaTailorClient } from "../MediaTailorClient"; import { MediaTailorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MediaTailorClient, - input: ListVodSourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVodSourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVodSources( +export const paginateListVodSources: ( config: MediaTailorPaginationConfiguration, input: ListVodSourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVodSourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MediaTailorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MediaTailor | MediaTailorClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MediaTailorPaginationConfiguration, + ListVodSourcesCommandInput, + ListVodSourcesCommandOutput +>(MediaTailorClient, ListVodSourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-medical-imaging/src/pagination/ListDICOMImportJobsPaginator.ts b/clients/client-medical-imaging/src/pagination/ListDICOMImportJobsPaginator.ts index 8d300d7e06e6..0db5c5b859b4 100644 --- a/clients/client-medical-imaging/src/pagination/ListDICOMImportJobsPaginator.ts +++ b/clients/client-medical-imaging/src/pagination/ListDICOMImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MedicalImagingClient } from "../MedicalImagingClient"; import { MedicalImagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MedicalImagingClient, - input: ListDICOMImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDICOMImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDICOMImportJobs( +export const paginateListDICOMImportJobs: ( config: MedicalImagingPaginationConfiguration, input: ListDICOMImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDICOMImportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MedicalImagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MedicalImaging | MedicalImagingClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MedicalImagingPaginationConfiguration, + ListDICOMImportJobsCommandInput, + ListDICOMImportJobsCommandOutput +>(MedicalImagingClient, ListDICOMImportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-medical-imaging/src/pagination/ListDatastoresPaginator.ts b/clients/client-medical-imaging/src/pagination/ListDatastoresPaginator.ts index ba90dd018104..1be6693a41be 100644 --- a/clients/client-medical-imaging/src/pagination/ListDatastoresPaginator.ts +++ b/clients/client-medical-imaging/src/pagination/ListDatastoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MedicalImagingClient } from "../MedicalImagingClient"; import { MedicalImagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MedicalImagingClient, - input: ListDatastoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatastoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatastores( +export const paginateListDatastores: ( config: MedicalImagingPaginationConfiguration, input: ListDatastoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatastoresCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MedicalImagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MedicalImaging | MedicalImagingClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MedicalImagingPaginationConfiguration, + ListDatastoresCommandInput, + ListDatastoresCommandOutput +>(MedicalImagingClient, ListDatastoresCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-medical-imaging/src/pagination/ListImageSetVersionsPaginator.ts b/clients/client-medical-imaging/src/pagination/ListImageSetVersionsPaginator.ts index 121b80ba6872..7ae6cfaf0f2a 100644 --- a/clients/client-medical-imaging/src/pagination/ListImageSetVersionsPaginator.ts +++ b/clients/client-medical-imaging/src/pagination/ListImageSetVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MedicalImagingClient } from "../MedicalImagingClient"; import { MedicalImagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MedicalImagingClient, - input: ListImageSetVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImageSetVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImageSetVersions( +export const paginateListImageSetVersions: ( config: MedicalImagingPaginationConfiguration, input: ListImageSetVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImageSetVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MedicalImagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MedicalImaging | MedicalImagingClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MedicalImagingPaginationConfiguration, + ListImageSetVersionsCommandInput, + ListImageSetVersionsCommandOutput +>(MedicalImagingClient, ListImageSetVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-medical-imaging/src/pagination/SearchImageSetsPaginator.ts b/clients/client-medical-imaging/src/pagination/SearchImageSetsPaginator.ts index 3ba9b1f0477e..2e14098b5138 100644 --- a/clients/client-medical-imaging/src/pagination/SearchImageSetsPaginator.ts +++ b/clients/client-medical-imaging/src/pagination/SearchImageSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MedicalImagingClient } from "../MedicalImagingClient"; import { MedicalImagingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MedicalImagingClient, - input: SearchImageSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchImageSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchImageSets( +export const paginateSearchImageSets: ( config: MedicalImagingPaginationConfiguration, input: SearchImageSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchImageSetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MedicalImagingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MedicalImaging | MedicalImagingClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MedicalImagingPaginationConfiguration, + SearchImageSetsCommandInput, + SearchImageSetsCommandOutput +>(MedicalImagingClient, SearchImageSetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-memorydb/package.json b/clients/client-memorydb/package.json index 17f06a6c8629..1edf603206d4 100644 --- a/clients/client-memorydb/package.json +++ b/clients/client-memorydb/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-memorydb/src/pagination/DescribeACLsPaginator.ts b/clients/client-memorydb/src/pagination/DescribeACLsPaginator.ts index f2657828643e..19b4127b777e 100644 --- a/clients/client-memorydb/src/pagination/DescribeACLsPaginator.ts +++ b/clients/client-memorydb/src/pagination/DescribeACLsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MemoryDBClient } from "../MemoryDBClient"; import { MemoryDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MemoryDBClient, - input: DescribeACLsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeACLsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeACLs( +export const paginateDescribeACLs: ( config: MemoryDBPaginationConfiguration, input: DescribeACLsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeACLsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MemoryDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MemoryDB | MemoryDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MemoryDBPaginationConfiguration, + DescribeACLsCommandInput, + DescribeACLsCommandOutput +>(MemoryDBClient, DescribeACLsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-memorydb/src/pagination/DescribeClustersPaginator.ts b/clients/client-memorydb/src/pagination/DescribeClustersPaginator.ts index dc98819163ae..de121c431a3f 100644 --- a/clients/client-memorydb/src/pagination/DescribeClustersPaginator.ts +++ b/clients/client-memorydb/src/pagination/DescribeClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MemoryDBClient } from "../MemoryDBClient"; import { MemoryDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MemoryDBClient, - input: DescribeClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClusters( +export const paginateDescribeClusters: ( config: MemoryDBPaginationConfiguration, input: DescribeClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClustersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MemoryDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MemoryDB | MemoryDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MemoryDBPaginationConfiguration, + DescribeClustersCommandInput, + DescribeClustersCommandOutput +>(MemoryDBClient, DescribeClustersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-memorydb/src/pagination/DescribeEngineVersionsPaginator.ts b/clients/client-memorydb/src/pagination/DescribeEngineVersionsPaginator.ts index adc9622cdf0b..be91d9ea2572 100644 --- a/clients/client-memorydb/src/pagination/DescribeEngineVersionsPaginator.ts +++ b/clients/client-memorydb/src/pagination/DescribeEngineVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MemoryDBClient } from "../MemoryDBClient"; import { MemoryDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MemoryDBClient, - input: DescribeEngineVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEngineVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEngineVersions( +export const paginateDescribeEngineVersions: ( config: MemoryDBPaginationConfiguration, input: DescribeEngineVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEngineVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MemoryDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MemoryDB | MemoryDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MemoryDBPaginationConfiguration, + DescribeEngineVersionsCommandInput, + DescribeEngineVersionsCommandOutput +>(MemoryDBClient, DescribeEngineVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-memorydb/src/pagination/DescribeEventsPaginator.ts b/clients/client-memorydb/src/pagination/DescribeEventsPaginator.ts index f79cef6eadce..81f9eda12989 100644 --- a/clients/client-memorydb/src/pagination/DescribeEventsPaginator.ts +++ b/clients/client-memorydb/src/pagination/DescribeEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MemoryDBClient } from "../MemoryDBClient"; import { MemoryDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MemoryDBClient, - input: DescribeEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEvents( +export const paginateDescribeEvents: ( config: MemoryDBPaginationConfiguration, input: DescribeEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MemoryDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MemoryDB | MemoryDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MemoryDBPaginationConfiguration, + DescribeEventsCommandInput, + DescribeEventsCommandOutput +>(MemoryDBClient, DescribeEventsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-memorydb/src/pagination/DescribeParameterGroupsPaginator.ts b/clients/client-memorydb/src/pagination/DescribeParameterGroupsPaginator.ts index 8bea75edbb03..9bb86b4becdb 100644 --- a/clients/client-memorydb/src/pagination/DescribeParameterGroupsPaginator.ts +++ b/clients/client-memorydb/src/pagination/DescribeParameterGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MemoryDBClient } from "../MemoryDBClient"; import { MemoryDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MemoryDBClient, - input: DescribeParameterGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeParameterGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeParameterGroups( +export const paginateDescribeParameterGroups: ( config: MemoryDBPaginationConfiguration, input: DescribeParameterGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeParameterGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MemoryDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MemoryDB | MemoryDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MemoryDBPaginationConfiguration, + DescribeParameterGroupsCommandInput, + DescribeParameterGroupsCommandOutput +>(MemoryDBClient, DescribeParameterGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-memorydb/src/pagination/DescribeParametersPaginator.ts b/clients/client-memorydb/src/pagination/DescribeParametersPaginator.ts index 0c948b4d42ca..4e2eaadb7c58 100644 --- a/clients/client-memorydb/src/pagination/DescribeParametersPaginator.ts +++ b/clients/client-memorydb/src/pagination/DescribeParametersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MemoryDBClient } from "../MemoryDBClient"; import { MemoryDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MemoryDBClient, - input: DescribeParametersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeParametersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeParameters( +export const paginateDescribeParameters: ( config: MemoryDBPaginationConfiguration, input: DescribeParametersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeParametersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MemoryDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MemoryDB | MemoryDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MemoryDBPaginationConfiguration, + DescribeParametersCommandInput, + DescribeParametersCommandOutput +>(MemoryDBClient, DescribeParametersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-memorydb/src/pagination/DescribeReservedNodesOfferingsPaginator.ts b/clients/client-memorydb/src/pagination/DescribeReservedNodesOfferingsPaginator.ts index 8c33fee844fa..b063d8dd6625 100644 --- a/clients/client-memorydb/src/pagination/DescribeReservedNodesOfferingsPaginator.ts +++ b/clients/client-memorydb/src/pagination/DescribeReservedNodesOfferingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MemoryDBClient } from "../MemoryDBClient"; import { MemoryDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MemoryDBClient, - input: DescribeReservedNodesOfferingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedNodesOfferingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedNodesOfferings( +export const paginateDescribeReservedNodesOfferings: ( config: MemoryDBPaginationConfiguration, input: DescribeReservedNodesOfferingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedNodesOfferingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MemoryDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MemoryDB | MemoryDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MemoryDBPaginationConfiguration, + DescribeReservedNodesOfferingsCommandInput, + DescribeReservedNodesOfferingsCommandOutput +>(MemoryDBClient, DescribeReservedNodesOfferingsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-memorydb/src/pagination/DescribeReservedNodesPaginator.ts b/clients/client-memorydb/src/pagination/DescribeReservedNodesPaginator.ts index 655b78c4f555..190a89bc0bff 100644 --- a/clients/client-memorydb/src/pagination/DescribeReservedNodesPaginator.ts +++ b/clients/client-memorydb/src/pagination/DescribeReservedNodesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MemoryDBClient } from "../MemoryDBClient"; import { MemoryDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MemoryDBClient, - input: DescribeReservedNodesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedNodesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedNodes( +export const paginateDescribeReservedNodes: ( config: MemoryDBPaginationConfiguration, input: DescribeReservedNodesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedNodesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MemoryDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MemoryDB | MemoryDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MemoryDBPaginationConfiguration, + DescribeReservedNodesCommandInput, + DescribeReservedNodesCommandOutput +>(MemoryDBClient, DescribeReservedNodesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-memorydb/src/pagination/DescribeServiceUpdatesPaginator.ts b/clients/client-memorydb/src/pagination/DescribeServiceUpdatesPaginator.ts index 845d8ad8a29c..920485969901 100644 --- a/clients/client-memorydb/src/pagination/DescribeServiceUpdatesPaginator.ts +++ b/clients/client-memorydb/src/pagination/DescribeServiceUpdatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MemoryDBClient } from "../MemoryDBClient"; import { MemoryDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MemoryDBClient, - input: DescribeServiceUpdatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeServiceUpdatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeServiceUpdates( +export const paginateDescribeServiceUpdates: ( config: MemoryDBPaginationConfiguration, input: DescribeServiceUpdatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeServiceUpdatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MemoryDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MemoryDB | MemoryDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MemoryDBPaginationConfiguration, + DescribeServiceUpdatesCommandInput, + DescribeServiceUpdatesCommandOutput +>(MemoryDBClient, DescribeServiceUpdatesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-memorydb/src/pagination/DescribeSnapshotsPaginator.ts b/clients/client-memorydb/src/pagination/DescribeSnapshotsPaginator.ts index 6726ed03855d..3fc5d77dba1a 100644 --- a/clients/client-memorydb/src/pagination/DescribeSnapshotsPaginator.ts +++ b/clients/client-memorydb/src/pagination/DescribeSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MemoryDBClient } from "../MemoryDBClient"; import { MemoryDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MemoryDBClient, - input: DescribeSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSnapshots( +export const paginateDescribeSnapshots: ( config: MemoryDBPaginationConfiguration, input: DescribeSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSnapshotsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MemoryDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MemoryDB | MemoryDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MemoryDBPaginationConfiguration, + DescribeSnapshotsCommandInput, + DescribeSnapshotsCommandOutput +>(MemoryDBClient, DescribeSnapshotsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-memorydb/src/pagination/DescribeSubnetGroupsPaginator.ts b/clients/client-memorydb/src/pagination/DescribeSubnetGroupsPaginator.ts index bd6b5af96cad..de4b0b6ad35e 100644 --- a/clients/client-memorydb/src/pagination/DescribeSubnetGroupsPaginator.ts +++ b/clients/client-memorydb/src/pagination/DescribeSubnetGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MemoryDBClient } from "../MemoryDBClient"; import { MemoryDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MemoryDBClient, - input: DescribeSubnetGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSubnetGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSubnetGroups( +export const paginateDescribeSubnetGroups: ( config: MemoryDBPaginationConfiguration, input: DescribeSubnetGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSubnetGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MemoryDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MemoryDB | MemoryDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MemoryDBPaginationConfiguration, + DescribeSubnetGroupsCommandInput, + DescribeSubnetGroupsCommandOutput +>(MemoryDBClient, DescribeSubnetGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-memorydb/src/pagination/DescribeUsersPaginator.ts b/clients/client-memorydb/src/pagination/DescribeUsersPaginator.ts index decacccddde6..e0db5c13b46e 100644 --- a/clients/client-memorydb/src/pagination/DescribeUsersPaginator.ts +++ b/clients/client-memorydb/src/pagination/DescribeUsersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MemoryDBClient } from "../MemoryDBClient"; import { MemoryDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MemoryDBClient, - input: DescribeUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeUsers( +export const paginateDescribeUsers: ( config: MemoryDBPaginationConfiguration, input: DescribeUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeUsersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MemoryDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MemoryDB | MemoryDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MemoryDBPaginationConfiguration, + DescribeUsersCommandInput, + DescribeUsersCommandOutput +>(MemoryDBClient, DescribeUsersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mgn/src/pagination/DescribeJobLogItemsPaginator.ts b/clients/client-mgn/src/pagination/DescribeJobLogItemsPaginator.ts index 4a23c5ed8d83..893aa306ad9c 100644 --- a/clients/client-mgn/src/pagination/DescribeJobLogItemsPaginator.ts +++ b/clients/client-mgn/src/pagination/DescribeJobLogItemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: DescribeJobLogItemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeJobLogItemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeJobLogItems( +export const paginateDescribeJobLogItems: ( config: MgnPaginationConfiguration, input: DescribeJobLogItemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeJobLogItemsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + DescribeJobLogItemsCommandInput, + DescribeJobLogItemsCommandOutput +>(MgnClient, DescribeJobLogItemsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/DescribeJobsPaginator.ts b/clients/client-mgn/src/pagination/DescribeJobsPaginator.ts index a07af59c765f..d382b1a0470e 100644 --- a/clients/client-mgn/src/pagination/DescribeJobsPaginator.ts +++ b/clients/client-mgn/src/pagination/DescribeJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: DescribeJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeJobs( +export const paginateDescribeJobs: ( config: MgnPaginationConfiguration, input: DescribeJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + DescribeJobsCommandInput, + DescribeJobsCommandOutput +>(MgnClient, DescribeJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/DescribeLaunchConfigurationTemplatesPaginator.ts b/clients/client-mgn/src/pagination/DescribeLaunchConfigurationTemplatesPaginator.ts index 36e53205bebd..4ca0ff63b58d 100644 --- a/clients/client-mgn/src/pagination/DescribeLaunchConfigurationTemplatesPaginator.ts +++ b/clients/client-mgn/src/pagination/DescribeLaunchConfigurationTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: DescribeLaunchConfigurationTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeLaunchConfigurationTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeLaunchConfigurationTemplates( +export const paginateDescribeLaunchConfigurationTemplates: ( config: MgnPaginationConfiguration, input: DescribeLaunchConfigurationTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeLaunchConfigurationTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + DescribeLaunchConfigurationTemplatesCommandInput, + DescribeLaunchConfigurationTemplatesCommandOutput +>(MgnClient, DescribeLaunchConfigurationTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/DescribeReplicationConfigurationTemplatesPaginator.ts b/clients/client-mgn/src/pagination/DescribeReplicationConfigurationTemplatesPaginator.ts index 0c0815ddb653..c006186d5dcb 100644 --- a/clients/client-mgn/src/pagination/DescribeReplicationConfigurationTemplatesPaginator.ts +++ b/clients/client-mgn/src/pagination/DescribeReplicationConfigurationTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: DescribeReplicationConfigurationTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReplicationConfigurationTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReplicationConfigurationTemplates( +export const paginateDescribeReplicationConfigurationTemplates: ( config: MgnPaginationConfiguration, input: DescribeReplicationConfigurationTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReplicationConfigurationTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + DescribeReplicationConfigurationTemplatesCommandInput, + DescribeReplicationConfigurationTemplatesCommandOutput +>(MgnClient, DescribeReplicationConfigurationTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/DescribeSourceServersPaginator.ts b/clients/client-mgn/src/pagination/DescribeSourceServersPaginator.ts index 576a89fd18c2..12242832ef3d 100644 --- a/clients/client-mgn/src/pagination/DescribeSourceServersPaginator.ts +++ b/clients/client-mgn/src/pagination/DescribeSourceServersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: DescribeSourceServersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSourceServersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSourceServers( +export const paginateDescribeSourceServers: ( config: MgnPaginationConfiguration, input: DescribeSourceServersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSourceServersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + DescribeSourceServersCommandInput, + DescribeSourceServersCommandOutput +>(MgnClient, DescribeSourceServersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/DescribeVcenterClientsPaginator.ts b/clients/client-mgn/src/pagination/DescribeVcenterClientsPaginator.ts index 2fd6eb81f57c..0cd4971e6640 100644 --- a/clients/client-mgn/src/pagination/DescribeVcenterClientsPaginator.ts +++ b/clients/client-mgn/src/pagination/DescribeVcenterClientsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: DescribeVcenterClientsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVcenterClientsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVcenterClients( +export const paginateDescribeVcenterClients: ( config: MgnPaginationConfiguration, input: DescribeVcenterClientsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVcenterClientsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + DescribeVcenterClientsCommandInput, + DescribeVcenterClientsCommandOutput +>(MgnClient, DescribeVcenterClientsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/ListApplicationsPaginator.ts b/clients/client-mgn/src/pagination/ListApplicationsPaginator.ts index d92e571394c4..f9955e191850 100644 --- a/clients/client-mgn/src/pagination/ListApplicationsPaginator.ts +++ b/clients/client-mgn/src/pagination/ListApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: ListApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplications( +export const paginateListApplications: ( config: MgnPaginationConfiguration, input: ListApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + ListApplicationsCommandInput, + ListApplicationsCommandOutput +>(MgnClient, ListApplicationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/ListConnectorsPaginator.ts b/clients/client-mgn/src/pagination/ListConnectorsPaginator.ts index 431e0221591d..469f0caeeb58 100644 --- a/clients/client-mgn/src/pagination/ListConnectorsPaginator.ts +++ b/clients/client-mgn/src/pagination/ListConnectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: ListConnectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConnectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConnectors( +export const paginateListConnectors: ( config: MgnPaginationConfiguration, input: ListConnectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConnectorsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + ListConnectorsCommandInput, + ListConnectorsCommandOutput +>(MgnClient, ListConnectorsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/ListExportErrorsPaginator.ts b/clients/client-mgn/src/pagination/ListExportErrorsPaginator.ts index fb5774d1aceb..821e21cd1ce0 100644 --- a/clients/client-mgn/src/pagination/ListExportErrorsPaginator.ts +++ b/clients/client-mgn/src/pagination/ListExportErrorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: ListExportErrorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExportErrorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExportErrors( +export const paginateListExportErrors: ( config: MgnPaginationConfiguration, input: ListExportErrorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExportErrorsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + ListExportErrorsCommandInput, + ListExportErrorsCommandOutput +>(MgnClient, ListExportErrorsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/ListExportsPaginator.ts b/clients/client-mgn/src/pagination/ListExportsPaginator.ts index 071a675bd6ea..38403ac275d5 100644 --- a/clients/client-mgn/src/pagination/ListExportsPaginator.ts +++ b/clients/client-mgn/src/pagination/ListExportsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListExportsCommand, ListExportsCommandInput, ListExportsCommandOutput } from "../commands/ListExportsCommand"; import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: ListExportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExports( +export const paginateListExports: ( config: MgnPaginationConfiguration, input: ListExportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExportsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + ListExportsCommandInput, + ListExportsCommandOutput +>(MgnClient, ListExportsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/ListImportErrorsPaginator.ts b/clients/client-mgn/src/pagination/ListImportErrorsPaginator.ts index e1d44665b44f..1c2bc2404897 100644 --- a/clients/client-mgn/src/pagination/ListImportErrorsPaginator.ts +++ b/clients/client-mgn/src/pagination/ListImportErrorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: ListImportErrorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImportErrorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImportErrors( +export const paginateListImportErrors: ( config: MgnPaginationConfiguration, input: ListImportErrorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImportErrorsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + ListImportErrorsCommandInput, + ListImportErrorsCommandOutput +>(MgnClient, ListImportErrorsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/ListImportsPaginator.ts b/clients/client-mgn/src/pagination/ListImportsPaginator.ts index ec903c1a5d00..6b349b2b82cd 100644 --- a/clients/client-mgn/src/pagination/ListImportsPaginator.ts +++ b/clients/client-mgn/src/pagination/ListImportsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListImportsCommand, ListImportsCommandInput, ListImportsCommandOutput } from "../commands/ListImportsCommand"; import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: ListImportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImports( +export const paginateListImports: ( config: MgnPaginationConfiguration, input: ListImportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImportsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + ListImportsCommandInput, + ListImportsCommandOutput +>(MgnClient, ListImportsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/ListManagedAccountsPaginator.ts b/clients/client-mgn/src/pagination/ListManagedAccountsPaginator.ts index 28e0a5908987..a1a760a6da07 100644 --- a/clients/client-mgn/src/pagination/ListManagedAccountsPaginator.ts +++ b/clients/client-mgn/src/pagination/ListManagedAccountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: ListManagedAccountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListManagedAccountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListManagedAccounts( +export const paginateListManagedAccounts: ( config: MgnPaginationConfiguration, input: ListManagedAccountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListManagedAccountsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + ListManagedAccountsCommandInput, + ListManagedAccountsCommandOutput +>(MgnClient, ListManagedAccountsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/ListSourceServerActionsPaginator.ts b/clients/client-mgn/src/pagination/ListSourceServerActionsPaginator.ts index 73ff12867010..ca5765581b0f 100644 --- a/clients/client-mgn/src/pagination/ListSourceServerActionsPaginator.ts +++ b/clients/client-mgn/src/pagination/ListSourceServerActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: ListSourceServerActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSourceServerActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSourceServerActions( +export const paginateListSourceServerActions: ( config: MgnPaginationConfiguration, input: ListSourceServerActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSourceServerActionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + ListSourceServerActionsCommandInput, + ListSourceServerActionsCommandOutput +>(MgnClient, ListSourceServerActionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/ListTemplateActionsPaginator.ts b/clients/client-mgn/src/pagination/ListTemplateActionsPaginator.ts index 3ec3140ee1f9..79b457ec01e0 100644 --- a/clients/client-mgn/src/pagination/ListTemplateActionsPaginator.ts +++ b/clients/client-mgn/src/pagination/ListTemplateActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: ListTemplateActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTemplateActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTemplateActions( +export const paginateListTemplateActions: ( config: MgnPaginationConfiguration, input: ListTemplateActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTemplateActionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + ListTemplateActionsCommandInput, + ListTemplateActionsCommandOutput +>(MgnClient, ListTemplateActionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mgn/src/pagination/ListWavesPaginator.ts b/clients/client-mgn/src/pagination/ListWavesPaginator.ts index 5bdb37917b5f..cee91bc70035 100644 --- a/clients/client-mgn/src/pagination/ListWavesPaginator.ts +++ b/clients/client-mgn/src/pagination/ListWavesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListWavesCommand, ListWavesCommandInput, ListWavesCommandOutput } from "../commands/ListWavesCommand"; import { MgnClient } from "../MgnClient"; import { MgnPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MgnClient, - input: ListWavesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWavesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWaves( +export const paginateListWaves: ( config: MgnPaginationConfiguration, input: ListWavesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWavesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MgnClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mgn | MgnClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MgnPaginationConfiguration, + ListWavesCommandInput, + ListWavesCommandOutput +>(MgnClient, ListWavesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-migration-hub-refactor-spaces/src/pagination/ListApplicationsPaginator.ts b/clients/client-migration-hub-refactor-spaces/src/pagination/ListApplicationsPaginator.ts index 7131372b875c..432859cb9823 100644 --- a/clients/client-migration-hub-refactor-spaces/src/pagination/ListApplicationsPaginator.ts +++ b/clients/client-migration-hub-refactor-spaces/src/pagination/ListApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubRefactorSpacesClient } from "../MigrationHubRefactorSpacesClient"; import { MigrationHubRefactorSpacesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubRefactorSpacesClient, - input: ListApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplications( +export const paginateListApplications: ( config: MigrationHubRefactorSpacesPaginationConfiguration, input: ListApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MigrationHubRefactorSpacesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubRefactorSpaces | MigrationHubRefactorSpacesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubRefactorSpacesPaginationConfiguration, + ListApplicationsCommandInput, + ListApplicationsCommandOutput +>(MigrationHubRefactorSpacesClient, ListApplicationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-migration-hub-refactor-spaces/src/pagination/ListEnvironmentVpcsPaginator.ts b/clients/client-migration-hub-refactor-spaces/src/pagination/ListEnvironmentVpcsPaginator.ts index 36280fd5e084..e5022ba0eb1a 100644 --- a/clients/client-migration-hub-refactor-spaces/src/pagination/ListEnvironmentVpcsPaginator.ts +++ b/clients/client-migration-hub-refactor-spaces/src/pagination/ListEnvironmentVpcsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubRefactorSpacesClient } from "../MigrationHubRefactorSpacesClient"; import { MigrationHubRefactorSpacesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubRefactorSpacesClient, - input: ListEnvironmentVpcsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentVpcsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironmentVpcs( +export const paginateListEnvironmentVpcs: ( config: MigrationHubRefactorSpacesPaginationConfiguration, input: ListEnvironmentVpcsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentVpcsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MigrationHubRefactorSpacesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubRefactorSpaces | MigrationHubRefactorSpacesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubRefactorSpacesPaginationConfiguration, + ListEnvironmentVpcsCommandInput, + ListEnvironmentVpcsCommandOutput +>(MigrationHubRefactorSpacesClient, ListEnvironmentVpcsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-migration-hub-refactor-spaces/src/pagination/ListEnvironmentsPaginator.ts b/clients/client-migration-hub-refactor-spaces/src/pagination/ListEnvironmentsPaginator.ts index 9735e18f65b1..9472501d9c14 100644 --- a/clients/client-migration-hub-refactor-spaces/src/pagination/ListEnvironmentsPaginator.ts +++ b/clients/client-migration-hub-refactor-spaces/src/pagination/ListEnvironmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubRefactorSpacesClient } from "../MigrationHubRefactorSpacesClient"; import { MigrationHubRefactorSpacesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubRefactorSpacesClient, - input: ListEnvironmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironments( +export const paginateListEnvironments: ( config: MigrationHubRefactorSpacesPaginationConfiguration, input: ListEnvironmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MigrationHubRefactorSpacesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubRefactorSpaces | MigrationHubRefactorSpacesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubRefactorSpacesPaginationConfiguration, + ListEnvironmentsCommandInput, + ListEnvironmentsCommandOutput +>(MigrationHubRefactorSpacesClient, ListEnvironmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-migration-hub-refactor-spaces/src/pagination/ListRoutesPaginator.ts b/clients/client-migration-hub-refactor-spaces/src/pagination/ListRoutesPaginator.ts index 06a12bb095af..fa3dedfa81a3 100644 --- a/clients/client-migration-hub-refactor-spaces/src/pagination/ListRoutesPaginator.ts +++ b/clients/client-migration-hub-refactor-spaces/src/pagination/ListRoutesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListRoutesCommand, ListRoutesCommandInput, ListRoutesCommandOutput } from "../commands/ListRoutesCommand"; import { MigrationHubRefactorSpacesClient } from "../MigrationHubRefactorSpacesClient"; import { MigrationHubRefactorSpacesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubRefactorSpacesClient, - input: ListRoutesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRoutesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRoutes( +export const paginateListRoutes: ( config: MigrationHubRefactorSpacesPaginationConfiguration, input: ListRoutesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRoutesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MigrationHubRefactorSpacesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubRefactorSpaces | MigrationHubRefactorSpacesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubRefactorSpacesPaginationConfiguration, + ListRoutesCommandInput, + ListRoutesCommandOutput +>(MigrationHubRefactorSpacesClient, ListRoutesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-migration-hub-refactor-spaces/src/pagination/ListServicesPaginator.ts b/clients/client-migration-hub-refactor-spaces/src/pagination/ListServicesPaginator.ts index 687f15f05ca1..894c2faf8d13 100644 --- a/clients/client-migration-hub-refactor-spaces/src/pagination/ListServicesPaginator.ts +++ b/clients/client-migration-hub-refactor-spaces/src/pagination/ListServicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubRefactorSpacesClient } from "../MigrationHubRefactorSpacesClient"; import { MigrationHubRefactorSpacesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubRefactorSpacesClient, - input: ListServicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServices( +export const paginateListServices: ( config: MigrationHubRefactorSpacesPaginationConfiguration, input: ListServicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MigrationHubRefactorSpacesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubRefactorSpaces | MigrationHubRefactorSpacesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubRefactorSpacesPaginationConfiguration, + ListServicesCommandInput, + ListServicesCommandOutput +>(MigrationHubRefactorSpacesClient, ListServicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-migration-hub/package.json b/clients/client-migration-hub/package.json index 0fde363da1af..71250413dba0 100644 --- a/clients/client-migration-hub/package.json +++ b/clients/client-migration-hub/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-migration-hub/src/pagination/ListApplicationStatesPaginator.ts b/clients/client-migration-hub/src/pagination/ListApplicationStatesPaginator.ts index da87abf0ef98..cfbfd1b1ae70 100644 --- a/clients/client-migration-hub/src/pagination/ListApplicationStatesPaginator.ts +++ b/clients/client-migration-hub/src/pagination/ListApplicationStatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubClient } from "../MigrationHubClient"; import { MigrationHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubClient, - input: ListApplicationStatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationStatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationStates( +export const paginateListApplicationStates: ( config: MigrationHubPaginationConfiguration, input: ListApplicationStatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationStatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MigrationHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHub | MigrationHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubPaginationConfiguration, + ListApplicationStatesCommandInput, + ListApplicationStatesCommandOutput +>(MigrationHubClient, ListApplicationStatesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-migration-hub/src/pagination/ListCreatedArtifactsPaginator.ts b/clients/client-migration-hub/src/pagination/ListCreatedArtifactsPaginator.ts index 2d9bc30a84df..6438e61c6247 100644 --- a/clients/client-migration-hub/src/pagination/ListCreatedArtifactsPaginator.ts +++ b/clients/client-migration-hub/src/pagination/ListCreatedArtifactsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubClient } from "../MigrationHubClient"; import { MigrationHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubClient, - input: ListCreatedArtifactsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCreatedArtifactsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCreatedArtifacts( +export const paginateListCreatedArtifacts: ( config: MigrationHubPaginationConfiguration, input: ListCreatedArtifactsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCreatedArtifactsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MigrationHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHub | MigrationHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubPaginationConfiguration, + ListCreatedArtifactsCommandInput, + ListCreatedArtifactsCommandOutput +>(MigrationHubClient, ListCreatedArtifactsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-migration-hub/src/pagination/ListDiscoveredResourcesPaginator.ts b/clients/client-migration-hub/src/pagination/ListDiscoveredResourcesPaginator.ts index 35aabe41c8d0..29bf4d8609bb 100644 --- a/clients/client-migration-hub/src/pagination/ListDiscoveredResourcesPaginator.ts +++ b/clients/client-migration-hub/src/pagination/ListDiscoveredResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubClient } from "../MigrationHubClient"; import { MigrationHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubClient, - input: ListDiscoveredResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDiscoveredResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDiscoveredResources( +export const paginateListDiscoveredResources: ( config: MigrationHubPaginationConfiguration, input: ListDiscoveredResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDiscoveredResourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MigrationHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHub | MigrationHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubPaginationConfiguration, + ListDiscoveredResourcesCommandInput, + ListDiscoveredResourcesCommandOutput +>(MigrationHubClient, ListDiscoveredResourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-migration-hub/src/pagination/ListMigrationTasksPaginator.ts b/clients/client-migration-hub/src/pagination/ListMigrationTasksPaginator.ts index c5bc36ac4f44..b199851d70e9 100644 --- a/clients/client-migration-hub/src/pagination/ListMigrationTasksPaginator.ts +++ b/clients/client-migration-hub/src/pagination/ListMigrationTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubClient } from "../MigrationHubClient"; import { MigrationHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubClient, - input: ListMigrationTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMigrationTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMigrationTasks( +export const paginateListMigrationTasks: ( config: MigrationHubPaginationConfiguration, input: ListMigrationTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMigrationTasksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MigrationHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHub | MigrationHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubPaginationConfiguration, + ListMigrationTasksCommandInput, + ListMigrationTasksCommandOutput +>(MigrationHubClient, ListMigrationTasksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-migration-hub/src/pagination/ListProgressUpdateStreamsPaginator.ts b/clients/client-migration-hub/src/pagination/ListProgressUpdateStreamsPaginator.ts index a14e75fec38a..a596796fb059 100644 --- a/clients/client-migration-hub/src/pagination/ListProgressUpdateStreamsPaginator.ts +++ b/clients/client-migration-hub/src/pagination/ListProgressUpdateStreamsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubClient } from "../MigrationHubClient"; import { MigrationHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubClient, - input: ListProgressUpdateStreamsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProgressUpdateStreamsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProgressUpdateStreams( +export const paginateListProgressUpdateStreams: ( config: MigrationHubPaginationConfiguration, input: ListProgressUpdateStreamsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProgressUpdateStreamsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MigrationHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHub | MigrationHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubPaginationConfiguration, + ListProgressUpdateStreamsCommandInput, + ListProgressUpdateStreamsCommandOutput +>(MigrationHubClient, ListProgressUpdateStreamsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-migrationhub-config/package.json b/clients/client-migrationhub-config/package.json index 62733fad2eb5..f6e85a830e2e 100644 --- a/clients/client-migrationhub-config/package.json +++ b/clients/client-migrationhub-config/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-migrationhub-config/src/pagination/DescribeHomeRegionControlsPaginator.ts b/clients/client-migrationhub-config/src/pagination/DescribeHomeRegionControlsPaginator.ts index 5f381030a096..841718e8768d 100644 --- a/clients/client-migrationhub-config/src/pagination/DescribeHomeRegionControlsPaginator.ts +++ b/clients/client-migrationhub-config/src/pagination/DescribeHomeRegionControlsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubConfigClient } from "../MigrationHubConfigClient"; import { MigrationHubConfigPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubConfigClient, - input: DescribeHomeRegionControlsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeHomeRegionControlsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeHomeRegionControls( +export const paginateDescribeHomeRegionControls: ( config: MigrationHubConfigPaginationConfiguration, input: DescribeHomeRegionControlsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeHomeRegionControlsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MigrationHubConfigClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubConfig | MigrationHubConfigClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubConfigPaginationConfiguration, + DescribeHomeRegionControlsCommandInput, + DescribeHomeRegionControlsCommandOutput +>(MigrationHubConfigClient, DescribeHomeRegionControlsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-migrationhuborchestrator/src/pagination/ListPluginsPaginator.ts b/clients/client-migrationhuborchestrator/src/pagination/ListPluginsPaginator.ts index 0cfeabf92eca..3ccc60630061 100644 --- a/clients/client-migrationhuborchestrator/src/pagination/ListPluginsPaginator.ts +++ b/clients/client-migrationhuborchestrator/src/pagination/ListPluginsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListPluginsCommand, ListPluginsCommandInput, ListPluginsCommandOutput } from "../commands/ListPluginsCommand"; import { MigrationHubOrchestratorClient } from "../MigrationHubOrchestratorClient"; import { MigrationHubOrchestratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubOrchestratorClient, - input: ListPluginsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPluginsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPlugins( +export const paginateListPlugins: ( config: MigrationHubOrchestratorPaginationConfiguration, input: ListPluginsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPluginsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MigrationHubOrchestratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubOrchestrator | MigrationHubOrchestratorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubOrchestratorPaginationConfiguration, + ListPluginsCommandInput, + ListPluginsCommandOutput +>(MigrationHubOrchestratorClient, ListPluginsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-migrationhuborchestrator/src/pagination/ListTemplateStepGroupsPaginator.ts b/clients/client-migrationhuborchestrator/src/pagination/ListTemplateStepGroupsPaginator.ts index ade3fd6f3422..fcb2eebd1a4f 100644 --- a/clients/client-migrationhuborchestrator/src/pagination/ListTemplateStepGroupsPaginator.ts +++ b/clients/client-migrationhuborchestrator/src/pagination/ListTemplateStepGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubOrchestratorClient } from "../MigrationHubOrchestratorClient"; import { MigrationHubOrchestratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubOrchestratorClient, - input: ListTemplateStepGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTemplateStepGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTemplateStepGroups( +export const paginateListTemplateStepGroups: ( config: MigrationHubOrchestratorPaginationConfiguration, input: ListTemplateStepGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTemplateStepGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MigrationHubOrchestratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubOrchestrator | MigrationHubOrchestratorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubOrchestratorPaginationConfiguration, + ListTemplateStepGroupsCommandInput, + ListTemplateStepGroupsCommandOutput +>(MigrationHubOrchestratorClient, ListTemplateStepGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-migrationhuborchestrator/src/pagination/ListTemplateStepsPaginator.ts b/clients/client-migrationhuborchestrator/src/pagination/ListTemplateStepsPaginator.ts index ac7c5be313b2..ad979f33286a 100644 --- a/clients/client-migrationhuborchestrator/src/pagination/ListTemplateStepsPaginator.ts +++ b/clients/client-migrationhuborchestrator/src/pagination/ListTemplateStepsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubOrchestratorClient } from "../MigrationHubOrchestratorClient"; import { MigrationHubOrchestratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubOrchestratorClient, - input: ListTemplateStepsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTemplateStepsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTemplateSteps( +export const paginateListTemplateSteps: ( config: MigrationHubOrchestratorPaginationConfiguration, input: ListTemplateStepsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTemplateStepsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MigrationHubOrchestratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubOrchestrator | MigrationHubOrchestratorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubOrchestratorPaginationConfiguration, + ListTemplateStepsCommandInput, + ListTemplateStepsCommandOutput +>(MigrationHubOrchestratorClient, ListTemplateStepsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-migrationhuborchestrator/src/pagination/ListTemplatesPaginator.ts b/clients/client-migrationhuborchestrator/src/pagination/ListTemplatesPaginator.ts index c9e6cfefc4bc..70b341042833 100644 --- a/clients/client-migrationhuborchestrator/src/pagination/ListTemplatesPaginator.ts +++ b/clients/client-migrationhuborchestrator/src/pagination/ListTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubOrchestratorClient } from "../MigrationHubOrchestratorClient"; import { MigrationHubOrchestratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubOrchestratorClient, - input: ListTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTemplates( +export const paginateListTemplates: ( config: MigrationHubOrchestratorPaginationConfiguration, input: ListTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MigrationHubOrchestratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubOrchestrator | MigrationHubOrchestratorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubOrchestratorPaginationConfiguration, + ListTemplatesCommandInput, + ListTemplatesCommandOutput +>(MigrationHubOrchestratorClient, ListTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-migrationhuborchestrator/src/pagination/ListWorkflowStepGroupsPaginator.ts b/clients/client-migrationhuborchestrator/src/pagination/ListWorkflowStepGroupsPaginator.ts index 57fb9c90a5c1..4e4a2379bf44 100644 --- a/clients/client-migrationhuborchestrator/src/pagination/ListWorkflowStepGroupsPaginator.ts +++ b/clients/client-migrationhuborchestrator/src/pagination/ListWorkflowStepGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubOrchestratorClient } from "../MigrationHubOrchestratorClient"; import { MigrationHubOrchestratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubOrchestratorClient, - input: ListWorkflowStepGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkflowStepGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkflowStepGroups( +export const paginateListWorkflowStepGroups: ( config: MigrationHubOrchestratorPaginationConfiguration, input: ListWorkflowStepGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkflowStepGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MigrationHubOrchestratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubOrchestrator | MigrationHubOrchestratorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubOrchestratorPaginationConfiguration, + ListWorkflowStepGroupsCommandInput, + ListWorkflowStepGroupsCommandOutput +>(MigrationHubOrchestratorClient, ListWorkflowStepGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-migrationhuborchestrator/src/pagination/ListWorkflowStepsPaginator.ts b/clients/client-migrationhuborchestrator/src/pagination/ListWorkflowStepsPaginator.ts index ae4931fa9acc..b7146257670e 100644 --- a/clients/client-migrationhuborchestrator/src/pagination/ListWorkflowStepsPaginator.ts +++ b/clients/client-migrationhuborchestrator/src/pagination/ListWorkflowStepsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubOrchestratorClient } from "../MigrationHubOrchestratorClient"; import { MigrationHubOrchestratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubOrchestratorClient, - input: ListWorkflowStepsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkflowStepsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkflowSteps( +export const paginateListWorkflowSteps: ( config: MigrationHubOrchestratorPaginationConfiguration, input: ListWorkflowStepsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkflowStepsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MigrationHubOrchestratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubOrchestrator | MigrationHubOrchestratorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubOrchestratorPaginationConfiguration, + ListWorkflowStepsCommandInput, + ListWorkflowStepsCommandOutput +>(MigrationHubOrchestratorClient, ListWorkflowStepsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-migrationhuborchestrator/src/pagination/ListWorkflowsPaginator.ts b/clients/client-migrationhuborchestrator/src/pagination/ListWorkflowsPaginator.ts index 31dff94b27dd..e54221d9a812 100644 --- a/clients/client-migrationhuborchestrator/src/pagination/ListWorkflowsPaginator.ts +++ b/clients/client-migrationhuborchestrator/src/pagination/ListWorkflowsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubOrchestratorClient } from "../MigrationHubOrchestratorClient"; import { MigrationHubOrchestratorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubOrchestratorClient, - input: ListWorkflowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkflowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkflows( +export const paginateListWorkflows: ( config: MigrationHubOrchestratorPaginationConfiguration, input: ListWorkflowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkflowsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MigrationHubOrchestratorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubOrchestrator | MigrationHubOrchestratorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubOrchestratorPaginationConfiguration, + ListWorkflowsCommandInput, + ListWorkflowsCommandOutput +>(MigrationHubOrchestratorClient, ListWorkflowsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-migrationhubstrategy/src/pagination/GetServerDetailsPaginator.ts b/clients/client-migrationhubstrategy/src/pagination/GetServerDetailsPaginator.ts index 99dc65ed469d..7e21c1a8bd03 100644 --- a/clients/client-migrationhubstrategy/src/pagination/GetServerDetailsPaginator.ts +++ b/clients/client-migrationhubstrategy/src/pagination/GetServerDetailsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubStrategyClient } from "../MigrationHubStrategyClient"; import { MigrationHubStrategyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubStrategyClient, - input: GetServerDetailsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetServerDetailsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetServerDetails( +export const paginateGetServerDetails: ( config: MigrationHubStrategyPaginationConfiguration, input: GetServerDetailsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetServerDetailsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MigrationHubStrategyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubStrategy | MigrationHubStrategyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubStrategyPaginationConfiguration, + GetServerDetailsCommandInput, + GetServerDetailsCommandOutput +>(MigrationHubStrategyClient, GetServerDetailsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-migrationhubstrategy/src/pagination/ListAnalyzableServersPaginator.ts b/clients/client-migrationhubstrategy/src/pagination/ListAnalyzableServersPaginator.ts index 3c1fa0a5a8f0..4caed7e545df 100644 --- a/clients/client-migrationhubstrategy/src/pagination/ListAnalyzableServersPaginator.ts +++ b/clients/client-migrationhubstrategy/src/pagination/ListAnalyzableServersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubStrategyClient } from "../MigrationHubStrategyClient"; import { MigrationHubStrategyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubStrategyClient, - input: ListAnalyzableServersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnalyzableServersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnalyzableServers( +export const paginateListAnalyzableServers: ( config: MigrationHubStrategyPaginationConfiguration, input: ListAnalyzableServersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnalyzableServersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MigrationHubStrategyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubStrategy | MigrationHubStrategyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubStrategyPaginationConfiguration, + ListAnalyzableServersCommandInput, + ListAnalyzableServersCommandOutput +>(MigrationHubStrategyClient, ListAnalyzableServersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-migrationhubstrategy/src/pagination/ListApplicationComponentsPaginator.ts b/clients/client-migrationhubstrategy/src/pagination/ListApplicationComponentsPaginator.ts index 8da876b3e186..96580f4aa104 100644 --- a/clients/client-migrationhubstrategy/src/pagination/ListApplicationComponentsPaginator.ts +++ b/clients/client-migrationhubstrategy/src/pagination/ListApplicationComponentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubStrategyClient } from "../MigrationHubStrategyClient"; import { MigrationHubStrategyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubStrategyClient, - input: ListApplicationComponentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationComponentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationComponents( +export const paginateListApplicationComponents: ( config: MigrationHubStrategyPaginationConfiguration, input: ListApplicationComponentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationComponentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MigrationHubStrategyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubStrategy | MigrationHubStrategyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubStrategyPaginationConfiguration, + ListApplicationComponentsCommandInput, + ListApplicationComponentsCommandOutput +>(MigrationHubStrategyClient, ListApplicationComponentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-migrationhubstrategy/src/pagination/ListCollectorsPaginator.ts b/clients/client-migrationhubstrategy/src/pagination/ListCollectorsPaginator.ts index 34cd920b7bcc..c4d5a5cf2b3e 100644 --- a/clients/client-migrationhubstrategy/src/pagination/ListCollectorsPaginator.ts +++ b/clients/client-migrationhubstrategy/src/pagination/ListCollectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubStrategyClient } from "../MigrationHubStrategyClient"; import { MigrationHubStrategyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubStrategyClient, - input: ListCollectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCollectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCollectors( +export const paginateListCollectors: ( config: MigrationHubStrategyPaginationConfiguration, input: ListCollectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCollectorsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MigrationHubStrategyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubStrategy | MigrationHubStrategyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubStrategyPaginationConfiguration, + ListCollectorsCommandInput, + ListCollectorsCommandOutput +>(MigrationHubStrategyClient, ListCollectorsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-migrationhubstrategy/src/pagination/ListImportFileTaskPaginator.ts b/clients/client-migrationhubstrategy/src/pagination/ListImportFileTaskPaginator.ts index c5b626c42537..f0ddbf572bef 100644 --- a/clients/client-migrationhubstrategy/src/pagination/ListImportFileTaskPaginator.ts +++ b/clients/client-migrationhubstrategy/src/pagination/ListImportFileTaskPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MigrationHubStrategyClient } from "../MigrationHubStrategyClient"; import { MigrationHubStrategyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubStrategyClient, - input: ListImportFileTaskCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImportFileTaskCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImportFileTask( +export const paginateListImportFileTask: ( config: MigrationHubStrategyPaginationConfiguration, input: ListImportFileTaskCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImportFileTaskCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MigrationHubStrategyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubStrategy | MigrationHubStrategyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubStrategyPaginationConfiguration, + ListImportFileTaskCommandInput, + ListImportFileTaskCommandOutput +>(MigrationHubStrategyClient, ListImportFileTaskCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-migrationhubstrategy/src/pagination/ListServersPaginator.ts b/clients/client-migrationhubstrategy/src/pagination/ListServersPaginator.ts index d1952c8f0682..7338c3043779 100644 --- a/clients/client-migrationhubstrategy/src/pagination/ListServersPaginator.ts +++ b/clients/client-migrationhubstrategy/src/pagination/ListServersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListServersCommand, ListServersCommandInput, ListServersCommandOutput } from "../commands/ListServersCommand"; import { MigrationHubStrategyClient } from "../MigrationHubStrategyClient"; import { MigrationHubStrategyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MigrationHubStrategyClient, - input: ListServersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServers( +export const paginateListServers: ( config: MigrationHubStrategyPaginationConfiguration, input: ListServersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MigrationHubStrategyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MigrationHubStrategy | MigrationHubStrategyClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MigrationHubStrategyPaginationConfiguration, + ListServersCommandInput, + ListServersCommandOutput +>(MigrationHubStrategyClient, ListServersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mobile/src/pagination/ListBundlesPaginator.ts b/clients/client-mobile/src/pagination/ListBundlesPaginator.ts index 84d010bcba96..58b6a87b54e3 100644 --- a/clients/client-mobile/src/pagination/ListBundlesPaginator.ts +++ b/clients/client-mobile/src/pagination/ListBundlesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListBundlesCommand, ListBundlesCommandInput, ListBundlesCommandOutput } from "../commands/ListBundlesCommand"; import { MobileClient } from "../MobileClient"; import { MobilePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MobileClient, - input: ListBundlesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBundlesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBundles( +export const paginateListBundles: ( config: MobilePaginationConfiguration, input: ListBundlesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBundlesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MobileClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mobile | MobileClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MobilePaginationConfiguration, + ListBundlesCommandInput, + ListBundlesCommandOutput +>(MobileClient, ListBundlesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mobile/src/pagination/ListProjectsPaginator.ts b/clients/client-mobile/src/pagination/ListProjectsPaginator.ts index d372fff9c614..a0c4a0f24815 100644 --- a/clients/client-mobile/src/pagination/ListProjectsPaginator.ts +++ b/clients/client-mobile/src/pagination/ListProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MobileClient } from "../MobileClient"; import { MobilePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MobileClient, - input: ListProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProjects( +export const paginateListProjects: ( config: MobilePaginationConfiguration, input: ListProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProjectsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof MobileClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mobile | MobileClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MobilePaginationConfiguration, + ListProjectsCommandInput, + ListProjectsCommandOutput +>(MobileClient, ListProjectsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-mq/src/pagination/ListBrokersPaginator.ts b/clients/client-mq/src/pagination/ListBrokersPaginator.ts index 96278b2a8ff6..714c3650cf4a 100644 --- a/clients/client-mq/src/pagination/ListBrokersPaginator.ts +++ b/clients/client-mq/src/pagination/ListBrokersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListBrokersCommand, ListBrokersCommandInput, ListBrokersCommandOutput } from "../commands/ListBrokersCommand"; import { MqClient } from "../MqClient"; import { MqPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MqClient, - input: ListBrokersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBrokersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBrokers( +export const paginateListBrokers: ( config: MqPaginationConfiguration, input: ListBrokersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBrokersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MqClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Mq | MqClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MqPaginationConfiguration, + ListBrokersCommandInput, + ListBrokersCommandOutput +>(MqClient, ListBrokersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mturk/package.json b/clients/client-mturk/package.json index b5d426787267..e553621cd6fd 100644 --- a/clients/client-mturk/package.json +++ b/clients/client-mturk/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-mturk/src/pagination/ListAssignmentsForHITPaginator.ts b/clients/client-mturk/src/pagination/ListAssignmentsForHITPaginator.ts index fd107fb0dd7e..97acf036b36b 100644 --- a/clients/client-mturk/src/pagination/ListAssignmentsForHITPaginator.ts +++ b/clients/client-mturk/src/pagination/ListAssignmentsForHITPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MTurkClient } from "../MTurkClient"; import { MTurkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MTurkClient, - input: ListAssignmentsForHITCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssignmentsForHITCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssignmentsForHIT( +export const paginateListAssignmentsForHIT: ( config: MTurkPaginationConfiguration, input: ListAssignmentsForHITCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssignmentsForHITCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MTurkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MTurk | MTurkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MTurkPaginationConfiguration, + ListAssignmentsForHITCommandInput, + ListAssignmentsForHITCommandOutput +>(MTurkClient, ListAssignmentsForHITCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mturk/src/pagination/ListBonusPaymentsPaginator.ts b/clients/client-mturk/src/pagination/ListBonusPaymentsPaginator.ts index 11324da18019..e66d6dc46e99 100644 --- a/clients/client-mturk/src/pagination/ListBonusPaymentsPaginator.ts +++ b/clients/client-mturk/src/pagination/ListBonusPaymentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MTurkClient } from "../MTurkClient"; import { MTurkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MTurkClient, - input: ListBonusPaymentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBonusPaymentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBonusPayments( +export const paginateListBonusPayments: ( config: MTurkPaginationConfiguration, input: ListBonusPaymentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBonusPaymentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MTurkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MTurk | MTurkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MTurkPaginationConfiguration, + ListBonusPaymentsCommandInput, + ListBonusPaymentsCommandOutput +>(MTurkClient, ListBonusPaymentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mturk/src/pagination/ListHITsForQualificationTypePaginator.ts b/clients/client-mturk/src/pagination/ListHITsForQualificationTypePaginator.ts index 2794ec58d63b..d317598f407e 100644 --- a/clients/client-mturk/src/pagination/ListHITsForQualificationTypePaginator.ts +++ b/clients/client-mturk/src/pagination/ListHITsForQualificationTypePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MTurkClient } from "../MTurkClient"; import { MTurkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MTurkClient, - input: ListHITsForQualificationTypeCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHITsForQualificationTypeCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHITsForQualificationType( +export const paginateListHITsForQualificationType: ( config: MTurkPaginationConfiguration, input: ListHITsForQualificationTypeCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHITsForQualificationTypeCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MTurkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MTurk | MTurkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MTurkPaginationConfiguration, + ListHITsForQualificationTypeCommandInput, + ListHITsForQualificationTypeCommandOutput +>(MTurkClient, ListHITsForQualificationTypeCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mturk/src/pagination/ListHITsPaginator.ts b/clients/client-mturk/src/pagination/ListHITsPaginator.ts index 9cb3e491ca7d..76c28d25f88d 100644 --- a/clients/client-mturk/src/pagination/ListHITsPaginator.ts +++ b/clients/client-mturk/src/pagination/ListHITsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListHITsCommand, ListHITsCommandInput, ListHITsCommandOutput } from "../commands/ListHITsCommand"; import { MTurkClient } from "../MTurkClient"; import { MTurkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MTurkClient, - input: ListHITsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHITsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHITs( +export const paginateListHITs: ( config: MTurkPaginationConfiguration, input: ListHITsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHITsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MTurkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MTurk | MTurkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MTurkPaginationConfiguration, + ListHITsCommandInput, + ListHITsCommandOutput +>(MTurkClient, ListHITsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mturk/src/pagination/ListQualificationRequestsPaginator.ts b/clients/client-mturk/src/pagination/ListQualificationRequestsPaginator.ts index 09eb9ee9e1c5..005f22ca6f0f 100644 --- a/clients/client-mturk/src/pagination/ListQualificationRequestsPaginator.ts +++ b/clients/client-mturk/src/pagination/ListQualificationRequestsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MTurkClient } from "../MTurkClient"; import { MTurkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MTurkClient, - input: ListQualificationRequestsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListQualificationRequestsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListQualificationRequests( +export const paginateListQualificationRequests: ( config: MTurkPaginationConfiguration, input: ListQualificationRequestsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListQualificationRequestsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MTurkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MTurk | MTurkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MTurkPaginationConfiguration, + ListQualificationRequestsCommandInput, + ListQualificationRequestsCommandOutput +>(MTurkClient, ListQualificationRequestsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mturk/src/pagination/ListQualificationTypesPaginator.ts b/clients/client-mturk/src/pagination/ListQualificationTypesPaginator.ts index 42e8bd4bf3f7..6e38594cde57 100644 --- a/clients/client-mturk/src/pagination/ListQualificationTypesPaginator.ts +++ b/clients/client-mturk/src/pagination/ListQualificationTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MTurkClient } from "../MTurkClient"; import { MTurkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MTurkClient, - input: ListQualificationTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListQualificationTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListQualificationTypes( +export const paginateListQualificationTypes: ( config: MTurkPaginationConfiguration, input: ListQualificationTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListQualificationTypesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MTurkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MTurk | MTurkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MTurkPaginationConfiguration, + ListQualificationTypesCommandInput, + ListQualificationTypesCommandOutput +>(MTurkClient, ListQualificationTypesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mturk/src/pagination/ListReviewPolicyResultsForHITPaginator.ts b/clients/client-mturk/src/pagination/ListReviewPolicyResultsForHITPaginator.ts index bcbc64809ce0..b77d3ca8ed0b 100644 --- a/clients/client-mturk/src/pagination/ListReviewPolicyResultsForHITPaginator.ts +++ b/clients/client-mturk/src/pagination/ListReviewPolicyResultsForHITPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MTurkClient } from "../MTurkClient"; import { MTurkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MTurkClient, - input: ListReviewPolicyResultsForHITCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReviewPolicyResultsForHITCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReviewPolicyResultsForHIT( +export const paginateListReviewPolicyResultsForHIT: ( config: MTurkPaginationConfiguration, input: ListReviewPolicyResultsForHITCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReviewPolicyResultsForHITCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MTurkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MTurk | MTurkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MTurkPaginationConfiguration, + ListReviewPolicyResultsForHITCommandInput, + ListReviewPolicyResultsForHITCommandOutput +>(MTurkClient, ListReviewPolicyResultsForHITCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mturk/src/pagination/ListReviewableHITsPaginator.ts b/clients/client-mturk/src/pagination/ListReviewableHITsPaginator.ts index 4efa960ccdd0..dffd086a3037 100644 --- a/clients/client-mturk/src/pagination/ListReviewableHITsPaginator.ts +++ b/clients/client-mturk/src/pagination/ListReviewableHITsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MTurkClient } from "../MTurkClient"; import { MTurkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MTurkClient, - input: ListReviewableHITsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReviewableHITsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReviewableHITs( +export const paginateListReviewableHITs: ( config: MTurkPaginationConfiguration, input: ListReviewableHITsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReviewableHITsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MTurkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MTurk | MTurkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MTurkPaginationConfiguration, + ListReviewableHITsCommandInput, + ListReviewableHITsCommandOutput +>(MTurkClient, ListReviewableHITsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mturk/src/pagination/ListWorkerBlocksPaginator.ts b/clients/client-mturk/src/pagination/ListWorkerBlocksPaginator.ts index 1c780c06dea7..6970450ef6bc 100644 --- a/clients/client-mturk/src/pagination/ListWorkerBlocksPaginator.ts +++ b/clients/client-mturk/src/pagination/ListWorkerBlocksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MTurkClient } from "../MTurkClient"; import { MTurkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MTurkClient, - input: ListWorkerBlocksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkerBlocksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkerBlocks( +export const paginateListWorkerBlocks: ( config: MTurkPaginationConfiguration, input: ListWorkerBlocksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkerBlocksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MTurkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MTurk | MTurkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MTurkPaginationConfiguration, + ListWorkerBlocksCommandInput, + ListWorkerBlocksCommandOutput +>(MTurkClient, ListWorkerBlocksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mturk/src/pagination/ListWorkersWithQualificationTypePaginator.ts b/clients/client-mturk/src/pagination/ListWorkersWithQualificationTypePaginator.ts index 47dc63270da2..b907c67708c2 100644 --- a/clients/client-mturk/src/pagination/ListWorkersWithQualificationTypePaginator.ts +++ b/clients/client-mturk/src/pagination/ListWorkersWithQualificationTypePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MTurkClient } from "../MTurkClient"; import { MTurkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MTurkClient, - input: ListWorkersWithQualificationTypeCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkersWithQualificationTypeCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkersWithQualificationType( +export const paginateListWorkersWithQualificationType: ( config: MTurkPaginationConfiguration, input: ListWorkersWithQualificationTypeCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkersWithQualificationTypeCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MTurkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MTurk | MTurkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MTurkPaginationConfiguration, + ListWorkersWithQualificationTypeCommandInput, + ListWorkersWithQualificationTypeCommandOutput +>(MTurkClient, ListWorkersWithQualificationTypeCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-mwaa/src/pagination/ListEnvironmentsPaginator.ts b/clients/client-mwaa/src/pagination/ListEnvironmentsPaginator.ts index b6470b3fdda2..98669ce7fa8d 100644 --- a/clients/client-mwaa/src/pagination/ListEnvironmentsPaginator.ts +++ b/clients/client-mwaa/src/pagination/ListEnvironmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { MWAAClient } from "../MWAAClient"; import { MWAAPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: MWAAClient, - input: ListEnvironmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironments( +export const paginateListEnvironments: ( config: MWAAPaginationConfiguration, input: ListEnvironmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof MWAAClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected MWAA | MWAAClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + MWAAPaginationConfiguration, + ListEnvironmentsCommandInput, + ListEnvironmentsCommandOutput +>(MWAAClient, ListEnvironmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-neptune-graph/src/pagination/ListGraphSnapshotsPaginator.ts b/clients/client-neptune-graph/src/pagination/ListGraphSnapshotsPaginator.ts index 6e979496a9ee..a73f94d64e2c 100644 --- a/clients/client-neptune-graph/src/pagination/ListGraphSnapshotsPaginator.ts +++ b/clients/client-neptune-graph/src/pagination/ListGraphSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneGraphClient } from "../NeptuneGraphClient"; import { NeptuneGraphPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneGraphClient, - input: ListGraphSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGraphSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGraphSnapshots( +export const paginateListGraphSnapshots: ( config: NeptuneGraphPaginationConfiguration, input: ListGraphSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGraphSnapshotsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof NeptuneGraphClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NeptuneGraph | NeptuneGraphClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptuneGraphPaginationConfiguration, + ListGraphSnapshotsCommandInput, + ListGraphSnapshotsCommandOutput +>(NeptuneGraphClient, ListGraphSnapshotsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-neptune-graph/src/pagination/ListGraphsPaginator.ts b/clients/client-neptune-graph/src/pagination/ListGraphsPaginator.ts index 9503bd40c79a..d24c70ebbbe8 100644 --- a/clients/client-neptune-graph/src/pagination/ListGraphsPaginator.ts +++ b/clients/client-neptune-graph/src/pagination/ListGraphsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListGraphsCommand, ListGraphsCommandInput, ListGraphsCommandOutput } from "../commands/ListGraphsCommand"; import { NeptuneGraphClient } from "../NeptuneGraphClient"; import { NeptuneGraphPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneGraphClient, - input: ListGraphsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGraphsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGraphs( +export const paginateListGraphs: ( config: NeptuneGraphPaginationConfiguration, input: ListGraphsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGraphsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof NeptuneGraphClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NeptuneGraph | NeptuneGraphClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptuneGraphPaginationConfiguration, + ListGraphsCommandInput, + ListGraphsCommandOutput +>(NeptuneGraphClient, ListGraphsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-neptune-graph/src/pagination/ListImportTasksPaginator.ts b/clients/client-neptune-graph/src/pagination/ListImportTasksPaginator.ts index d8fdae852ebe..b9746f684847 100644 --- a/clients/client-neptune-graph/src/pagination/ListImportTasksPaginator.ts +++ b/clients/client-neptune-graph/src/pagination/ListImportTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneGraphClient } from "../NeptuneGraphClient"; import { NeptuneGraphPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneGraphClient, - input: ListImportTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImportTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImportTasks( +export const paginateListImportTasks: ( config: NeptuneGraphPaginationConfiguration, input: ListImportTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImportTasksCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof NeptuneGraphClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NeptuneGraph | NeptuneGraphClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptuneGraphPaginationConfiguration, + ListImportTasksCommandInput, + ListImportTasksCommandOutput +>(NeptuneGraphClient, ListImportTasksCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-neptune-graph/src/pagination/ListPrivateGraphEndpointsPaginator.ts b/clients/client-neptune-graph/src/pagination/ListPrivateGraphEndpointsPaginator.ts index 52bc73661093..9e70a589dd61 100644 --- a/clients/client-neptune-graph/src/pagination/ListPrivateGraphEndpointsPaginator.ts +++ b/clients/client-neptune-graph/src/pagination/ListPrivateGraphEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneGraphClient } from "../NeptuneGraphClient"; import { NeptuneGraphPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneGraphClient, - input: ListPrivateGraphEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPrivateGraphEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPrivateGraphEndpoints( +export const paginateListPrivateGraphEndpoints: ( config: NeptuneGraphPaginationConfiguration, input: ListPrivateGraphEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPrivateGraphEndpointsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof NeptuneGraphClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NeptuneGraph | NeptuneGraphClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptuneGraphPaginationConfiguration, + ListPrivateGraphEndpointsCommandInput, + ListPrivateGraphEndpointsCommandOutput +>(NeptuneGraphClient, ListPrivateGraphEndpointsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-neptune/package.json b/clients/client-neptune/package.json index 42a9a9ae88a1..95ff1cdd0421 100644 --- a/clients/client-neptune/package.json +++ b/clients/client-neptune/package.json @@ -35,6 +35,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-neptune/src/pagination/DescribeDBClusterEndpointsPaginator.ts b/clients/client-neptune/src/pagination/DescribeDBClusterEndpointsPaginator.ts index 5c445fd2788f..757d5ca9c880 100644 --- a/clients/client-neptune/src/pagination/DescribeDBClusterEndpointsPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeDBClusterEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeDBClusterEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClusterEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusterEndpoints( +export const paginateDescribeDBClusterEndpoints: ( config: NeptunePaginationConfiguration, input: DescribeDBClusterEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClusterEndpointsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeDBClusterEndpointsCommandInput, + DescribeDBClusterEndpointsCommandOutput +>(NeptuneClient, DescribeDBClusterEndpointsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribeDBClusterParameterGroupsPaginator.ts b/clients/client-neptune/src/pagination/DescribeDBClusterParameterGroupsPaginator.ts index 6647e3904961..3ae2ccbb407d 100644 --- a/clients/client-neptune/src/pagination/DescribeDBClusterParameterGroupsPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeDBClusterParameterGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeDBClusterParameterGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClusterParameterGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusterParameterGroups( +export const paginateDescribeDBClusterParameterGroups: ( config: NeptunePaginationConfiguration, input: DescribeDBClusterParameterGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClusterParameterGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeDBClusterParameterGroupsCommandInput, + DescribeDBClusterParameterGroupsCommandOutput +>(NeptuneClient, DescribeDBClusterParameterGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribeDBClusterParametersPaginator.ts b/clients/client-neptune/src/pagination/DescribeDBClusterParametersPaginator.ts index 30fd9140a48f..661937759ce8 100644 --- a/clients/client-neptune/src/pagination/DescribeDBClusterParametersPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeDBClusterParametersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeDBClusterParametersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClusterParametersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusterParameters( +export const paginateDescribeDBClusterParameters: ( config: NeptunePaginationConfiguration, input: DescribeDBClusterParametersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClusterParametersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeDBClusterParametersCommandInput, + DescribeDBClusterParametersCommandOutput +>(NeptuneClient, DescribeDBClusterParametersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribeDBClusterSnapshotsPaginator.ts b/clients/client-neptune/src/pagination/DescribeDBClusterSnapshotsPaginator.ts index a63d4e3de2a3..6e9155b57d48 100644 --- a/clients/client-neptune/src/pagination/DescribeDBClusterSnapshotsPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeDBClusterSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeDBClusterSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClusterSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusterSnapshots( +export const paginateDescribeDBClusterSnapshots: ( config: NeptunePaginationConfiguration, input: DescribeDBClusterSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClusterSnapshotsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeDBClusterSnapshotsCommandInput, + DescribeDBClusterSnapshotsCommandOutput +>(NeptuneClient, DescribeDBClusterSnapshotsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribeDBClustersPaginator.ts b/clients/client-neptune/src/pagination/DescribeDBClustersPaginator.ts index 5a32dd6ee530..2321f13d57b3 100644 --- a/clients/client-neptune/src/pagination/DescribeDBClustersPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeDBClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeDBClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusters( +export const paginateDescribeDBClusters: ( config: NeptunePaginationConfiguration, input: DescribeDBClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClustersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeDBClustersCommandInput, + DescribeDBClustersCommandOutput +>(NeptuneClient, DescribeDBClustersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribeDBEngineVersionsPaginator.ts b/clients/client-neptune/src/pagination/DescribeDBEngineVersionsPaginator.ts index c98d833fcbf3..b85bbc7df017 100644 --- a/clients/client-neptune/src/pagination/DescribeDBEngineVersionsPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeDBEngineVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeDBEngineVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBEngineVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBEngineVersions( +export const paginateDescribeDBEngineVersions: ( config: NeptunePaginationConfiguration, input: DescribeDBEngineVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBEngineVersionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeDBEngineVersionsCommandInput, + DescribeDBEngineVersionsCommandOutput +>(NeptuneClient, DescribeDBEngineVersionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribeDBInstancesPaginator.ts b/clients/client-neptune/src/pagination/DescribeDBInstancesPaginator.ts index 41f18eede5ea..fd81393cfef2 100644 --- a/clients/client-neptune/src/pagination/DescribeDBInstancesPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeDBInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeDBInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBInstances( +export const paginateDescribeDBInstances: ( config: NeptunePaginationConfiguration, input: DescribeDBInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBInstancesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeDBInstancesCommandInput, + DescribeDBInstancesCommandOutput +>(NeptuneClient, DescribeDBInstancesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribeDBParameterGroupsPaginator.ts b/clients/client-neptune/src/pagination/DescribeDBParameterGroupsPaginator.ts index 152c6dc16567..0f30b2f4694f 100644 --- a/clients/client-neptune/src/pagination/DescribeDBParameterGroupsPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeDBParameterGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeDBParameterGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBParameterGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBParameterGroups( +export const paginateDescribeDBParameterGroups: ( config: NeptunePaginationConfiguration, input: DescribeDBParameterGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBParameterGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeDBParameterGroupsCommandInput, + DescribeDBParameterGroupsCommandOutput +>(NeptuneClient, DescribeDBParameterGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribeDBParametersPaginator.ts b/clients/client-neptune/src/pagination/DescribeDBParametersPaginator.ts index f5755c939fe0..04f093bba7d0 100644 --- a/clients/client-neptune/src/pagination/DescribeDBParametersPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeDBParametersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeDBParametersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBParametersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBParameters( +export const paginateDescribeDBParameters: ( config: NeptunePaginationConfiguration, input: DescribeDBParametersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBParametersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeDBParametersCommandInput, + DescribeDBParametersCommandOutput +>(NeptuneClient, DescribeDBParametersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribeDBSubnetGroupsPaginator.ts b/clients/client-neptune/src/pagination/DescribeDBSubnetGroupsPaginator.ts index c210456c9485..6013a46c79f1 100644 --- a/clients/client-neptune/src/pagination/DescribeDBSubnetGroupsPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeDBSubnetGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeDBSubnetGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBSubnetGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBSubnetGroups( +export const paginateDescribeDBSubnetGroups: ( config: NeptunePaginationConfiguration, input: DescribeDBSubnetGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBSubnetGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeDBSubnetGroupsCommandInput, + DescribeDBSubnetGroupsCommandOutput +>(NeptuneClient, DescribeDBSubnetGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribeEngineDefaultParametersPaginator.ts b/clients/client-neptune/src/pagination/DescribeEngineDefaultParametersPaginator.ts index f512c4cd1d86..0f3364c8653f 100644 --- a/clients/client-neptune/src/pagination/DescribeEngineDefaultParametersPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeEngineDefaultParametersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeEngineDefaultParametersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEngineDefaultParametersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEngineDefaultParameters( +export const paginateDescribeEngineDefaultParameters: ( config: NeptunePaginationConfiguration, input: DescribeEngineDefaultParametersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEngineDefaultParametersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.EngineDefaults!.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeEngineDefaultParametersCommandInput, + DescribeEngineDefaultParametersCommandOutput +>(NeptuneClient, DescribeEngineDefaultParametersCommand, "Marker", "EngineDefaults.Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribeEventSubscriptionsPaginator.ts b/clients/client-neptune/src/pagination/DescribeEventSubscriptionsPaginator.ts index ac5b4f28c72b..185cea3f6d98 100644 --- a/clients/client-neptune/src/pagination/DescribeEventSubscriptionsPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeEventSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeEventSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEventSubscriptions( +export const paginateDescribeEventSubscriptions: ( config: NeptunePaginationConfiguration, input: DescribeEventSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventSubscriptionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeEventSubscriptionsCommandInput, + DescribeEventSubscriptionsCommandOutput +>(NeptuneClient, DescribeEventSubscriptionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribeEventsPaginator.ts b/clients/client-neptune/src/pagination/DescribeEventsPaginator.ts index 3bdd295ec53b..c4f12a5ad1bf 100644 --- a/clients/client-neptune/src/pagination/DescribeEventsPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEvents( +export const paginateDescribeEvents: ( config: NeptunePaginationConfiguration, input: DescribeEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeEventsCommandInput, + DescribeEventsCommandOutput +>(NeptuneClient, DescribeEventsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribeGlobalClustersPaginator.ts b/clients/client-neptune/src/pagination/DescribeGlobalClustersPaginator.ts index 46ff0d3859e7..d6263a89024c 100644 --- a/clients/client-neptune/src/pagination/DescribeGlobalClustersPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeGlobalClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeGlobalClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeGlobalClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeGlobalClusters( +export const paginateDescribeGlobalClusters: ( config: NeptunePaginationConfiguration, input: DescribeGlobalClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeGlobalClustersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeGlobalClustersCommandInput, + DescribeGlobalClustersCommandOutput +>(NeptuneClient, DescribeGlobalClustersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribeOrderableDBInstanceOptionsPaginator.ts b/clients/client-neptune/src/pagination/DescribeOrderableDBInstanceOptionsPaginator.ts index 498089dca83c..c3ee6901d986 100644 --- a/clients/client-neptune/src/pagination/DescribeOrderableDBInstanceOptionsPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribeOrderableDBInstanceOptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribeOrderableDBInstanceOptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOrderableDBInstanceOptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOrderableDBInstanceOptions( +export const paginateDescribeOrderableDBInstanceOptions: ( config: NeptunePaginationConfiguration, input: DescribeOrderableDBInstanceOptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOrderableDBInstanceOptionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribeOrderableDBInstanceOptionsCommandInput, + DescribeOrderableDBInstanceOptionsCommandOutput +>(NeptuneClient, DescribeOrderableDBInstanceOptionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-neptune/src/pagination/DescribePendingMaintenanceActionsPaginator.ts b/clients/client-neptune/src/pagination/DescribePendingMaintenanceActionsPaginator.ts index 6bec8e910ab0..9e2a08c2289e 100644 --- a/clients/client-neptune/src/pagination/DescribePendingMaintenanceActionsPaginator.ts +++ b/clients/client-neptune/src/pagination/DescribePendingMaintenanceActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NeptuneClient } from "../NeptuneClient"; import { NeptunePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NeptuneClient, - input: DescribePendingMaintenanceActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePendingMaintenanceActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePendingMaintenanceActions( +export const paginateDescribePendingMaintenanceActions: ( config: NeptunePaginationConfiguration, input: DescribePendingMaintenanceActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePendingMaintenanceActionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof NeptuneClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Neptune | NeptuneClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NeptunePaginationConfiguration, + DescribePendingMaintenanceActionsCommandInput, + DescribePendingMaintenanceActionsCommandOutput +>(NeptuneClient, DescribePendingMaintenanceActionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-network-firewall/package.json b/clients/client-network-firewall/package.json index ac94f2cc23be..887019c30525 100644 --- a/clients/client-network-firewall/package.json +++ b/clients/client-network-firewall/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-network-firewall/src/pagination/ListFirewallPoliciesPaginator.ts b/clients/client-network-firewall/src/pagination/ListFirewallPoliciesPaginator.ts index 0e488b7d31b7..0915307e7f7d 100644 --- a/clients/client-network-firewall/src/pagination/ListFirewallPoliciesPaginator.ts +++ b/clients/client-network-firewall/src/pagination/ListFirewallPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkFirewallClient } from "../NetworkFirewallClient"; import { NetworkFirewallPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkFirewallClient, - input: ListFirewallPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFirewallPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFirewallPolicies( +export const paginateListFirewallPolicies: ( config: NetworkFirewallPaginationConfiguration, input: ListFirewallPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFirewallPoliciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkFirewallClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkFirewall | NetworkFirewallClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkFirewallPaginationConfiguration, + ListFirewallPoliciesCommandInput, + ListFirewallPoliciesCommandOutput +>(NetworkFirewallClient, ListFirewallPoliciesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-network-firewall/src/pagination/ListFirewallsPaginator.ts b/clients/client-network-firewall/src/pagination/ListFirewallsPaginator.ts index e4fc079f87ff..17cfa39762a6 100644 --- a/clients/client-network-firewall/src/pagination/ListFirewallsPaginator.ts +++ b/clients/client-network-firewall/src/pagination/ListFirewallsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkFirewallClient } from "../NetworkFirewallClient"; import { NetworkFirewallPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkFirewallClient, - input: ListFirewallsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFirewallsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFirewalls( +export const paginateListFirewalls: ( config: NetworkFirewallPaginationConfiguration, input: ListFirewallsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFirewallsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkFirewallClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkFirewall | NetworkFirewallClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkFirewallPaginationConfiguration, + ListFirewallsCommandInput, + ListFirewallsCommandOutput +>(NetworkFirewallClient, ListFirewallsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-network-firewall/src/pagination/ListRuleGroupsPaginator.ts b/clients/client-network-firewall/src/pagination/ListRuleGroupsPaginator.ts index a0bc547ca86c..6262d34a0677 100644 --- a/clients/client-network-firewall/src/pagination/ListRuleGroupsPaginator.ts +++ b/clients/client-network-firewall/src/pagination/ListRuleGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkFirewallClient } from "../NetworkFirewallClient"; import { NetworkFirewallPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkFirewallClient, - input: ListRuleGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRuleGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRuleGroups( +export const paginateListRuleGroups: ( config: NetworkFirewallPaginationConfiguration, input: ListRuleGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRuleGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkFirewallClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkFirewall | NetworkFirewallClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkFirewallPaginationConfiguration, + ListRuleGroupsCommandInput, + ListRuleGroupsCommandOutput +>(NetworkFirewallClient, ListRuleGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-network-firewall/src/pagination/ListTLSInspectionConfigurationsPaginator.ts b/clients/client-network-firewall/src/pagination/ListTLSInspectionConfigurationsPaginator.ts index 16fafb2e6596..df229a820bee 100644 --- a/clients/client-network-firewall/src/pagination/ListTLSInspectionConfigurationsPaginator.ts +++ b/clients/client-network-firewall/src/pagination/ListTLSInspectionConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkFirewallClient } from "../NetworkFirewallClient"; import { NetworkFirewallPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkFirewallClient, - input: ListTLSInspectionConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTLSInspectionConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTLSInspectionConfigurations( +export const paginateListTLSInspectionConfigurations: ( config: NetworkFirewallPaginationConfiguration, input: ListTLSInspectionConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTLSInspectionConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkFirewallClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkFirewall | NetworkFirewallClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkFirewallPaginationConfiguration, + ListTLSInspectionConfigurationsCommandInput, + ListTLSInspectionConfigurationsCommandOutput +>(NetworkFirewallClient, ListTLSInspectionConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-network-firewall/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-network-firewall/src/pagination/ListTagsForResourcePaginator.ts index 4253c813bb7c..4f9a375ec08b 100644 --- a/clients/client-network-firewall/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-network-firewall/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkFirewallClient } from "../NetworkFirewallClient"; import { NetworkFirewallPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkFirewallClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: NetworkFirewallPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkFirewallClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkFirewall | NetworkFirewallClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkFirewallPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(NetworkFirewallClient, ListTagsForResourceCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/DescribeGlobalNetworksPaginator.ts b/clients/client-networkmanager/src/pagination/DescribeGlobalNetworksPaginator.ts index 9eb08fa731a3..1f39b6d25952 100644 --- a/clients/client-networkmanager/src/pagination/DescribeGlobalNetworksPaginator.ts +++ b/clients/client-networkmanager/src/pagination/DescribeGlobalNetworksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: DescribeGlobalNetworksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeGlobalNetworksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeGlobalNetworks( +export const paginateDescribeGlobalNetworks: ( config: NetworkManagerPaginationConfiguration, input: DescribeGlobalNetworksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeGlobalNetworksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + DescribeGlobalNetworksCommandInput, + DescribeGlobalNetworksCommandOutput +>(NetworkManagerClient, DescribeGlobalNetworksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetConnectPeerAssociationsPaginator.ts b/clients/client-networkmanager/src/pagination/GetConnectPeerAssociationsPaginator.ts index 99589e24a509..9d1bc17110b1 100644 --- a/clients/client-networkmanager/src/pagination/GetConnectPeerAssociationsPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetConnectPeerAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetConnectPeerAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetConnectPeerAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetConnectPeerAssociations( +export const paginateGetConnectPeerAssociations: ( config: NetworkManagerPaginationConfiguration, input: GetConnectPeerAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetConnectPeerAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetConnectPeerAssociationsCommandInput, + GetConnectPeerAssociationsCommandOutput +>(NetworkManagerClient, GetConnectPeerAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetConnectionsPaginator.ts b/clients/client-networkmanager/src/pagination/GetConnectionsPaginator.ts index 11cc29f0c6a4..20f4186fdaf6 100644 --- a/clients/client-networkmanager/src/pagination/GetConnectionsPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetConnections( +export const paginateGetConnections: ( config: NetworkManagerPaginationConfiguration, input: GetConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetConnectionsCommandInput, + GetConnectionsCommandOutput +>(NetworkManagerClient, GetConnectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetCoreNetworkChangeEventsPaginator.ts b/clients/client-networkmanager/src/pagination/GetCoreNetworkChangeEventsPaginator.ts index ff974b103879..fa1905ee97e0 100644 --- a/clients/client-networkmanager/src/pagination/GetCoreNetworkChangeEventsPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetCoreNetworkChangeEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetCoreNetworkChangeEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCoreNetworkChangeEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCoreNetworkChangeEvents( +export const paginateGetCoreNetworkChangeEvents: ( config: NetworkManagerPaginationConfiguration, input: GetCoreNetworkChangeEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCoreNetworkChangeEventsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetCoreNetworkChangeEventsCommandInput, + GetCoreNetworkChangeEventsCommandOutput +>(NetworkManagerClient, GetCoreNetworkChangeEventsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetCoreNetworkChangeSetPaginator.ts b/clients/client-networkmanager/src/pagination/GetCoreNetworkChangeSetPaginator.ts index d90623a81853..6113e26239fb 100644 --- a/clients/client-networkmanager/src/pagination/GetCoreNetworkChangeSetPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetCoreNetworkChangeSetPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetCoreNetworkChangeSetCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCoreNetworkChangeSetCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCoreNetworkChangeSet( +export const paginateGetCoreNetworkChangeSet: ( config: NetworkManagerPaginationConfiguration, input: GetCoreNetworkChangeSetCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCoreNetworkChangeSetCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetCoreNetworkChangeSetCommandInput, + GetCoreNetworkChangeSetCommandOutput +>(NetworkManagerClient, GetCoreNetworkChangeSetCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetCustomerGatewayAssociationsPaginator.ts b/clients/client-networkmanager/src/pagination/GetCustomerGatewayAssociationsPaginator.ts index e35de38577f2..9cbe5f04a893 100644 --- a/clients/client-networkmanager/src/pagination/GetCustomerGatewayAssociationsPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetCustomerGatewayAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetCustomerGatewayAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCustomerGatewayAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCustomerGatewayAssociations( +export const paginateGetCustomerGatewayAssociations: ( config: NetworkManagerPaginationConfiguration, input: GetCustomerGatewayAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCustomerGatewayAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetCustomerGatewayAssociationsCommandInput, + GetCustomerGatewayAssociationsCommandOutput +>(NetworkManagerClient, GetCustomerGatewayAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetDevicesPaginator.ts b/clients/client-networkmanager/src/pagination/GetDevicesPaginator.ts index 0961757f131b..9eac23fbfc67 100644 --- a/clients/client-networkmanager/src/pagination/GetDevicesPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetDevicesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetDevicesCommand, GetDevicesCommandInput, GetDevicesCommandOutput } from "../commands/GetDevicesCommand"; import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetDevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetDevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetDevices( +export const paginateGetDevices: ( config: NetworkManagerPaginationConfiguration, input: GetDevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetDevicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetDevicesCommandInput, + GetDevicesCommandOutput +>(NetworkManagerClient, GetDevicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetLinkAssociationsPaginator.ts b/clients/client-networkmanager/src/pagination/GetLinkAssociationsPaginator.ts index 1e06a5874900..3eb0862d03e2 100644 --- a/clients/client-networkmanager/src/pagination/GetLinkAssociationsPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetLinkAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetLinkAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetLinkAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetLinkAssociations( +export const paginateGetLinkAssociations: ( config: NetworkManagerPaginationConfiguration, input: GetLinkAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetLinkAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetLinkAssociationsCommandInput, + GetLinkAssociationsCommandOutput +>(NetworkManagerClient, GetLinkAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetLinksPaginator.ts b/clients/client-networkmanager/src/pagination/GetLinksPaginator.ts index 35a5b8e9de9f..f432daa22ca0 100644 --- a/clients/client-networkmanager/src/pagination/GetLinksPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetLinksPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetLinksCommand, GetLinksCommandInput, GetLinksCommandOutput } from "../commands/GetLinksCommand"; import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetLinksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetLinksCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetLinks( +export const paginateGetLinks: ( config: NetworkManagerPaginationConfiguration, input: GetLinksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetLinksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetLinksCommandInput, + GetLinksCommandOutput +>(NetworkManagerClient, GetLinksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetNetworkResourceCountsPaginator.ts b/clients/client-networkmanager/src/pagination/GetNetworkResourceCountsPaginator.ts index 0a5c800c71b3..debab0b93d6d 100644 --- a/clients/client-networkmanager/src/pagination/GetNetworkResourceCountsPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetNetworkResourceCountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetNetworkResourceCountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetNetworkResourceCountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetNetworkResourceCounts( +export const paginateGetNetworkResourceCounts: ( config: NetworkManagerPaginationConfiguration, input: GetNetworkResourceCountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetNetworkResourceCountsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetNetworkResourceCountsCommandInput, + GetNetworkResourceCountsCommandOutput +>(NetworkManagerClient, GetNetworkResourceCountsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetNetworkResourceRelationshipsPaginator.ts b/clients/client-networkmanager/src/pagination/GetNetworkResourceRelationshipsPaginator.ts index 236c8a9ef47e..b0fd7a8d57b9 100644 --- a/clients/client-networkmanager/src/pagination/GetNetworkResourceRelationshipsPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetNetworkResourceRelationshipsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetNetworkResourceRelationshipsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetNetworkResourceRelationshipsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetNetworkResourceRelationships( +export const paginateGetNetworkResourceRelationships: ( config: NetworkManagerPaginationConfiguration, input: GetNetworkResourceRelationshipsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetNetworkResourceRelationshipsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetNetworkResourceRelationshipsCommandInput, + GetNetworkResourceRelationshipsCommandOutput +>(NetworkManagerClient, GetNetworkResourceRelationshipsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetNetworkResourcesPaginator.ts b/clients/client-networkmanager/src/pagination/GetNetworkResourcesPaginator.ts index 287163330f6c..77fc8cb3bdac 100644 --- a/clients/client-networkmanager/src/pagination/GetNetworkResourcesPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetNetworkResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetNetworkResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetNetworkResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetNetworkResources( +export const paginateGetNetworkResources: ( config: NetworkManagerPaginationConfiguration, input: GetNetworkResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetNetworkResourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetNetworkResourcesCommandInput, + GetNetworkResourcesCommandOutput +>(NetworkManagerClient, GetNetworkResourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetNetworkTelemetryPaginator.ts b/clients/client-networkmanager/src/pagination/GetNetworkTelemetryPaginator.ts index ea5d466d3d5d..08de85228056 100644 --- a/clients/client-networkmanager/src/pagination/GetNetworkTelemetryPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetNetworkTelemetryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetNetworkTelemetryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetNetworkTelemetryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetNetworkTelemetry( +export const paginateGetNetworkTelemetry: ( config: NetworkManagerPaginationConfiguration, input: GetNetworkTelemetryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetNetworkTelemetryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetNetworkTelemetryCommandInput, + GetNetworkTelemetryCommandOutput +>(NetworkManagerClient, GetNetworkTelemetryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetSitesPaginator.ts b/clients/client-networkmanager/src/pagination/GetSitesPaginator.ts index 39a4f82ac8a5..b38528e6dbfe 100644 --- a/clients/client-networkmanager/src/pagination/GetSitesPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetSitesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetSitesCommand, GetSitesCommandInput, GetSitesCommandOutput } from "../commands/GetSitesCommand"; import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetSitesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetSitesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetSites( +export const paginateGetSites: ( config: NetworkManagerPaginationConfiguration, input: GetSitesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetSitesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetSitesCommandInput, + GetSitesCommandOutput +>(NetworkManagerClient, GetSitesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetTransitGatewayConnectPeerAssociationsPaginator.ts b/clients/client-networkmanager/src/pagination/GetTransitGatewayConnectPeerAssociationsPaginator.ts index ccb5c3fafb22..73f85fcce13b 100644 --- a/clients/client-networkmanager/src/pagination/GetTransitGatewayConnectPeerAssociationsPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetTransitGatewayConnectPeerAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetTransitGatewayConnectPeerAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTransitGatewayConnectPeerAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTransitGatewayConnectPeerAssociations( +export const paginateGetTransitGatewayConnectPeerAssociations: ( config: NetworkManagerPaginationConfiguration, input: GetTransitGatewayConnectPeerAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTransitGatewayConnectPeerAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetTransitGatewayConnectPeerAssociationsCommandInput, + GetTransitGatewayConnectPeerAssociationsCommandOutput +>(NetworkManagerClient, GetTransitGatewayConnectPeerAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/GetTransitGatewayRegistrationsPaginator.ts b/clients/client-networkmanager/src/pagination/GetTransitGatewayRegistrationsPaginator.ts index 13f1149df1a7..5974dd584aa3 100644 --- a/clients/client-networkmanager/src/pagination/GetTransitGatewayRegistrationsPaginator.ts +++ b/clients/client-networkmanager/src/pagination/GetTransitGatewayRegistrationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: GetTransitGatewayRegistrationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTransitGatewayRegistrationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTransitGatewayRegistrations( +export const paginateGetTransitGatewayRegistrations: ( config: NetworkManagerPaginationConfiguration, input: GetTransitGatewayRegistrationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTransitGatewayRegistrationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + GetTransitGatewayRegistrationsCommandInput, + GetTransitGatewayRegistrationsCommandOutput +>(NetworkManagerClient, GetTransitGatewayRegistrationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/ListAttachmentsPaginator.ts b/clients/client-networkmanager/src/pagination/ListAttachmentsPaginator.ts index c6a9dbb38b6b..2b935f826c71 100644 --- a/clients/client-networkmanager/src/pagination/ListAttachmentsPaginator.ts +++ b/clients/client-networkmanager/src/pagination/ListAttachmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: ListAttachmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAttachmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAttachments( +export const paginateListAttachments: ( config: NetworkManagerPaginationConfiguration, input: ListAttachmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAttachmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + ListAttachmentsCommandInput, + ListAttachmentsCommandOutput +>(NetworkManagerClient, ListAttachmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/ListConnectPeersPaginator.ts b/clients/client-networkmanager/src/pagination/ListConnectPeersPaginator.ts index a92c2cfab95e..b21f2075acc7 100644 --- a/clients/client-networkmanager/src/pagination/ListConnectPeersPaginator.ts +++ b/clients/client-networkmanager/src/pagination/ListConnectPeersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: ListConnectPeersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConnectPeersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConnectPeers( +export const paginateListConnectPeers: ( config: NetworkManagerPaginationConfiguration, input: ListConnectPeersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConnectPeersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + ListConnectPeersCommandInput, + ListConnectPeersCommandOutput +>(NetworkManagerClient, ListConnectPeersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/ListCoreNetworkPolicyVersionsPaginator.ts b/clients/client-networkmanager/src/pagination/ListCoreNetworkPolicyVersionsPaginator.ts index ccb63c4054c1..8f192c668e72 100644 --- a/clients/client-networkmanager/src/pagination/ListCoreNetworkPolicyVersionsPaginator.ts +++ b/clients/client-networkmanager/src/pagination/ListCoreNetworkPolicyVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: ListCoreNetworkPolicyVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCoreNetworkPolicyVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCoreNetworkPolicyVersions( +export const paginateListCoreNetworkPolicyVersions: ( config: NetworkManagerPaginationConfiguration, input: ListCoreNetworkPolicyVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCoreNetworkPolicyVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + ListCoreNetworkPolicyVersionsCommandInput, + ListCoreNetworkPolicyVersionsCommandOutput +>(NetworkManagerClient, ListCoreNetworkPolicyVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/ListCoreNetworksPaginator.ts b/clients/client-networkmanager/src/pagination/ListCoreNetworksPaginator.ts index dad023bf8689..2752d895d459 100644 --- a/clients/client-networkmanager/src/pagination/ListCoreNetworksPaginator.ts +++ b/clients/client-networkmanager/src/pagination/ListCoreNetworksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: ListCoreNetworksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCoreNetworksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCoreNetworks( +export const paginateListCoreNetworks: ( config: NetworkManagerPaginationConfiguration, input: ListCoreNetworksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCoreNetworksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + ListCoreNetworksCommandInput, + ListCoreNetworksCommandOutput +>(NetworkManagerClient, ListCoreNetworksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-networkmanager/src/pagination/ListPeeringsPaginator.ts b/clients/client-networkmanager/src/pagination/ListPeeringsPaginator.ts index c27334ad3d88..42e7e79cc553 100644 --- a/clients/client-networkmanager/src/pagination/ListPeeringsPaginator.ts +++ b/clients/client-networkmanager/src/pagination/ListPeeringsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NetworkManagerClient } from "../NetworkManagerClient"; import { NetworkManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NetworkManagerClient, - input: ListPeeringsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPeeringsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPeerings( +export const paginateListPeerings: ( config: NetworkManagerPaginationConfiguration, input: ListPeeringsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPeeringsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof NetworkManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected NetworkManager | NetworkManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NetworkManagerPaginationConfiguration, + ListPeeringsCommandInput, + ListPeeringsCommandOutput +>(NetworkManagerClient, ListPeeringsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-nimble/src/pagination/ListEulaAcceptancesPaginator.ts b/clients/client-nimble/src/pagination/ListEulaAcceptancesPaginator.ts index f035eea9bf73..b6654a3fd0ce 100644 --- a/clients/client-nimble/src/pagination/ListEulaAcceptancesPaginator.ts +++ b/clients/client-nimble/src/pagination/ListEulaAcceptancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { NimbleClient } from "../NimbleClient"; import { NimblePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NimbleClient, - input: ListEulaAcceptancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEulaAcceptancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEulaAcceptances( +export const paginateListEulaAcceptances: ( config: NimblePaginationConfiguration, input: ListEulaAcceptancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEulaAcceptancesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof NimbleClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Nimble | NimbleClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NimblePaginationConfiguration, + ListEulaAcceptancesCommandInput, + ListEulaAcceptancesCommandOutput +>(NimbleClient, ListEulaAcceptancesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-nimble/src/pagination/ListEulasPaginator.ts b/clients/client-nimble/src/pagination/ListEulasPaginator.ts index 8233f2811642..9085f5a2a6cd 100644 --- a/clients/client-nimble/src/pagination/ListEulasPaginator.ts +++ b/clients/client-nimble/src/pagination/ListEulasPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListEulasCommand, ListEulasCommandInput, ListEulasCommandOutput } from "../commands/ListEulasCommand"; import { NimbleClient } from "../NimbleClient"; import { NimblePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NimbleClient, - input: ListEulasCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEulasCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEulas( +export const paginateListEulas: ( config: NimblePaginationConfiguration, input: ListEulasCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEulasCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof NimbleClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Nimble | NimbleClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NimblePaginationConfiguration, + ListEulasCommandInput, + ListEulasCommandOutput +>(NimbleClient, ListEulasCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-nimble/src/pagination/ListLaunchProfileMembersPaginator.ts b/clients/client-nimble/src/pagination/ListLaunchProfileMembersPaginator.ts index 193b6dff28c9..6babc90deadd 100644 --- a/clients/client-nimble/src/pagination/ListLaunchProfileMembersPaginator.ts +++ b/clients/client-nimble/src/pagination/ListLaunchProfileMembersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NimbleClient } from "../NimbleClient"; import { NimblePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NimbleClient, - input: ListLaunchProfileMembersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLaunchProfileMembersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLaunchProfileMembers( +export const paginateListLaunchProfileMembers: ( config: NimblePaginationConfiguration, input: ListLaunchProfileMembersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLaunchProfileMembersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof NimbleClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Nimble | NimbleClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NimblePaginationConfiguration, + ListLaunchProfileMembersCommandInput, + ListLaunchProfileMembersCommandOutput +>(NimbleClient, ListLaunchProfileMembersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-nimble/src/pagination/ListLaunchProfilesPaginator.ts b/clients/client-nimble/src/pagination/ListLaunchProfilesPaginator.ts index 3b0a2a779c22..4d0f7e26c13b 100644 --- a/clients/client-nimble/src/pagination/ListLaunchProfilesPaginator.ts +++ b/clients/client-nimble/src/pagination/ListLaunchProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NimbleClient } from "../NimbleClient"; import { NimblePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NimbleClient, - input: ListLaunchProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLaunchProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLaunchProfiles( +export const paginateListLaunchProfiles: ( config: NimblePaginationConfiguration, input: ListLaunchProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLaunchProfilesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof NimbleClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Nimble | NimbleClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NimblePaginationConfiguration, + ListLaunchProfilesCommandInput, + ListLaunchProfilesCommandOutput +>(NimbleClient, ListLaunchProfilesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-nimble/src/pagination/ListStreamingImagesPaginator.ts b/clients/client-nimble/src/pagination/ListStreamingImagesPaginator.ts index 7b86d344c856..e5b7f146a2e0 100644 --- a/clients/client-nimble/src/pagination/ListStreamingImagesPaginator.ts +++ b/clients/client-nimble/src/pagination/ListStreamingImagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { NimbleClient } from "../NimbleClient"; import { NimblePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NimbleClient, - input: ListStreamingImagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStreamingImagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStreamingImages( +export const paginateListStreamingImages: ( config: NimblePaginationConfiguration, input: ListStreamingImagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStreamingImagesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof NimbleClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Nimble | NimbleClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NimblePaginationConfiguration, + ListStreamingImagesCommandInput, + ListStreamingImagesCommandOutput +>(NimbleClient, ListStreamingImagesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-nimble/src/pagination/ListStreamingSessionBackupsPaginator.ts b/clients/client-nimble/src/pagination/ListStreamingSessionBackupsPaginator.ts index 6844879c6233..1f7c63c36b19 100644 --- a/clients/client-nimble/src/pagination/ListStreamingSessionBackupsPaginator.ts +++ b/clients/client-nimble/src/pagination/ListStreamingSessionBackupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { NimbleClient } from "../NimbleClient"; import { NimblePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NimbleClient, - input: ListStreamingSessionBackupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStreamingSessionBackupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStreamingSessionBackups( +export const paginateListStreamingSessionBackups: ( config: NimblePaginationConfiguration, input: ListStreamingSessionBackupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStreamingSessionBackupsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof NimbleClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Nimble | NimbleClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NimblePaginationConfiguration, + ListStreamingSessionBackupsCommandInput, + ListStreamingSessionBackupsCommandOutput +>(NimbleClient, ListStreamingSessionBackupsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-nimble/src/pagination/ListStreamingSessionsPaginator.ts b/clients/client-nimble/src/pagination/ListStreamingSessionsPaginator.ts index ec9ac13e7ca7..603341bae616 100644 --- a/clients/client-nimble/src/pagination/ListStreamingSessionsPaginator.ts +++ b/clients/client-nimble/src/pagination/ListStreamingSessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { NimbleClient } from "../NimbleClient"; import { NimblePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NimbleClient, - input: ListStreamingSessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStreamingSessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStreamingSessions( +export const paginateListStreamingSessions: ( config: NimblePaginationConfiguration, input: ListStreamingSessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStreamingSessionsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof NimbleClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Nimble | NimbleClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NimblePaginationConfiguration, + ListStreamingSessionsCommandInput, + ListStreamingSessionsCommandOutput +>(NimbleClient, ListStreamingSessionsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-nimble/src/pagination/ListStudioComponentsPaginator.ts b/clients/client-nimble/src/pagination/ListStudioComponentsPaginator.ts index 8b065987191a..4ef823c51439 100644 --- a/clients/client-nimble/src/pagination/ListStudioComponentsPaginator.ts +++ b/clients/client-nimble/src/pagination/ListStudioComponentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NimbleClient } from "../NimbleClient"; import { NimblePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NimbleClient, - input: ListStudioComponentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStudioComponentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStudioComponents( +export const paginateListStudioComponents: ( config: NimblePaginationConfiguration, input: ListStudioComponentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStudioComponentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof NimbleClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Nimble | NimbleClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NimblePaginationConfiguration, + ListStudioComponentsCommandInput, + ListStudioComponentsCommandOutput +>(NimbleClient, ListStudioComponentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-nimble/src/pagination/ListStudioMembersPaginator.ts b/clients/client-nimble/src/pagination/ListStudioMembersPaginator.ts index 9433e8f39f0d..f4453413f751 100644 --- a/clients/client-nimble/src/pagination/ListStudioMembersPaginator.ts +++ b/clients/client-nimble/src/pagination/ListStudioMembersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { NimbleClient } from "../NimbleClient"; import { NimblePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NimbleClient, - input: ListStudioMembersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStudioMembersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStudioMembers( +export const paginateListStudioMembers: ( config: NimblePaginationConfiguration, input: ListStudioMembersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStudioMembersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof NimbleClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Nimble | NimbleClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NimblePaginationConfiguration, + ListStudioMembersCommandInput, + ListStudioMembersCommandOutput +>(NimbleClient, ListStudioMembersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-nimble/src/pagination/ListStudiosPaginator.ts b/clients/client-nimble/src/pagination/ListStudiosPaginator.ts index 068f5a2479ff..43714d57f1a5 100644 --- a/clients/client-nimble/src/pagination/ListStudiosPaginator.ts +++ b/clients/client-nimble/src/pagination/ListStudiosPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListStudiosCommand, ListStudiosCommandInput, ListStudiosCommandOutput } from "../commands/ListStudiosCommand"; import { NimbleClient } from "../NimbleClient"; import { NimblePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: NimbleClient, - input: ListStudiosCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStudiosCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStudios( +export const paginateListStudios: ( config: NimblePaginationConfiguration, input: ListStudiosCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStudiosCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof NimbleClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Nimble | NimbleClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + NimblePaginationConfiguration, + ListStudiosCommandInput, + ListStudiosCommandOutput +>(NimbleClient, ListStudiosCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-oam/src/pagination/ListAttachedLinksPaginator.ts b/clients/client-oam/src/pagination/ListAttachedLinksPaginator.ts index 803929df0e48..60c145b8235f 100644 --- a/clients/client-oam/src/pagination/ListAttachedLinksPaginator.ts +++ b/clients/client-oam/src/pagination/ListAttachedLinksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OAMClient } from "../OAMClient"; import { OAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OAMClient, - input: ListAttachedLinksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAttachedLinksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAttachedLinks( +export const paginateListAttachedLinks: ( config: OAMPaginationConfiguration, input: ListAttachedLinksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAttachedLinksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OAM | OAMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OAMPaginationConfiguration, + ListAttachedLinksCommandInput, + ListAttachedLinksCommandOutput +>(OAMClient, ListAttachedLinksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-oam/src/pagination/ListLinksPaginator.ts b/clients/client-oam/src/pagination/ListLinksPaginator.ts index a3af252a29cd..0bf7f5357a64 100644 --- a/clients/client-oam/src/pagination/ListLinksPaginator.ts +++ b/clients/client-oam/src/pagination/ListLinksPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListLinksCommand, ListLinksCommandInput, ListLinksCommandOutput } from "../commands/ListLinksCommand"; import { OAMClient } from "../OAMClient"; import { OAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OAMClient, - input: ListLinksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLinksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLinks( +export const paginateListLinks: ( config: OAMPaginationConfiguration, input: ListLinksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLinksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OAM | OAMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OAMPaginationConfiguration, + ListLinksCommandInput, + ListLinksCommandOutput +>(OAMClient, ListLinksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-oam/src/pagination/ListSinksPaginator.ts b/clients/client-oam/src/pagination/ListSinksPaginator.ts index a203347b226e..1084567f183b 100644 --- a/clients/client-oam/src/pagination/ListSinksPaginator.ts +++ b/clients/client-oam/src/pagination/ListSinksPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListSinksCommand, ListSinksCommandInput, ListSinksCommandOutput } from "../commands/ListSinksCommand"; import { OAMClient } from "../OAMClient"; import { OAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OAMClient, - input: ListSinksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSinksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSinks( +export const paginateListSinks: ( config: OAMPaginationConfiguration, input: ListSinksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSinksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OAM | OAMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OAMPaginationConfiguration, + ListSinksCommandInput, + ListSinksCommandOutput +>(OAMClient, ListSinksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-omics/src/pagination/ListAnnotationImportJobsPaginator.ts b/clients/client-omics/src/pagination/ListAnnotationImportJobsPaginator.ts index e4a71a5df3e2..63f71082de1d 100644 --- a/clients/client-omics/src/pagination/ListAnnotationImportJobsPaginator.ts +++ b/clients/client-omics/src/pagination/ListAnnotationImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListAnnotationImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnnotationImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnnotationImportJobs( +export const paginateListAnnotationImportJobs: ( config: OmicsPaginationConfiguration, input: ListAnnotationImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnnotationImportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListAnnotationImportJobsCommandInput, + ListAnnotationImportJobsCommandOutput +>(OmicsClient, ListAnnotationImportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListAnnotationStoreVersionsPaginator.ts b/clients/client-omics/src/pagination/ListAnnotationStoreVersionsPaginator.ts index 4c5b3d6e6fe3..f8d4db7e7b01 100644 --- a/clients/client-omics/src/pagination/ListAnnotationStoreVersionsPaginator.ts +++ b/clients/client-omics/src/pagination/ListAnnotationStoreVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListAnnotationStoreVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnnotationStoreVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnnotationStoreVersions( +export const paginateListAnnotationStoreVersions: ( config: OmicsPaginationConfiguration, input: ListAnnotationStoreVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnnotationStoreVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListAnnotationStoreVersionsCommandInput, + ListAnnotationStoreVersionsCommandOutput +>(OmicsClient, ListAnnotationStoreVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListAnnotationStoresPaginator.ts b/clients/client-omics/src/pagination/ListAnnotationStoresPaginator.ts index 9d6ea2f1eb40..378987cd54b4 100644 --- a/clients/client-omics/src/pagination/ListAnnotationStoresPaginator.ts +++ b/clients/client-omics/src/pagination/ListAnnotationStoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListAnnotationStoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnnotationStoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnnotationStores( +export const paginateListAnnotationStores: ( config: OmicsPaginationConfiguration, input: ListAnnotationStoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnnotationStoresCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListAnnotationStoresCommandInput, + ListAnnotationStoresCommandOutput +>(OmicsClient, ListAnnotationStoresCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListMultipartReadSetUploadsPaginator.ts b/clients/client-omics/src/pagination/ListMultipartReadSetUploadsPaginator.ts index 083491f20d0a..4aa001a78661 100644 --- a/clients/client-omics/src/pagination/ListMultipartReadSetUploadsPaginator.ts +++ b/clients/client-omics/src/pagination/ListMultipartReadSetUploadsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListMultipartReadSetUploadsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMultipartReadSetUploadsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMultipartReadSetUploads( +export const paginateListMultipartReadSetUploads: ( config: OmicsPaginationConfiguration, input: ListMultipartReadSetUploadsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMultipartReadSetUploadsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListMultipartReadSetUploadsCommandInput, + ListMultipartReadSetUploadsCommandOutput +>(OmicsClient, ListMultipartReadSetUploadsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListReadSetActivationJobsPaginator.ts b/clients/client-omics/src/pagination/ListReadSetActivationJobsPaginator.ts index e1375fc195ae..662bca09aab5 100644 --- a/clients/client-omics/src/pagination/ListReadSetActivationJobsPaginator.ts +++ b/clients/client-omics/src/pagination/ListReadSetActivationJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListReadSetActivationJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReadSetActivationJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReadSetActivationJobs( +export const paginateListReadSetActivationJobs: ( config: OmicsPaginationConfiguration, input: ListReadSetActivationJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReadSetActivationJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListReadSetActivationJobsCommandInput, + ListReadSetActivationJobsCommandOutput +>(OmicsClient, ListReadSetActivationJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListReadSetExportJobsPaginator.ts b/clients/client-omics/src/pagination/ListReadSetExportJobsPaginator.ts index ac963211fb5a..8b3e190a631d 100644 --- a/clients/client-omics/src/pagination/ListReadSetExportJobsPaginator.ts +++ b/clients/client-omics/src/pagination/ListReadSetExportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListReadSetExportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReadSetExportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReadSetExportJobs( +export const paginateListReadSetExportJobs: ( config: OmicsPaginationConfiguration, input: ListReadSetExportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReadSetExportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListReadSetExportJobsCommandInput, + ListReadSetExportJobsCommandOutput +>(OmicsClient, ListReadSetExportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListReadSetImportJobsPaginator.ts b/clients/client-omics/src/pagination/ListReadSetImportJobsPaginator.ts index 3910edaf8b81..9003b172dc4d 100644 --- a/clients/client-omics/src/pagination/ListReadSetImportJobsPaginator.ts +++ b/clients/client-omics/src/pagination/ListReadSetImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListReadSetImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReadSetImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReadSetImportJobs( +export const paginateListReadSetImportJobs: ( config: OmicsPaginationConfiguration, input: ListReadSetImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReadSetImportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListReadSetImportJobsCommandInput, + ListReadSetImportJobsCommandOutput +>(OmicsClient, ListReadSetImportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListReadSetUploadPartsPaginator.ts b/clients/client-omics/src/pagination/ListReadSetUploadPartsPaginator.ts index 36d533589096..1ff2f9a5daa1 100644 --- a/clients/client-omics/src/pagination/ListReadSetUploadPartsPaginator.ts +++ b/clients/client-omics/src/pagination/ListReadSetUploadPartsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListReadSetUploadPartsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReadSetUploadPartsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReadSetUploadParts( +export const paginateListReadSetUploadParts: ( config: OmicsPaginationConfiguration, input: ListReadSetUploadPartsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReadSetUploadPartsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListReadSetUploadPartsCommandInput, + ListReadSetUploadPartsCommandOutput +>(OmicsClient, ListReadSetUploadPartsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListReadSetsPaginator.ts b/clients/client-omics/src/pagination/ListReadSetsPaginator.ts index 0c101f35fa7c..effaeef57823 100644 --- a/clients/client-omics/src/pagination/ListReadSetsPaginator.ts +++ b/clients/client-omics/src/pagination/ListReadSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListReadSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReadSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReadSets( +export const paginateListReadSets: ( config: OmicsPaginationConfiguration, input: ListReadSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReadSetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListReadSetsCommandInput, + ListReadSetsCommandOutput +>(OmicsClient, ListReadSetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListReferenceImportJobsPaginator.ts b/clients/client-omics/src/pagination/ListReferenceImportJobsPaginator.ts index 775e339cbe1b..b32f9323e9a1 100644 --- a/clients/client-omics/src/pagination/ListReferenceImportJobsPaginator.ts +++ b/clients/client-omics/src/pagination/ListReferenceImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListReferenceImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReferenceImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReferenceImportJobs( +export const paginateListReferenceImportJobs: ( config: OmicsPaginationConfiguration, input: ListReferenceImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReferenceImportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListReferenceImportJobsCommandInput, + ListReferenceImportJobsCommandOutput +>(OmicsClient, ListReferenceImportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListReferenceStoresPaginator.ts b/clients/client-omics/src/pagination/ListReferenceStoresPaginator.ts index 164600f5d8eb..cd4c62cd0f7d 100644 --- a/clients/client-omics/src/pagination/ListReferenceStoresPaginator.ts +++ b/clients/client-omics/src/pagination/ListReferenceStoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListReferenceStoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReferenceStoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReferenceStores( +export const paginateListReferenceStores: ( config: OmicsPaginationConfiguration, input: ListReferenceStoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReferenceStoresCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListReferenceStoresCommandInput, + ListReferenceStoresCommandOutput +>(OmicsClient, ListReferenceStoresCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListReferencesPaginator.ts b/clients/client-omics/src/pagination/ListReferencesPaginator.ts index 66aecc632787..45fe56f5470d 100644 --- a/clients/client-omics/src/pagination/ListReferencesPaginator.ts +++ b/clients/client-omics/src/pagination/ListReferencesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListReferencesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReferencesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReferences( +export const paginateListReferences: ( config: OmicsPaginationConfiguration, input: ListReferencesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReferencesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListReferencesCommandInput, + ListReferencesCommandOutput +>(OmicsClient, ListReferencesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListRunGroupsPaginator.ts b/clients/client-omics/src/pagination/ListRunGroupsPaginator.ts index 69ac69056937..4c6bea986ba2 100644 --- a/clients/client-omics/src/pagination/ListRunGroupsPaginator.ts +++ b/clients/client-omics/src/pagination/ListRunGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListRunGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRunGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRunGroups( +export const paginateListRunGroups: ( config: OmicsPaginationConfiguration, input: ListRunGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.startingToken - let token: typeof input.startingToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRunGroupsCommandOutput; - while (hasNext) { - input.startingToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListRunGroupsCommandInput, + ListRunGroupsCommandOutput +>(OmicsClient, ListRunGroupsCommand, "startingToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListRunTasksPaginator.ts b/clients/client-omics/src/pagination/ListRunTasksPaginator.ts index f1d79d9b37fe..1e3210cc3a2e 100644 --- a/clients/client-omics/src/pagination/ListRunTasksPaginator.ts +++ b/clients/client-omics/src/pagination/ListRunTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListRunTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRunTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRunTasks( +export const paginateListRunTasks: ( config: OmicsPaginationConfiguration, input: ListRunTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.startingToken - let token: typeof input.startingToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRunTasksCommandOutput; - while (hasNext) { - input.startingToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListRunTasksCommandInput, + ListRunTasksCommandOutput +>(OmicsClient, ListRunTasksCommand, "startingToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListRunsPaginator.ts b/clients/client-omics/src/pagination/ListRunsPaginator.ts index 18e8c47ea2a0..a59e4bda3c53 100644 --- a/clients/client-omics/src/pagination/ListRunsPaginator.ts +++ b/clients/client-omics/src/pagination/ListRunsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListRunsCommand, ListRunsCommandInput, ListRunsCommandOutput } from "../commands/ListRunsCommand"; import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRuns( +export const paginateListRuns: ( config: OmicsPaginationConfiguration, input: ListRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.startingToken - let token: typeof input.startingToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRunsCommandOutput; - while (hasNext) { - input.startingToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListRunsCommandInput, + ListRunsCommandOutput +>(OmicsClient, ListRunsCommand, "startingToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListSequenceStoresPaginator.ts b/clients/client-omics/src/pagination/ListSequenceStoresPaginator.ts index 9ed165456d96..f0d61eeb5bb8 100644 --- a/clients/client-omics/src/pagination/ListSequenceStoresPaginator.ts +++ b/clients/client-omics/src/pagination/ListSequenceStoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListSequenceStoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSequenceStoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSequenceStores( +export const paginateListSequenceStores: ( config: OmicsPaginationConfiguration, input: ListSequenceStoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSequenceStoresCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListSequenceStoresCommandInput, + ListSequenceStoresCommandOutput +>(OmicsClient, ListSequenceStoresCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListSharesPaginator.ts b/clients/client-omics/src/pagination/ListSharesPaginator.ts index 261f76a99179..53f5fe780879 100644 --- a/clients/client-omics/src/pagination/ListSharesPaginator.ts +++ b/clients/client-omics/src/pagination/ListSharesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListSharesCommand, ListSharesCommandInput, ListSharesCommandOutput } from "../commands/ListSharesCommand"; import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListSharesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSharesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListShares( +export const paginateListShares: ( config: OmicsPaginationConfiguration, input: ListSharesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSharesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListSharesCommandInput, + ListSharesCommandOutput +>(OmicsClient, ListSharesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListVariantImportJobsPaginator.ts b/clients/client-omics/src/pagination/ListVariantImportJobsPaginator.ts index e3d13857098f..acc62b8afa35 100644 --- a/clients/client-omics/src/pagination/ListVariantImportJobsPaginator.ts +++ b/clients/client-omics/src/pagination/ListVariantImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListVariantImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVariantImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVariantImportJobs( +export const paginateListVariantImportJobs: ( config: OmicsPaginationConfiguration, input: ListVariantImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVariantImportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListVariantImportJobsCommandInput, + ListVariantImportJobsCommandOutput +>(OmicsClient, ListVariantImportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListVariantStoresPaginator.ts b/clients/client-omics/src/pagination/ListVariantStoresPaginator.ts index 5470cfc754f9..0d060b1a8203 100644 --- a/clients/client-omics/src/pagination/ListVariantStoresPaginator.ts +++ b/clients/client-omics/src/pagination/ListVariantStoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListVariantStoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVariantStoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVariantStores( +export const paginateListVariantStores: ( config: OmicsPaginationConfiguration, input: ListVariantStoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVariantStoresCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListVariantStoresCommandInput, + ListVariantStoresCommandOutput +>(OmicsClient, ListVariantStoresCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-omics/src/pagination/ListWorkflowsPaginator.ts b/clients/client-omics/src/pagination/ListWorkflowsPaginator.ts index d28750ed645d..3b885110054f 100644 --- a/clients/client-omics/src/pagination/ListWorkflowsPaginator.ts +++ b/clients/client-omics/src/pagination/ListWorkflowsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OmicsClient } from "../OmicsClient"; import { OmicsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OmicsClient, - input: ListWorkflowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkflowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkflows( +export const paginateListWorkflows: ( config: OmicsPaginationConfiguration, input: ListWorkflowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.startingToken - let token: typeof input.startingToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkflowsCommandOutput; - while (hasNext) { - input.startingToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof OmicsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Omics | OmicsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OmicsPaginationConfiguration, + ListWorkflowsCommandInput, + ListWorkflowsCommandOutput +>(OmicsClient, ListWorkflowsCommand, "startingToken", "nextToken", "maxResults"); diff --git a/clients/client-opensearch/src/pagination/DescribeDomainAutoTunesPaginator.ts b/clients/client-opensearch/src/pagination/DescribeDomainAutoTunesPaginator.ts index 902de57f2c6e..8aa865f92079 100644 --- a/clients/client-opensearch/src/pagination/DescribeDomainAutoTunesPaginator.ts +++ b/clients/client-opensearch/src/pagination/DescribeDomainAutoTunesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpenSearchClient } from "../OpenSearchClient"; import { OpenSearchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchClient, - input: DescribeDomainAutoTunesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDomainAutoTunesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDomainAutoTunes( +export const paginateDescribeDomainAutoTunes: ( config: OpenSearchPaginationConfiguration, input: DescribeDomainAutoTunesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDomainAutoTunesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpenSearchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearch | OpenSearchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchPaginationConfiguration, + DescribeDomainAutoTunesCommandInput, + DescribeDomainAutoTunesCommandOutput +>(OpenSearchClient, DescribeDomainAutoTunesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opensearch/src/pagination/DescribeInboundConnectionsPaginator.ts b/clients/client-opensearch/src/pagination/DescribeInboundConnectionsPaginator.ts index 8a200302ee30..ece8737e5dba 100644 --- a/clients/client-opensearch/src/pagination/DescribeInboundConnectionsPaginator.ts +++ b/clients/client-opensearch/src/pagination/DescribeInboundConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpenSearchClient } from "../OpenSearchClient"; import { OpenSearchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchClient, - input: DescribeInboundConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInboundConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInboundConnections( +export const paginateDescribeInboundConnections: ( config: OpenSearchPaginationConfiguration, input: DescribeInboundConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInboundConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpenSearchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearch | OpenSearchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchPaginationConfiguration, + DescribeInboundConnectionsCommandInput, + DescribeInboundConnectionsCommandOutput +>(OpenSearchClient, DescribeInboundConnectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opensearch/src/pagination/DescribeOutboundConnectionsPaginator.ts b/clients/client-opensearch/src/pagination/DescribeOutboundConnectionsPaginator.ts index b3a91a7d9775..0d90b6e010c7 100644 --- a/clients/client-opensearch/src/pagination/DescribeOutboundConnectionsPaginator.ts +++ b/clients/client-opensearch/src/pagination/DescribeOutboundConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpenSearchClient } from "../OpenSearchClient"; import { OpenSearchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchClient, - input: DescribeOutboundConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOutboundConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOutboundConnections( +export const paginateDescribeOutboundConnections: ( config: OpenSearchPaginationConfiguration, input: DescribeOutboundConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOutboundConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpenSearchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearch | OpenSearchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchPaginationConfiguration, + DescribeOutboundConnectionsCommandInput, + DescribeOutboundConnectionsCommandOutput +>(OpenSearchClient, DescribeOutboundConnectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opensearch/src/pagination/DescribePackagesPaginator.ts b/clients/client-opensearch/src/pagination/DescribePackagesPaginator.ts index 89fa96991f4a..96e3b1060f70 100644 --- a/clients/client-opensearch/src/pagination/DescribePackagesPaginator.ts +++ b/clients/client-opensearch/src/pagination/DescribePackagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpenSearchClient } from "../OpenSearchClient"; import { OpenSearchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchClient, - input: DescribePackagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePackagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePackages( +export const paginateDescribePackages: ( config: OpenSearchPaginationConfiguration, input: DescribePackagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePackagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpenSearchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearch | OpenSearchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchPaginationConfiguration, + DescribePackagesCommandInput, + DescribePackagesCommandOutput +>(OpenSearchClient, DescribePackagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opensearch/src/pagination/DescribeReservedInstanceOfferingsPaginator.ts b/clients/client-opensearch/src/pagination/DescribeReservedInstanceOfferingsPaginator.ts index d67724bb8b41..0c924fd677e8 100644 --- a/clients/client-opensearch/src/pagination/DescribeReservedInstanceOfferingsPaginator.ts +++ b/clients/client-opensearch/src/pagination/DescribeReservedInstanceOfferingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpenSearchClient } from "../OpenSearchClient"; import { OpenSearchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchClient, - input: DescribeReservedInstanceOfferingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedInstanceOfferingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedInstanceOfferings( +export const paginateDescribeReservedInstanceOfferings: ( config: OpenSearchPaginationConfiguration, input: DescribeReservedInstanceOfferingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedInstanceOfferingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpenSearchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearch | OpenSearchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchPaginationConfiguration, + DescribeReservedInstanceOfferingsCommandInput, + DescribeReservedInstanceOfferingsCommandOutput +>(OpenSearchClient, DescribeReservedInstanceOfferingsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opensearch/src/pagination/DescribeReservedInstancesPaginator.ts b/clients/client-opensearch/src/pagination/DescribeReservedInstancesPaginator.ts index 698bccbbc3d8..935716f8d531 100644 --- a/clients/client-opensearch/src/pagination/DescribeReservedInstancesPaginator.ts +++ b/clients/client-opensearch/src/pagination/DescribeReservedInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpenSearchClient } from "../OpenSearchClient"; import { OpenSearchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchClient, - input: DescribeReservedInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedInstances( +export const paginateDescribeReservedInstances: ( config: OpenSearchPaginationConfiguration, input: DescribeReservedInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpenSearchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearch | OpenSearchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchPaginationConfiguration, + DescribeReservedInstancesCommandInput, + DescribeReservedInstancesCommandOutput +>(OpenSearchClient, DescribeReservedInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opensearch/src/pagination/GetPackageVersionHistoryPaginator.ts b/clients/client-opensearch/src/pagination/GetPackageVersionHistoryPaginator.ts index 66831af4b30c..773a74ba9c66 100644 --- a/clients/client-opensearch/src/pagination/GetPackageVersionHistoryPaginator.ts +++ b/clients/client-opensearch/src/pagination/GetPackageVersionHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpenSearchClient } from "../OpenSearchClient"; import { OpenSearchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchClient, - input: GetPackageVersionHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetPackageVersionHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetPackageVersionHistory( +export const paginateGetPackageVersionHistory: ( config: OpenSearchPaginationConfiguration, input: GetPackageVersionHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetPackageVersionHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpenSearchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearch | OpenSearchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchPaginationConfiguration, + GetPackageVersionHistoryCommandInput, + GetPackageVersionHistoryCommandOutput +>(OpenSearchClient, GetPackageVersionHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opensearch/src/pagination/GetUpgradeHistoryPaginator.ts b/clients/client-opensearch/src/pagination/GetUpgradeHistoryPaginator.ts index c0e66b1261a8..eb6468f2aa31 100644 --- a/clients/client-opensearch/src/pagination/GetUpgradeHistoryPaginator.ts +++ b/clients/client-opensearch/src/pagination/GetUpgradeHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpenSearchClient } from "../OpenSearchClient"; import { OpenSearchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchClient, - input: GetUpgradeHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetUpgradeHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetUpgradeHistory( +export const paginateGetUpgradeHistory: ( config: OpenSearchPaginationConfiguration, input: GetUpgradeHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetUpgradeHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpenSearchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearch | OpenSearchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchPaginationConfiguration, + GetUpgradeHistoryCommandInput, + GetUpgradeHistoryCommandOutput +>(OpenSearchClient, GetUpgradeHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opensearch/src/pagination/ListDomainMaintenancesPaginator.ts b/clients/client-opensearch/src/pagination/ListDomainMaintenancesPaginator.ts index 050dfbc9800f..201b2aecf5e0 100644 --- a/clients/client-opensearch/src/pagination/ListDomainMaintenancesPaginator.ts +++ b/clients/client-opensearch/src/pagination/ListDomainMaintenancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpenSearchClient } from "../OpenSearchClient"; import { OpenSearchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchClient, - input: ListDomainMaintenancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainMaintenancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomainMaintenances( +export const paginateListDomainMaintenances: ( config: OpenSearchPaginationConfiguration, input: ListDomainMaintenancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainMaintenancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpenSearchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearch | OpenSearchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchPaginationConfiguration, + ListDomainMaintenancesCommandInput, + ListDomainMaintenancesCommandOutput +>(OpenSearchClient, ListDomainMaintenancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opensearch/src/pagination/ListDomainsForPackagePaginator.ts b/clients/client-opensearch/src/pagination/ListDomainsForPackagePaginator.ts index d11e703e2b40..a759ea3c6a28 100644 --- a/clients/client-opensearch/src/pagination/ListDomainsForPackagePaginator.ts +++ b/clients/client-opensearch/src/pagination/ListDomainsForPackagePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpenSearchClient } from "../OpenSearchClient"; import { OpenSearchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchClient, - input: ListDomainsForPackageCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainsForPackageCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomainsForPackage( +export const paginateListDomainsForPackage: ( config: OpenSearchPaginationConfiguration, input: ListDomainsForPackageCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainsForPackageCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpenSearchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearch | OpenSearchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchPaginationConfiguration, + ListDomainsForPackageCommandInput, + ListDomainsForPackageCommandOutput +>(OpenSearchClient, ListDomainsForPackageCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opensearch/src/pagination/ListInstanceTypeDetailsPaginator.ts b/clients/client-opensearch/src/pagination/ListInstanceTypeDetailsPaginator.ts index 59cc83254b0c..2c2cde4b87d6 100644 --- a/clients/client-opensearch/src/pagination/ListInstanceTypeDetailsPaginator.ts +++ b/clients/client-opensearch/src/pagination/ListInstanceTypeDetailsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpenSearchClient } from "../OpenSearchClient"; import { OpenSearchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchClient, - input: ListInstanceTypeDetailsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInstanceTypeDetailsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInstanceTypeDetails( +export const paginateListInstanceTypeDetails: ( config: OpenSearchPaginationConfiguration, input: ListInstanceTypeDetailsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInstanceTypeDetailsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpenSearchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearch | OpenSearchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchPaginationConfiguration, + ListInstanceTypeDetailsCommandInput, + ListInstanceTypeDetailsCommandOutput +>(OpenSearchClient, ListInstanceTypeDetailsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opensearch/src/pagination/ListPackagesForDomainPaginator.ts b/clients/client-opensearch/src/pagination/ListPackagesForDomainPaginator.ts index d38e6ed46d8c..ba0109822ce6 100644 --- a/clients/client-opensearch/src/pagination/ListPackagesForDomainPaginator.ts +++ b/clients/client-opensearch/src/pagination/ListPackagesForDomainPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpenSearchClient } from "../OpenSearchClient"; import { OpenSearchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchClient, - input: ListPackagesForDomainCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPackagesForDomainCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPackagesForDomain( +export const paginateListPackagesForDomain: ( config: OpenSearchPaginationConfiguration, input: ListPackagesForDomainCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPackagesForDomainCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpenSearchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearch | OpenSearchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchPaginationConfiguration, + ListPackagesForDomainCommandInput, + ListPackagesForDomainCommandOutput +>(OpenSearchClient, ListPackagesForDomainCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opensearch/src/pagination/ListScheduledActionsPaginator.ts b/clients/client-opensearch/src/pagination/ListScheduledActionsPaginator.ts index 322d1254c0bf..0ac84b840cca 100644 --- a/clients/client-opensearch/src/pagination/ListScheduledActionsPaginator.ts +++ b/clients/client-opensearch/src/pagination/ListScheduledActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpenSearchClient } from "../OpenSearchClient"; import { OpenSearchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchClient, - input: ListScheduledActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListScheduledActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListScheduledActions( +export const paginateListScheduledActions: ( config: OpenSearchPaginationConfiguration, input: ListScheduledActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListScheduledActionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpenSearchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearch | OpenSearchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchPaginationConfiguration, + ListScheduledActionsCommandInput, + ListScheduledActionsCommandOutput +>(OpenSearchClient, ListScheduledActionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opensearch/src/pagination/ListVersionsPaginator.ts b/clients/client-opensearch/src/pagination/ListVersionsPaginator.ts index 779714449676..c3740cf0630a 100644 --- a/clients/client-opensearch/src/pagination/ListVersionsPaginator.ts +++ b/clients/client-opensearch/src/pagination/ListVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpenSearchClient } from "../OpenSearchClient"; import { OpenSearchPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchClient, - input: ListVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVersions( +export const paginateListVersions: ( config: OpenSearchPaginationConfiguration, input: ListVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpenSearchClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearch | OpenSearchClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchPaginationConfiguration, + ListVersionsCommandInput, + ListVersionsCommandOutput +>(OpenSearchClient, ListVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opensearchserverless/package.json b/clients/client-opensearchserverless/package.json index 54602641eaff..83bff0c64fe4 100644 --- a/clients/client-opensearchserverless/package.json +++ b/clients/client-opensearchserverless/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-opensearchserverless/src/pagination/ListAccessPoliciesPaginator.ts b/clients/client-opensearchserverless/src/pagination/ListAccessPoliciesPaginator.ts index ee4c0e656872..843c42a6c11c 100644 --- a/clients/client-opensearchserverless/src/pagination/ListAccessPoliciesPaginator.ts +++ b/clients/client-opensearchserverless/src/pagination/ListAccessPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { OpenSearchServerlessClient } from "../OpenSearchServerlessClient"; import { OpenSearchServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchServerlessClient, - input: ListAccessPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessPolicies( +export const paginateListAccessPolicies: ( config: OpenSearchServerlessPaginationConfiguration, input: ListAccessPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessPoliciesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof OpenSearchServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearchServerless | OpenSearchServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchServerlessPaginationConfiguration, + ListAccessPoliciesCommandInput, + ListAccessPoliciesCommandOutput +>(OpenSearchServerlessClient, ListAccessPoliciesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-opensearchserverless/src/pagination/ListCollectionsPaginator.ts b/clients/client-opensearchserverless/src/pagination/ListCollectionsPaginator.ts index 4c39e05f73e0..3e5b2e9a0d6d 100644 --- a/clients/client-opensearchserverless/src/pagination/ListCollectionsPaginator.ts +++ b/clients/client-opensearchserverless/src/pagination/ListCollectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { OpenSearchServerlessClient } from "../OpenSearchServerlessClient"; import { OpenSearchServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchServerlessClient, - input: ListCollectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCollectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCollections( +export const paginateListCollections: ( config: OpenSearchServerlessPaginationConfiguration, input: ListCollectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCollectionsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof OpenSearchServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearchServerless | OpenSearchServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchServerlessPaginationConfiguration, + ListCollectionsCommandInput, + ListCollectionsCommandOutput +>(OpenSearchServerlessClient, ListCollectionsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-opensearchserverless/src/pagination/ListLifecyclePoliciesPaginator.ts b/clients/client-opensearchserverless/src/pagination/ListLifecyclePoliciesPaginator.ts index afbffbf69be7..d2d9dee71cb7 100644 --- a/clients/client-opensearchserverless/src/pagination/ListLifecyclePoliciesPaginator.ts +++ b/clients/client-opensearchserverless/src/pagination/ListLifecyclePoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { OpenSearchServerlessClient } from "../OpenSearchServerlessClient"; import { OpenSearchServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchServerlessClient, - input: ListLifecyclePoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLifecyclePoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLifecyclePolicies( +export const paginateListLifecyclePolicies: ( config: OpenSearchServerlessPaginationConfiguration, input: ListLifecyclePoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLifecyclePoliciesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof OpenSearchServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearchServerless | OpenSearchServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchServerlessPaginationConfiguration, + ListLifecyclePoliciesCommandInput, + ListLifecyclePoliciesCommandOutput +>(OpenSearchServerlessClient, ListLifecyclePoliciesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-opensearchserverless/src/pagination/ListSecurityConfigsPaginator.ts b/clients/client-opensearchserverless/src/pagination/ListSecurityConfigsPaginator.ts index 95f2810ad242..3f46f77ffe30 100644 --- a/clients/client-opensearchserverless/src/pagination/ListSecurityConfigsPaginator.ts +++ b/clients/client-opensearchserverless/src/pagination/ListSecurityConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { OpenSearchServerlessClient } from "../OpenSearchServerlessClient"; import { OpenSearchServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchServerlessClient, - input: ListSecurityConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSecurityConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSecurityConfigs( +export const paginateListSecurityConfigs: ( config: OpenSearchServerlessPaginationConfiguration, input: ListSecurityConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSecurityConfigsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof OpenSearchServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearchServerless | OpenSearchServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchServerlessPaginationConfiguration, + ListSecurityConfigsCommandInput, + ListSecurityConfigsCommandOutput +>(OpenSearchServerlessClient, ListSecurityConfigsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-opensearchserverless/src/pagination/ListSecurityPoliciesPaginator.ts b/clients/client-opensearchserverless/src/pagination/ListSecurityPoliciesPaginator.ts index 24b42f4d6c3c..9e9c82dff243 100644 --- a/clients/client-opensearchserverless/src/pagination/ListSecurityPoliciesPaginator.ts +++ b/clients/client-opensearchserverless/src/pagination/ListSecurityPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { OpenSearchServerlessClient } from "../OpenSearchServerlessClient"; import { OpenSearchServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchServerlessClient, - input: ListSecurityPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSecurityPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSecurityPolicies( +export const paginateListSecurityPolicies: ( config: OpenSearchServerlessPaginationConfiguration, input: ListSecurityPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSecurityPoliciesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof OpenSearchServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearchServerless | OpenSearchServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchServerlessPaginationConfiguration, + ListSecurityPoliciesCommandInput, + ListSecurityPoliciesCommandOutput +>(OpenSearchServerlessClient, ListSecurityPoliciesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-opensearchserverless/src/pagination/ListVpcEndpointsPaginator.ts b/clients/client-opensearchserverless/src/pagination/ListVpcEndpointsPaginator.ts index 91a9924acdc2..47ef0760ae30 100644 --- a/clients/client-opensearchserverless/src/pagination/ListVpcEndpointsPaginator.ts +++ b/clients/client-opensearchserverless/src/pagination/ListVpcEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { OpenSearchServerlessClient } from "../OpenSearchServerlessClient"; import { OpenSearchServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpenSearchServerlessClient, - input: ListVpcEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVpcEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVpcEndpoints( +export const paginateListVpcEndpoints: ( config: OpenSearchServerlessPaginationConfiguration, input: ListVpcEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVpcEndpointsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof OpenSearchServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpenSearchServerless | OpenSearchServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpenSearchServerlessPaginationConfiguration, + ListVpcEndpointsCommandInput, + ListVpcEndpointsCommandOutput +>(OpenSearchServerlessClient, ListVpcEndpointsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-opsworks/package.json b/clients/client-opsworks/package.json index 64502986db09..3e4994adeec9 100644 --- a/clients/client-opsworks/package.json +++ b/clients/client-opsworks/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-opsworks/src/pagination/DescribeEcsClustersPaginator.ts b/clients/client-opsworks/src/pagination/DescribeEcsClustersPaginator.ts index c824d17775a1..907bb4a6cd4e 100644 --- a/clients/client-opsworks/src/pagination/DescribeEcsClustersPaginator.ts +++ b/clients/client-opsworks/src/pagination/DescribeEcsClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpsWorksClient } from "../OpsWorksClient"; import { OpsWorksPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpsWorksClient, - input: DescribeEcsClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEcsClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEcsClusters( +export const paginateDescribeEcsClusters: ( config: OpsWorksPaginationConfiguration, input: DescribeEcsClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEcsClustersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpsWorksClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpsWorks | OpsWorksClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpsWorksPaginationConfiguration, + DescribeEcsClustersCommandInput, + DescribeEcsClustersCommandOutput +>(OpsWorksClient, DescribeEcsClustersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opsworkscm/package.json b/clients/client-opsworkscm/package.json index 0b9c7ebd65e2..042015860c90 100644 --- a/clients/client-opsworkscm/package.json +++ b/clients/client-opsworkscm/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-opsworkscm/src/pagination/DescribeBackupsPaginator.ts b/clients/client-opsworkscm/src/pagination/DescribeBackupsPaginator.ts index 6ec3cc007039..ed34833314a3 100644 --- a/clients/client-opsworkscm/src/pagination/DescribeBackupsPaginator.ts +++ b/clients/client-opsworkscm/src/pagination/DescribeBackupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpsWorksCMClient } from "../OpsWorksCMClient"; import { OpsWorksCMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpsWorksCMClient, - input: DescribeBackupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeBackupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeBackups( +export const paginateDescribeBackups: ( config: OpsWorksCMPaginationConfiguration, input: DescribeBackupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeBackupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpsWorksCMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpsWorksCM | OpsWorksCMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpsWorksCMPaginationConfiguration, + DescribeBackupsCommandInput, + DescribeBackupsCommandOutput +>(OpsWorksCMClient, DescribeBackupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opsworkscm/src/pagination/DescribeEventsPaginator.ts b/clients/client-opsworkscm/src/pagination/DescribeEventsPaginator.ts index bbba3f55753c..9dc552de2be4 100644 --- a/clients/client-opsworkscm/src/pagination/DescribeEventsPaginator.ts +++ b/clients/client-opsworkscm/src/pagination/DescribeEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpsWorksCMClient } from "../OpsWorksCMClient"; import { OpsWorksCMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpsWorksCMClient, - input: DescribeEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEvents( +export const paginateDescribeEvents: ( config: OpsWorksCMPaginationConfiguration, input: DescribeEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpsWorksCMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpsWorksCM | OpsWorksCMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpsWorksCMPaginationConfiguration, + DescribeEventsCommandInput, + DescribeEventsCommandOutput +>(OpsWorksCMClient, DescribeEventsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opsworkscm/src/pagination/DescribeServersPaginator.ts b/clients/client-opsworkscm/src/pagination/DescribeServersPaginator.ts index b9a814efcdf5..0fc9cac307a2 100644 --- a/clients/client-opsworkscm/src/pagination/DescribeServersPaginator.ts +++ b/clients/client-opsworkscm/src/pagination/DescribeServersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpsWorksCMClient } from "../OpsWorksCMClient"; import { OpsWorksCMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpsWorksCMClient, - input: DescribeServersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeServersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeServers( +export const paginateDescribeServers: ( config: OpsWorksCMPaginationConfiguration, input: DescribeServersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeServersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpsWorksCMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpsWorksCM | OpsWorksCMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpsWorksCMPaginationConfiguration, + DescribeServersCommandInput, + DescribeServersCommandOutput +>(OpsWorksCMClient, DescribeServersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-opsworkscm/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-opsworkscm/src/pagination/ListTagsForResourcePaginator.ts index 27bf8808273c..2bf2cc546660 100644 --- a/clients/client-opsworkscm/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-opsworkscm/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OpsWorksCMClient } from "../OpsWorksCMClient"; import { OpsWorksCMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OpsWorksCMClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: OpsWorksCMPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OpsWorksCMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OpsWorksCM | OpsWorksCMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OpsWorksCMPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(OpsWorksCMClient, ListTagsForResourceCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/package.json b/clients/client-organizations/package.json index e5ded3041e72..5c01a680fec8 100644 --- a/clients/client-organizations/package.json +++ b/clients/client-organizations/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-organizations/src/pagination/ListAWSServiceAccessForOrganizationPaginator.ts b/clients/client-organizations/src/pagination/ListAWSServiceAccessForOrganizationPaginator.ts index 97c404d9cbcc..4cb967974984 100644 --- a/clients/client-organizations/src/pagination/ListAWSServiceAccessForOrganizationPaginator.ts +++ b/clients/client-organizations/src/pagination/ListAWSServiceAccessForOrganizationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListAWSServiceAccessForOrganizationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAWSServiceAccessForOrganizationCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAWSServiceAccessForOrganization( +export const paginateListAWSServiceAccessForOrganization: ( config: OrganizationsPaginationConfiguration, input: ListAWSServiceAccessForOrganizationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAWSServiceAccessForOrganizationCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListAWSServiceAccessForOrganizationCommandInput, + ListAWSServiceAccessForOrganizationCommandOutput +>(OrganizationsClient, ListAWSServiceAccessForOrganizationCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/src/pagination/ListAccountsForParentPaginator.ts b/clients/client-organizations/src/pagination/ListAccountsForParentPaginator.ts index 85d83b22aa93..8e2f48c11961 100644 --- a/clients/client-organizations/src/pagination/ListAccountsForParentPaginator.ts +++ b/clients/client-organizations/src/pagination/ListAccountsForParentPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListAccountsForParentCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccountsForParentCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccountsForParent( +export const paginateListAccountsForParent: ( config: OrganizationsPaginationConfiguration, input: ListAccountsForParentCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccountsForParentCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListAccountsForParentCommandInput, + ListAccountsForParentCommandOutput +>(OrganizationsClient, ListAccountsForParentCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/src/pagination/ListAccountsPaginator.ts b/clients/client-organizations/src/pagination/ListAccountsPaginator.ts index 126fbd6a9522..5b4b3e541176 100644 --- a/clients/client-organizations/src/pagination/ListAccountsPaginator.ts +++ b/clients/client-organizations/src/pagination/ListAccountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListAccountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccounts( +export const paginateListAccounts: ( config: OrganizationsPaginationConfiguration, input: ListAccountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccountsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListAccountsCommandInput, + ListAccountsCommandOutput +>(OrganizationsClient, ListAccountsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/src/pagination/ListChildrenPaginator.ts b/clients/client-organizations/src/pagination/ListChildrenPaginator.ts index d1d59d474971..b4b80aa8bf72 100644 --- a/clients/client-organizations/src/pagination/ListChildrenPaginator.ts +++ b/clients/client-organizations/src/pagination/ListChildrenPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListChildrenCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChildrenCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChildren( +export const paginateListChildren: ( config: OrganizationsPaginationConfiguration, input: ListChildrenCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChildrenCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListChildrenCommandInput, + ListChildrenCommandOutput +>(OrganizationsClient, ListChildrenCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/src/pagination/ListCreateAccountStatusPaginator.ts b/clients/client-organizations/src/pagination/ListCreateAccountStatusPaginator.ts index 5c0ca979530b..067b86d80876 100644 --- a/clients/client-organizations/src/pagination/ListCreateAccountStatusPaginator.ts +++ b/clients/client-organizations/src/pagination/ListCreateAccountStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListCreateAccountStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCreateAccountStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCreateAccountStatus( +export const paginateListCreateAccountStatus: ( config: OrganizationsPaginationConfiguration, input: ListCreateAccountStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCreateAccountStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListCreateAccountStatusCommandInput, + ListCreateAccountStatusCommandOutput +>(OrganizationsClient, ListCreateAccountStatusCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/src/pagination/ListDelegatedAdministratorsPaginator.ts b/clients/client-organizations/src/pagination/ListDelegatedAdministratorsPaginator.ts index 9c2b226cc226..1f1366897dea 100644 --- a/clients/client-organizations/src/pagination/ListDelegatedAdministratorsPaginator.ts +++ b/clients/client-organizations/src/pagination/ListDelegatedAdministratorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListDelegatedAdministratorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDelegatedAdministratorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDelegatedAdministrators( +export const paginateListDelegatedAdministrators: ( config: OrganizationsPaginationConfiguration, input: ListDelegatedAdministratorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDelegatedAdministratorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListDelegatedAdministratorsCommandInput, + ListDelegatedAdministratorsCommandOutput +>(OrganizationsClient, ListDelegatedAdministratorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/src/pagination/ListDelegatedServicesForAccountPaginator.ts b/clients/client-organizations/src/pagination/ListDelegatedServicesForAccountPaginator.ts index 6456cce96792..51066ed2468a 100644 --- a/clients/client-organizations/src/pagination/ListDelegatedServicesForAccountPaginator.ts +++ b/clients/client-organizations/src/pagination/ListDelegatedServicesForAccountPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListDelegatedServicesForAccountCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDelegatedServicesForAccountCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDelegatedServicesForAccount( +export const paginateListDelegatedServicesForAccount: ( config: OrganizationsPaginationConfiguration, input: ListDelegatedServicesForAccountCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDelegatedServicesForAccountCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListDelegatedServicesForAccountCommandInput, + ListDelegatedServicesForAccountCommandOutput +>(OrganizationsClient, ListDelegatedServicesForAccountCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/src/pagination/ListHandshakesForAccountPaginator.ts b/clients/client-organizations/src/pagination/ListHandshakesForAccountPaginator.ts index d124745b8507..dce2851ae32a 100644 --- a/clients/client-organizations/src/pagination/ListHandshakesForAccountPaginator.ts +++ b/clients/client-organizations/src/pagination/ListHandshakesForAccountPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListHandshakesForAccountCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHandshakesForAccountCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHandshakesForAccount( +export const paginateListHandshakesForAccount: ( config: OrganizationsPaginationConfiguration, input: ListHandshakesForAccountCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHandshakesForAccountCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListHandshakesForAccountCommandInput, + ListHandshakesForAccountCommandOutput +>(OrganizationsClient, ListHandshakesForAccountCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/src/pagination/ListHandshakesForOrganizationPaginator.ts b/clients/client-organizations/src/pagination/ListHandshakesForOrganizationPaginator.ts index 77aec033c8e1..875c56f13532 100644 --- a/clients/client-organizations/src/pagination/ListHandshakesForOrganizationPaginator.ts +++ b/clients/client-organizations/src/pagination/ListHandshakesForOrganizationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListHandshakesForOrganizationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHandshakesForOrganizationCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHandshakesForOrganization( +export const paginateListHandshakesForOrganization: ( config: OrganizationsPaginationConfiguration, input: ListHandshakesForOrganizationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHandshakesForOrganizationCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListHandshakesForOrganizationCommandInput, + ListHandshakesForOrganizationCommandOutput +>(OrganizationsClient, ListHandshakesForOrganizationCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/src/pagination/ListOrganizationalUnitsForParentPaginator.ts b/clients/client-organizations/src/pagination/ListOrganizationalUnitsForParentPaginator.ts index a96ca56bb6c1..f53228a4bd28 100644 --- a/clients/client-organizations/src/pagination/ListOrganizationalUnitsForParentPaginator.ts +++ b/clients/client-organizations/src/pagination/ListOrganizationalUnitsForParentPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListOrganizationalUnitsForParentCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOrganizationalUnitsForParentCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOrganizationalUnitsForParent( +export const paginateListOrganizationalUnitsForParent: ( config: OrganizationsPaginationConfiguration, input: ListOrganizationalUnitsForParentCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOrganizationalUnitsForParentCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListOrganizationalUnitsForParentCommandInput, + ListOrganizationalUnitsForParentCommandOutput +>(OrganizationsClient, ListOrganizationalUnitsForParentCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/src/pagination/ListParentsPaginator.ts b/clients/client-organizations/src/pagination/ListParentsPaginator.ts index db52287314e0..a1e63fdb616c 100644 --- a/clients/client-organizations/src/pagination/ListParentsPaginator.ts +++ b/clients/client-organizations/src/pagination/ListParentsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListParentsCommand, ListParentsCommandInput, ListParentsCommandOutput } from "../commands/ListParentsCommand"; import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListParentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListParentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListParents( +export const paginateListParents: ( config: OrganizationsPaginationConfiguration, input: ListParentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListParentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListParentsCommandInput, + ListParentsCommandOutput +>(OrganizationsClient, ListParentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/src/pagination/ListPoliciesForTargetPaginator.ts b/clients/client-organizations/src/pagination/ListPoliciesForTargetPaginator.ts index 8837bc2f71e0..e2944e8968b6 100644 --- a/clients/client-organizations/src/pagination/ListPoliciesForTargetPaginator.ts +++ b/clients/client-organizations/src/pagination/ListPoliciesForTargetPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListPoliciesForTargetCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPoliciesForTargetCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPoliciesForTarget( +export const paginateListPoliciesForTarget: ( config: OrganizationsPaginationConfiguration, input: ListPoliciesForTargetCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPoliciesForTargetCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListPoliciesForTargetCommandInput, + ListPoliciesForTargetCommandOutput +>(OrganizationsClient, ListPoliciesForTargetCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/src/pagination/ListPoliciesPaginator.ts b/clients/client-organizations/src/pagination/ListPoliciesPaginator.ts index 5299f150d9b4..3e99d8996958 100644 --- a/clients/client-organizations/src/pagination/ListPoliciesPaginator.ts +++ b/clients/client-organizations/src/pagination/ListPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPolicies( +export const paginateListPolicies: ( config: OrganizationsPaginationConfiguration, input: ListPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPoliciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListPoliciesCommandInput, + ListPoliciesCommandOutput +>(OrganizationsClient, ListPoliciesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/src/pagination/ListRootsPaginator.ts b/clients/client-organizations/src/pagination/ListRootsPaginator.ts index 31e554fc1bb8..f01e296b6f4d 100644 --- a/clients/client-organizations/src/pagination/ListRootsPaginator.ts +++ b/clients/client-organizations/src/pagination/ListRootsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListRootsCommand, ListRootsCommandInput, ListRootsCommandOutput } from "../commands/ListRootsCommand"; import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListRootsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRootsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRoots( +export const paginateListRoots: ( config: OrganizationsPaginationConfiguration, input: ListRootsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRootsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListRootsCommandInput, + ListRootsCommandOutput +>(OrganizationsClient, ListRootsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-organizations/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-organizations/src/pagination/ListTagsForResourcePaginator.ts index 15c4a91144de..2671c7ad4f35 100644 --- a/clients/client-organizations/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-organizations/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: OrganizationsPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(OrganizationsClient, ListTagsForResourceCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-organizations/src/pagination/ListTargetsForPolicyPaginator.ts b/clients/client-organizations/src/pagination/ListTargetsForPolicyPaginator.ts index 2fd7d25d85b5..f2f351ef85f5 100644 --- a/clients/client-organizations/src/pagination/ListTargetsForPolicyPaginator.ts +++ b/clients/client-organizations/src/pagination/ListTargetsForPolicyPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OrganizationsClient } from "../OrganizationsClient"; import { OrganizationsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OrganizationsClient, - input: ListTargetsForPolicyCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTargetsForPolicyCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTargetsForPolicy( +export const paginateListTargetsForPolicy: ( config: OrganizationsPaginationConfiguration, input: ListTargetsForPolicyCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTargetsForPolicyCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OrganizationsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Organizations | OrganizationsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OrganizationsPaginationConfiguration, + ListTargetsForPolicyCommandInput, + ListTargetsForPolicyCommandOutput +>(OrganizationsClient, ListTargetsForPolicyCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-osis/src/pagination/ListPipelinesPaginator.ts b/clients/client-osis/src/pagination/ListPipelinesPaginator.ts index 47762c34896d..d9e0861f52a9 100644 --- a/clients/client-osis/src/pagination/ListPipelinesPaginator.ts +++ b/clients/client-osis/src/pagination/ListPipelinesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OSISClient } from "../OSISClient"; import { OSISPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OSISClient, - input: ListPipelinesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPipelinesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPipelines( +export const paginateListPipelines: ( config: OSISPaginationConfiguration, input: ListPipelinesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPipelinesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OSISClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected OSIS | OSISClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OSISPaginationConfiguration, + ListPipelinesCommandInput, + ListPipelinesCommandOutput +>(OSISClient, ListPipelinesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-outposts/src/pagination/GetOutpostInstanceTypesPaginator.ts b/clients/client-outposts/src/pagination/GetOutpostInstanceTypesPaginator.ts index 44467ab6660e..5a22de8e4667 100644 --- a/clients/client-outposts/src/pagination/GetOutpostInstanceTypesPaginator.ts +++ b/clients/client-outposts/src/pagination/GetOutpostInstanceTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OutpostsClient } from "../OutpostsClient"; import { OutpostsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OutpostsClient, - input: GetOutpostInstanceTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetOutpostInstanceTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetOutpostInstanceTypes( +export const paginateGetOutpostInstanceTypes: ( config: OutpostsPaginationConfiguration, input: GetOutpostInstanceTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetOutpostInstanceTypesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OutpostsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Outposts | OutpostsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OutpostsPaginationConfiguration, + GetOutpostInstanceTypesCommandInput, + GetOutpostInstanceTypesCommandOutput +>(OutpostsClient, GetOutpostInstanceTypesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-outposts/src/pagination/ListAssetsPaginator.ts b/clients/client-outposts/src/pagination/ListAssetsPaginator.ts index e7bce9946fc7..b203258a5bb0 100644 --- a/clients/client-outposts/src/pagination/ListAssetsPaginator.ts +++ b/clients/client-outposts/src/pagination/ListAssetsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAssetsCommand, ListAssetsCommandInput, ListAssetsCommandOutput } from "../commands/ListAssetsCommand"; import { OutpostsClient } from "../OutpostsClient"; import { OutpostsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OutpostsClient, - input: ListAssetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssets( +export const paginateListAssets: ( config: OutpostsPaginationConfiguration, input: ListAssetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OutpostsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Outposts | OutpostsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OutpostsPaginationConfiguration, + ListAssetsCommandInput, + ListAssetsCommandOutput +>(OutpostsClient, ListAssetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-outposts/src/pagination/ListCatalogItemsPaginator.ts b/clients/client-outposts/src/pagination/ListCatalogItemsPaginator.ts index 1d7c18203775..1df42e531e48 100644 --- a/clients/client-outposts/src/pagination/ListCatalogItemsPaginator.ts +++ b/clients/client-outposts/src/pagination/ListCatalogItemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OutpostsClient } from "../OutpostsClient"; import { OutpostsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OutpostsClient, - input: ListCatalogItemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCatalogItemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCatalogItems( +export const paginateListCatalogItems: ( config: OutpostsPaginationConfiguration, input: ListCatalogItemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCatalogItemsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OutpostsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Outposts | OutpostsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OutpostsPaginationConfiguration, + ListCatalogItemsCommandInput, + ListCatalogItemsCommandOutput +>(OutpostsClient, ListCatalogItemsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-outposts/src/pagination/ListOrdersPaginator.ts b/clients/client-outposts/src/pagination/ListOrdersPaginator.ts index 76d479ece492..55f379eb8832 100644 --- a/clients/client-outposts/src/pagination/ListOrdersPaginator.ts +++ b/clients/client-outposts/src/pagination/ListOrdersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListOrdersCommand, ListOrdersCommandInput, ListOrdersCommandOutput } from "../commands/ListOrdersCommand"; import { OutpostsClient } from "../OutpostsClient"; import { OutpostsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OutpostsClient, - input: ListOrdersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOrdersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOrders( +export const paginateListOrders: ( config: OutpostsPaginationConfiguration, input: ListOrdersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOrdersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OutpostsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Outposts | OutpostsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OutpostsPaginationConfiguration, + ListOrdersCommandInput, + ListOrdersCommandOutput +>(OutpostsClient, ListOrdersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-outposts/src/pagination/ListOutpostsPaginator.ts b/clients/client-outposts/src/pagination/ListOutpostsPaginator.ts index 6a2ab29e9f1d..b1becc1ffd13 100644 --- a/clients/client-outposts/src/pagination/ListOutpostsPaginator.ts +++ b/clients/client-outposts/src/pagination/ListOutpostsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { OutpostsClient } from "../OutpostsClient"; import { OutpostsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OutpostsClient, - input: ListOutpostsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOutpostsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOutposts( +export const paginateListOutposts: ( config: OutpostsPaginationConfiguration, input: ListOutpostsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOutpostsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OutpostsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Outposts | OutpostsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OutpostsPaginationConfiguration, + ListOutpostsCommandInput, + ListOutpostsCommandOutput +>(OutpostsClient, ListOutpostsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-outposts/src/pagination/ListSitesPaginator.ts b/clients/client-outposts/src/pagination/ListSitesPaginator.ts index b5e5ed4227a8..37712b16bb94 100644 --- a/clients/client-outposts/src/pagination/ListSitesPaginator.ts +++ b/clients/client-outposts/src/pagination/ListSitesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListSitesCommand, ListSitesCommandInput, ListSitesCommandOutput } from "../commands/ListSitesCommand"; import { OutpostsClient } from "../OutpostsClient"; import { OutpostsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: OutpostsClient, - input: ListSitesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSitesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSites( +export const paginateListSites: ( config: OutpostsPaginationConfiguration, input: ListSitesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSitesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof OutpostsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Outposts | OutpostsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + OutpostsPaginationConfiguration, + ListSitesCommandInput, + ListSitesCommandOutput +>(OutpostsClient, ListSitesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-panorama/src/pagination/ListApplicationInstanceDependenciesPaginator.ts b/clients/client-panorama/src/pagination/ListApplicationInstanceDependenciesPaginator.ts index 4e8928665c6c..8c67ee5ea611 100644 --- a/clients/client-panorama/src/pagination/ListApplicationInstanceDependenciesPaginator.ts +++ b/clients/client-panorama/src/pagination/ListApplicationInstanceDependenciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PanoramaClient } from "../PanoramaClient"; import { PanoramaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PanoramaClient, - input: ListApplicationInstanceDependenciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationInstanceDependenciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationInstanceDependencies( +export const paginateListApplicationInstanceDependencies: ( config: PanoramaPaginationConfiguration, input: ListApplicationInstanceDependenciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationInstanceDependenciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PanoramaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Panorama | PanoramaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PanoramaPaginationConfiguration, + ListApplicationInstanceDependenciesCommandInput, + ListApplicationInstanceDependenciesCommandOutput +>(PanoramaClient, ListApplicationInstanceDependenciesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-panorama/src/pagination/ListApplicationInstanceNodeInstancesPaginator.ts b/clients/client-panorama/src/pagination/ListApplicationInstanceNodeInstancesPaginator.ts index 4db6d9d86edb..f87923f0e0ec 100644 --- a/clients/client-panorama/src/pagination/ListApplicationInstanceNodeInstancesPaginator.ts +++ b/clients/client-panorama/src/pagination/ListApplicationInstanceNodeInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PanoramaClient } from "../PanoramaClient"; import { PanoramaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PanoramaClient, - input: ListApplicationInstanceNodeInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationInstanceNodeInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationInstanceNodeInstances( +export const paginateListApplicationInstanceNodeInstances: ( config: PanoramaPaginationConfiguration, input: ListApplicationInstanceNodeInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationInstanceNodeInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PanoramaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Panorama | PanoramaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PanoramaPaginationConfiguration, + ListApplicationInstanceNodeInstancesCommandInput, + ListApplicationInstanceNodeInstancesCommandOutput +>(PanoramaClient, ListApplicationInstanceNodeInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-panorama/src/pagination/ListApplicationInstancesPaginator.ts b/clients/client-panorama/src/pagination/ListApplicationInstancesPaginator.ts index 9d7c49425262..0db91af40dcf 100644 --- a/clients/client-panorama/src/pagination/ListApplicationInstancesPaginator.ts +++ b/clients/client-panorama/src/pagination/ListApplicationInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PanoramaClient } from "../PanoramaClient"; import { PanoramaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PanoramaClient, - input: ListApplicationInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationInstances( +export const paginateListApplicationInstances: ( config: PanoramaPaginationConfiguration, input: ListApplicationInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PanoramaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Panorama | PanoramaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PanoramaPaginationConfiguration, + ListApplicationInstancesCommandInput, + ListApplicationInstancesCommandOutput +>(PanoramaClient, ListApplicationInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-panorama/src/pagination/ListDevicesJobsPaginator.ts b/clients/client-panorama/src/pagination/ListDevicesJobsPaginator.ts index 926767446985..3811fc9e6f21 100644 --- a/clients/client-panorama/src/pagination/ListDevicesJobsPaginator.ts +++ b/clients/client-panorama/src/pagination/ListDevicesJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PanoramaClient } from "../PanoramaClient"; import { PanoramaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PanoramaClient, - input: ListDevicesJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDevicesJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDevicesJobs( +export const paginateListDevicesJobs: ( config: PanoramaPaginationConfiguration, input: ListDevicesJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDevicesJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PanoramaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Panorama | PanoramaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PanoramaPaginationConfiguration, + ListDevicesJobsCommandInput, + ListDevicesJobsCommandOutput +>(PanoramaClient, ListDevicesJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-panorama/src/pagination/ListDevicesPaginator.ts b/clients/client-panorama/src/pagination/ListDevicesPaginator.ts index ece29e85ecba..484c9db6b846 100644 --- a/clients/client-panorama/src/pagination/ListDevicesPaginator.ts +++ b/clients/client-panorama/src/pagination/ListDevicesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListDevicesCommand, ListDevicesCommandInput, ListDevicesCommandOutput } from "../commands/ListDevicesCommand"; import { PanoramaClient } from "../PanoramaClient"; import { PanoramaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PanoramaClient, - input: ListDevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDevices( +export const paginateListDevices: ( config: PanoramaPaginationConfiguration, input: ListDevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDevicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PanoramaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Panorama | PanoramaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PanoramaPaginationConfiguration, + ListDevicesCommandInput, + ListDevicesCommandOutput +>(PanoramaClient, ListDevicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-panorama/src/pagination/ListNodeFromTemplateJobsPaginator.ts b/clients/client-panorama/src/pagination/ListNodeFromTemplateJobsPaginator.ts index 86d5e00cee4a..6401d0bfac11 100644 --- a/clients/client-panorama/src/pagination/ListNodeFromTemplateJobsPaginator.ts +++ b/clients/client-panorama/src/pagination/ListNodeFromTemplateJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PanoramaClient } from "../PanoramaClient"; import { PanoramaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PanoramaClient, - input: ListNodeFromTemplateJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNodeFromTemplateJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNodeFromTemplateJobs( +export const paginateListNodeFromTemplateJobs: ( config: PanoramaPaginationConfiguration, input: ListNodeFromTemplateJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNodeFromTemplateJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PanoramaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Panorama | PanoramaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PanoramaPaginationConfiguration, + ListNodeFromTemplateJobsCommandInput, + ListNodeFromTemplateJobsCommandOutput +>(PanoramaClient, ListNodeFromTemplateJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-panorama/src/pagination/ListNodesPaginator.ts b/clients/client-panorama/src/pagination/ListNodesPaginator.ts index cd16d9bd8f40..0247a117734f 100644 --- a/clients/client-panorama/src/pagination/ListNodesPaginator.ts +++ b/clients/client-panorama/src/pagination/ListNodesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListNodesCommand, ListNodesCommandInput, ListNodesCommandOutput } from "../commands/ListNodesCommand"; import { PanoramaClient } from "../PanoramaClient"; import { PanoramaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PanoramaClient, - input: ListNodesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNodesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNodes( +export const paginateListNodes: ( config: PanoramaPaginationConfiguration, input: ListNodesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNodesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PanoramaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Panorama | PanoramaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PanoramaPaginationConfiguration, + ListNodesCommandInput, + ListNodesCommandOutput +>(PanoramaClient, ListNodesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-panorama/src/pagination/ListPackageImportJobsPaginator.ts b/clients/client-panorama/src/pagination/ListPackageImportJobsPaginator.ts index 49f4219afee8..f7631721d8ab 100644 --- a/clients/client-panorama/src/pagination/ListPackageImportJobsPaginator.ts +++ b/clients/client-panorama/src/pagination/ListPackageImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PanoramaClient } from "../PanoramaClient"; import { PanoramaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PanoramaClient, - input: ListPackageImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPackageImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPackageImportJobs( +export const paginateListPackageImportJobs: ( config: PanoramaPaginationConfiguration, input: ListPackageImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPackageImportJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PanoramaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Panorama | PanoramaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PanoramaPaginationConfiguration, + ListPackageImportJobsCommandInput, + ListPackageImportJobsCommandOutput +>(PanoramaClient, ListPackageImportJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-panorama/src/pagination/ListPackagesPaginator.ts b/clients/client-panorama/src/pagination/ListPackagesPaginator.ts index 91008461bb36..a32b7017f47c 100644 --- a/clients/client-panorama/src/pagination/ListPackagesPaginator.ts +++ b/clients/client-panorama/src/pagination/ListPackagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PanoramaClient } from "../PanoramaClient"; import { PanoramaPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PanoramaClient, - input: ListPackagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPackagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPackages( +export const paginateListPackages: ( config: PanoramaPaginationConfiguration, input: ListPackagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPackagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PanoramaClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Panorama | PanoramaClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PanoramaPaginationConfiguration, + ListPackagesCommandInput, + ListPackagesCommandOutput +>(PanoramaClient, ListPackagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-payment-cryptography/package.json b/clients/client-payment-cryptography/package.json index 1cdf07d7f165..68a563e37469 100644 --- a/clients/client-payment-cryptography/package.json +++ b/clients/client-payment-cryptography/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-payment-cryptography/src/pagination/ListAliasesPaginator.ts b/clients/client-payment-cryptography/src/pagination/ListAliasesPaginator.ts index 79b4dd43bca6..d7a54fd4facb 100644 --- a/clients/client-payment-cryptography/src/pagination/ListAliasesPaginator.ts +++ b/clients/client-payment-cryptography/src/pagination/ListAliasesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAliasesCommand, ListAliasesCommandInput, ListAliasesCommandOutput } from "../commands/ListAliasesCommand"; import { PaymentCryptographyClient } from "../PaymentCryptographyClient"; import { PaymentCryptographyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PaymentCryptographyClient, - input: ListAliasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAliasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAliases( +export const paginateListAliases: ( config: PaymentCryptographyPaginationConfiguration, input: ListAliasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAliasesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PaymentCryptographyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PaymentCryptography | PaymentCryptographyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PaymentCryptographyPaginationConfiguration, + ListAliasesCommandInput, + ListAliasesCommandOutput +>(PaymentCryptographyClient, ListAliasesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-payment-cryptography/src/pagination/ListKeysPaginator.ts b/clients/client-payment-cryptography/src/pagination/ListKeysPaginator.ts index 15620ae701d1..dbbd3ecfd84d 100644 --- a/clients/client-payment-cryptography/src/pagination/ListKeysPaginator.ts +++ b/clients/client-payment-cryptography/src/pagination/ListKeysPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListKeysCommand, ListKeysCommandInput, ListKeysCommandOutput } from "../commands/ListKeysCommand"; import { PaymentCryptographyClient } from "../PaymentCryptographyClient"; import { PaymentCryptographyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PaymentCryptographyClient, - input: ListKeysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKeysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKeys( +export const paginateListKeys: ( config: PaymentCryptographyPaginationConfiguration, input: ListKeysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKeysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PaymentCryptographyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PaymentCryptography | PaymentCryptographyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PaymentCryptographyPaginationConfiguration, + ListKeysCommandInput, + ListKeysCommandOutput +>(PaymentCryptographyClient, ListKeysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-payment-cryptography/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-payment-cryptography/src/pagination/ListTagsForResourcePaginator.ts index bc60ca96b19f..c2eaf75de583 100644 --- a/clients/client-payment-cryptography/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-payment-cryptography/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PaymentCryptographyClient } from "../PaymentCryptographyClient"; import { PaymentCryptographyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PaymentCryptographyClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: PaymentCryptographyPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PaymentCryptographyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PaymentCryptography | PaymentCryptographyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PaymentCryptographyPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(PaymentCryptographyClient, ListTagsForResourceCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pca-connector-ad/src/pagination/ListConnectorsPaginator.ts b/clients/client-pca-connector-ad/src/pagination/ListConnectorsPaginator.ts index de255bf27898..edd43866dfcc 100644 --- a/clients/client-pca-connector-ad/src/pagination/ListConnectorsPaginator.ts +++ b/clients/client-pca-connector-ad/src/pagination/ListConnectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PcaConnectorAdClient } from "../PcaConnectorAdClient"; import { PcaConnectorAdPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PcaConnectorAdClient, - input: ListConnectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConnectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConnectors( +export const paginateListConnectors: ( config: PcaConnectorAdPaginationConfiguration, input: ListConnectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConnectorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PcaConnectorAdClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PcaConnectorAd | PcaConnectorAdClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PcaConnectorAdPaginationConfiguration, + ListConnectorsCommandInput, + ListConnectorsCommandOutput +>(PcaConnectorAdClient, ListConnectorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pca-connector-ad/src/pagination/ListDirectoryRegistrationsPaginator.ts b/clients/client-pca-connector-ad/src/pagination/ListDirectoryRegistrationsPaginator.ts index 074165d9b113..3a7d5fb221ad 100644 --- a/clients/client-pca-connector-ad/src/pagination/ListDirectoryRegistrationsPaginator.ts +++ b/clients/client-pca-connector-ad/src/pagination/ListDirectoryRegistrationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PcaConnectorAdClient } from "../PcaConnectorAdClient"; import { PcaConnectorAdPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PcaConnectorAdClient, - input: ListDirectoryRegistrationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDirectoryRegistrationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDirectoryRegistrations( +export const paginateListDirectoryRegistrations: ( config: PcaConnectorAdPaginationConfiguration, input: ListDirectoryRegistrationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDirectoryRegistrationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PcaConnectorAdClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PcaConnectorAd | PcaConnectorAdClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PcaConnectorAdPaginationConfiguration, + ListDirectoryRegistrationsCommandInput, + ListDirectoryRegistrationsCommandOutput +>(PcaConnectorAdClient, ListDirectoryRegistrationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pca-connector-ad/src/pagination/ListServicePrincipalNamesPaginator.ts b/clients/client-pca-connector-ad/src/pagination/ListServicePrincipalNamesPaginator.ts index d7c6806eba77..ac3d4e419b53 100644 --- a/clients/client-pca-connector-ad/src/pagination/ListServicePrincipalNamesPaginator.ts +++ b/clients/client-pca-connector-ad/src/pagination/ListServicePrincipalNamesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PcaConnectorAdClient } from "../PcaConnectorAdClient"; import { PcaConnectorAdPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PcaConnectorAdClient, - input: ListServicePrincipalNamesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServicePrincipalNamesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServicePrincipalNames( +export const paginateListServicePrincipalNames: ( config: PcaConnectorAdPaginationConfiguration, input: ListServicePrincipalNamesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServicePrincipalNamesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PcaConnectorAdClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PcaConnectorAd | PcaConnectorAdClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PcaConnectorAdPaginationConfiguration, + ListServicePrincipalNamesCommandInput, + ListServicePrincipalNamesCommandOutput +>(PcaConnectorAdClient, ListServicePrincipalNamesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pca-connector-ad/src/pagination/ListTemplateGroupAccessControlEntriesPaginator.ts b/clients/client-pca-connector-ad/src/pagination/ListTemplateGroupAccessControlEntriesPaginator.ts index 4bc063b6cf22..f57bc565baa3 100644 --- a/clients/client-pca-connector-ad/src/pagination/ListTemplateGroupAccessControlEntriesPaginator.ts +++ b/clients/client-pca-connector-ad/src/pagination/ListTemplateGroupAccessControlEntriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PcaConnectorAdClient } from "../PcaConnectorAdClient"; import { PcaConnectorAdPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PcaConnectorAdClient, - input: ListTemplateGroupAccessControlEntriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTemplateGroupAccessControlEntriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTemplateGroupAccessControlEntries( +export const paginateListTemplateGroupAccessControlEntries: ( config: PcaConnectorAdPaginationConfiguration, input: ListTemplateGroupAccessControlEntriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTemplateGroupAccessControlEntriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PcaConnectorAdClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PcaConnectorAd | PcaConnectorAdClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PcaConnectorAdPaginationConfiguration, + ListTemplateGroupAccessControlEntriesCommandInput, + ListTemplateGroupAccessControlEntriesCommandOutput +>(PcaConnectorAdClient, ListTemplateGroupAccessControlEntriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pca-connector-ad/src/pagination/ListTemplatesPaginator.ts b/clients/client-pca-connector-ad/src/pagination/ListTemplatesPaginator.ts index f1abe33ae9d6..b37d6523d89d 100644 --- a/clients/client-pca-connector-ad/src/pagination/ListTemplatesPaginator.ts +++ b/clients/client-pca-connector-ad/src/pagination/ListTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PcaConnectorAdClient } from "../PcaConnectorAdClient"; import { PcaConnectorAdPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PcaConnectorAdClient, - input: ListTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTemplates( +export const paginateListTemplates: ( config: PcaConnectorAdPaginationConfiguration, input: ListTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTemplatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PcaConnectorAdClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PcaConnectorAd | PcaConnectorAdClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PcaConnectorAdPaginationConfiguration, + ListTemplatesCommandInput, + ListTemplatesCommandOutput +>(PcaConnectorAdClient, ListTemplatesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-personalize/package.json b/clients/client-personalize/package.json index 10a94e77ccb6..ba641c94078b 100644 --- a/clients/client-personalize/package.json +++ b/clients/client-personalize/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-personalize/src/pagination/ListBatchInferenceJobsPaginator.ts b/clients/client-personalize/src/pagination/ListBatchInferenceJobsPaginator.ts index c85e31b6ba40..338ae4d6f0ea 100644 --- a/clients/client-personalize/src/pagination/ListBatchInferenceJobsPaginator.ts +++ b/clients/client-personalize/src/pagination/ListBatchInferenceJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListBatchInferenceJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBatchInferenceJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBatchInferenceJobs( +export const paginateListBatchInferenceJobs: ( config: PersonalizePaginationConfiguration, input: ListBatchInferenceJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBatchInferenceJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListBatchInferenceJobsCommandInput, + ListBatchInferenceJobsCommandOutput +>(PersonalizeClient, ListBatchInferenceJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListBatchSegmentJobsPaginator.ts b/clients/client-personalize/src/pagination/ListBatchSegmentJobsPaginator.ts index cbff8c9f6ac0..3e50d19825d4 100644 --- a/clients/client-personalize/src/pagination/ListBatchSegmentJobsPaginator.ts +++ b/clients/client-personalize/src/pagination/ListBatchSegmentJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListBatchSegmentJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBatchSegmentJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBatchSegmentJobs( +export const paginateListBatchSegmentJobs: ( config: PersonalizePaginationConfiguration, input: ListBatchSegmentJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBatchSegmentJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListBatchSegmentJobsCommandInput, + ListBatchSegmentJobsCommandOutput +>(PersonalizeClient, ListBatchSegmentJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListCampaignsPaginator.ts b/clients/client-personalize/src/pagination/ListCampaignsPaginator.ts index 45ce960cf5e3..8e4cab71b276 100644 --- a/clients/client-personalize/src/pagination/ListCampaignsPaginator.ts +++ b/clients/client-personalize/src/pagination/ListCampaignsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListCampaignsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCampaignsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCampaigns( +export const paginateListCampaigns: ( config: PersonalizePaginationConfiguration, input: ListCampaignsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCampaignsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListCampaignsCommandInput, + ListCampaignsCommandOutput +>(PersonalizeClient, ListCampaignsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListDatasetExportJobsPaginator.ts b/clients/client-personalize/src/pagination/ListDatasetExportJobsPaginator.ts index 431b379e4529..10eaf5a5b445 100644 --- a/clients/client-personalize/src/pagination/ListDatasetExportJobsPaginator.ts +++ b/clients/client-personalize/src/pagination/ListDatasetExportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListDatasetExportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetExportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasetExportJobs( +export const paginateListDatasetExportJobs: ( config: PersonalizePaginationConfiguration, input: ListDatasetExportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetExportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListDatasetExportJobsCommandInput, + ListDatasetExportJobsCommandOutput +>(PersonalizeClient, ListDatasetExportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListDatasetGroupsPaginator.ts b/clients/client-personalize/src/pagination/ListDatasetGroupsPaginator.ts index 8ee064610d4f..04086e62532c 100644 --- a/clients/client-personalize/src/pagination/ListDatasetGroupsPaginator.ts +++ b/clients/client-personalize/src/pagination/ListDatasetGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListDatasetGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasetGroups( +export const paginateListDatasetGroups: ( config: PersonalizePaginationConfiguration, input: ListDatasetGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListDatasetGroupsCommandInput, + ListDatasetGroupsCommandOutput +>(PersonalizeClient, ListDatasetGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListDatasetImportJobsPaginator.ts b/clients/client-personalize/src/pagination/ListDatasetImportJobsPaginator.ts index e716728b7f3e..a5f785fb5d13 100644 --- a/clients/client-personalize/src/pagination/ListDatasetImportJobsPaginator.ts +++ b/clients/client-personalize/src/pagination/ListDatasetImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListDatasetImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasetImportJobs( +export const paginateListDatasetImportJobs: ( config: PersonalizePaginationConfiguration, input: ListDatasetImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetImportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListDatasetImportJobsCommandInput, + ListDatasetImportJobsCommandOutput +>(PersonalizeClient, ListDatasetImportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListDatasetsPaginator.ts b/clients/client-personalize/src/pagination/ListDatasetsPaginator.ts index a617e733dade..6908b24b83e8 100644 --- a/clients/client-personalize/src/pagination/ListDatasetsPaginator.ts +++ b/clients/client-personalize/src/pagination/ListDatasetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListDatasetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasets( +export const paginateListDatasets: ( config: PersonalizePaginationConfiguration, input: ListDatasetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListDatasetsCommandInput, + ListDatasetsCommandOutput +>(PersonalizeClient, ListDatasetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListEventTrackersPaginator.ts b/clients/client-personalize/src/pagination/ListEventTrackersPaginator.ts index 6dba711696c0..322de9b3c565 100644 --- a/clients/client-personalize/src/pagination/ListEventTrackersPaginator.ts +++ b/clients/client-personalize/src/pagination/ListEventTrackersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListEventTrackersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEventTrackersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEventTrackers( +export const paginateListEventTrackers: ( config: PersonalizePaginationConfiguration, input: ListEventTrackersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEventTrackersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListEventTrackersCommandInput, + ListEventTrackersCommandOutput +>(PersonalizeClient, ListEventTrackersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListFiltersPaginator.ts b/clients/client-personalize/src/pagination/ListFiltersPaginator.ts index 539ad1b38354..abed993c03cd 100644 --- a/clients/client-personalize/src/pagination/ListFiltersPaginator.ts +++ b/clients/client-personalize/src/pagination/ListFiltersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListFiltersCommand, ListFiltersCommandInput, ListFiltersCommandOutput } from "../commands/ListFiltersCommand"; import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListFiltersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFiltersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFilters( +export const paginateListFilters: ( config: PersonalizePaginationConfiguration, input: ListFiltersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFiltersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListFiltersCommandInput, + ListFiltersCommandOutput +>(PersonalizeClient, ListFiltersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListMetricAttributionMetricsPaginator.ts b/clients/client-personalize/src/pagination/ListMetricAttributionMetricsPaginator.ts index 1cb9e54874b1..c796231487d3 100644 --- a/clients/client-personalize/src/pagination/ListMetricAttributionMetricsPaginator.ts +++ b/clients/client-personalize/src/pagination/ListMetricAttributionMetricsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListMetricAttributionMetricsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMetricAttributionMetricsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMetricAttributionMetrics( +export const paginateListMetricAttributionMetrics: ( config: PersonalizePaginationConfiguration, input: ListMetricAttributionMetricsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMetricAttributionMetricsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListMetricAttributionMetricsCommandInput, + ListMetricAttributionMetricsCommandOutput +>(PersonalizeClient, ListMetricAttributionMetricsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListMetricAttributionsPaginator.ts b/clients/client-personalize/src/pagination/ListMetricAttributionsPaginator.ts index 6093accff6a8..6de967a75870 100644 --- a/clients/client-personalize/src/pagination/ListMetricAttributionsPaginator.ts +++ b/clients/client-personalize/src/pagination/ListMetricAttributionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListMetricAttributionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMetricAttributionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMetricAttributions( +export const paginateListMetricAttributions: ( config: PersonalizePaginationConfiguration, input: ListMetricAttributionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMetricAttributionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListMetricAttributionsCommandInput, + ListMetricAttributionsCommandOutput +>(PersonalizeClient, ListMetricAttributionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListRecipesPaginator.ts b/clients/client-personalize/src/pagination/ListRecipesPaginator.ts index 2ddcf026d540..42b4e963c8bc 100644 --- a/clients/client-personalize/src/pagination/ListRecipesPaginator.ts +++ b/clients/client-personalize/src/pagination/ListRecipesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListRecipesCommand, ListRecipesCommandInput, ListRecipesCommandOutput } from "../commands/ListRecipesCommand"; import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListRecipesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecipesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecipes( +export const paginateListRecipes: ( config: PersonalizePaginationConfiguration, input: ListRecipesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecipesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListRecipesCommandInput, + ListRecipesCommandOutput +>(PersonalizeClient, ListRecipesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListRecommendersPaginator.ts b/clients/client-personalize/src/pagination/ListRecommendersPaginator.ts index 7e15efe20411..037a3ae79cd4 100644 --- a/clients/client-personalize/src/pagination/ListRecommendersPaginator.ts +++ b/clients/client-personalize/src/pagination/ListRecommendersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListRecommendersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecommendersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecommenders( +export const paginateListRecommenders: ( config: PersonalizePaginationConfiguration, input: ListRecommendersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecommendersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListRecommendersCommandInput, + ListRecommendersCommandOutput +>(PersonalizeClient, ListRecommendersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListSchemasPaginator.ts b/clients/client-personalize/src/pagination/ListSchemasPaginator.ts index 35f845fcb9e4..4811e2e96b4a 100644 --- a/clients/client-personalize/src/pagination/ListSchemasPaginator.ts +++ b/clients/client-personalize/src/pagination/ListSchemasPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListSchemasCommand, ListSchemasCommandInput, ListSchemasCommandOutput } from "../commands/ListSchemasCommand"; import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListSchemasCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSchemasCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSchemas( +export const paginateListSchemas: ( config: PersonalizePaginationConfiguration, input: ListSchemasCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSchemasCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListSchemasCommandInput, + ListSchemasCommandOutput +>(PersonalizeClient, ListSchemasCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListSolutionVersionsPaginator.ts b/clients/client-personalize/src/pagination/ListSolutionVersionsPaginator.ts index d9117975deb6..254ff45aabda 100644 --- a/clients/client-personalize/src/pagination/ListSolutionVersionsPaginator.ts +++ b/clients/client-personalize/src/pagination/ListSolutionVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListSolutionVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSolutionVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSolutionVersions( +export const paginateListSolutionVersions: ( config: PersonalizePaginationConfiguration, input: ListSolutionVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSolutionVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListSolutionVersionsCommandInput, + ListSolutionVersionsCommandOutput +>(PersonalizeClient, ListSolutionVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-personalize/src/pagination/ListSolutionsPaginator.ts b/clients/client-personalize/src/pagination/ListSolutionsPaginator.ts index ef274cc67383..6297898cfce2 100644 --- a/clients/client-personalize/src/pagination/ListSolutionsPaginator.ts +++ b/clients/client-personalize/src/pagination/ListSolutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PersonalizeClient } from "../PersonalizeClient"; import { PersonalizePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PersonalizeClient, - input: ListSolutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSolutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSolutions( +export const paginateListSolutions: ( config: PersonalizePaginationConfiguration, input: ListSolutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSolutionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PersonalizeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Personalize | PersonalizeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PersonalizePaginationConfiguration, + ListSolutionsCommandInput, + ListSolutionsCommandOutput +>(PersonalizeClient, ListSolutionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-pi/package.json b/clients/client-pi/package.json index bfcb0602c5f8..f2c489ed5d1c 100644 --- a/clients/client-pi/package.json +++ b/clients/client-pi/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-pi/src/pagination/DescribeDimensionKeysPaginator.ts b/clients/client-pi/src/pagination/DescribeDimensionKeysPaginator.ts index 5ef1c8bc1ae9..b0fef75ba979 100644 --- a/clients/client-pi/src/pagination/DescribeDimensionKeysPaginator.ts +++ b/clients/client-pi/src/pagination/DescribeDimensionKeysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PIClient } from "../PIClient"; import { PIPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PIClient, - input: DescribeDimensionKeysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDimensionKeysCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDimensionKeys( +export const paginateDescribeDimensionKeys: ( config: PIPaginationConfiguration, input: DescribeDimensionKeysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDimensionKeysCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PIClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PI | PIClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PIPaginationConfiguration, + DescribeDimensionKeysCommandInput, + DescribeDimensionKeysCommandOutput +>(PIClient, DescribeDimensionKeysCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pi/src/pagination/GetResourceMetricsPaginator.ts b/clients/client-pi/src/pagination/GetResourceMetricsPaginator.ts index ca39a70d0194..21e0dabcf3a4 100644 --- a/clients/client-pi/src/pagination/GetResourceMetricsPaginator.ts +++ b/clients/client-pi/src/pagination/GetResourceMetricsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PIClient } from "../PIClient"; import { PIPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PIClient, - input: GetResourceMetricsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetResourceMetricsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetResourceMetrics( +export const paginateGetResourceMetrics: ( config: PIPaginationConfiguration, input: GetResourceMetricsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetResourceMetricsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PIClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PI | PIClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PIPaginationConfiguration, + GetResourceMetricsCommandInput, + GetResourceMetricsCommandOutput +>(PIClient, GetResourceMetricsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pi/src/pagination/ListAvailableResourceDimensionsPaginator.ts b/clients/client-pi/src/pagination/ListAvailableResourceDimensionsPaginator.ts index e214d8181ac0..fd14b943e293 100644 --- a/clients/client-pi/src/pagination/ListAvailableResourceDimensionsPaginator.ts +++ b/clients/client-pi/src/pagination/ListAvailableResourceDimensionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PIClient } from "../PIClient"; import { PIPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PIClient, - input: ListAvailableResourceDimensionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAvailableResourceDimensionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAvailableResourceDimensions( +export const paginateListAvailableResourceDimensions: ( config: PIPaginationConfiguration, input: ListAvailableResourceDimensionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAvailableResourceDimensionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PIClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PI | PIClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PIPaginationConfiguration, + ListAvailableResourceDimensionsCommandInput, + ListAvailableResourceDimensionsCommandOutput +>(PIClient, ListAvailableResourceDimensionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pi/src/pagination/ListAvailableResourceMetricsPaginator.ts b/clients/client-pi/src/pagination/ListAvailableResourceMetricsPaginator.ts index 6ac530d03061..4a28bd2825dd 100644 --- a/clients/client-pi/src/pagination/ListAvailableResourceMetricsPaginator.ts +++ b/clients/client-pi/src/pagination/ListAvailableResourceMetricsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PIClient } from "../PIClient"; import { PIPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PIClient, - input: ListAvailableResourceMetricsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAvailableResourceMetricsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAvailableResourceMetrics( +export const paginateListAvailableResourceMetrics: ( config: PIPaginationConfiguration, input: ListAvailableResourceMetricsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAvailableResourceMetricsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PIClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PI | PIClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PIPaginationConfiguration, + ListAvailableResourceMetricsCommandInput, + ListAvailableResourceMetricsCommandOutput +>(PIClient, ListAvailableResourceMetricsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pi/src/pagination/ListPerformanceAnalysisReportsPaginator.ts b/clients/client-pi/src/pagination/ListPerformanceAnalysisReportsPaginator.ts index 0dcd479952ce..e7c48f44831f 100644 --- a/clients/client-pi/src/pagination/ListPerformanceAnalysisReportsPaginator.ts +++ b/clients/client-pi/src/pagination/ListPerformanceAnalysisReportsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PIClient } from "../PIClient"; import { PIPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PIClient, - input: ListPerformanceAnalysisReportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPerformanceAnalysisReportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPerformanceAnalysisReports( +export const paginateListPerformanceAnalysisReports: ( config: PIPaginationConfiguration, input: ListPerformanceAnalysisReportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPerformanceAnalysisReportsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PIClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PI | PIClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PIPaginationConfiguration, + ListPerformanceAnalysisReportsCommandInput, + ListPerformanceAnalysisReportsCommandOutput +>(PIClient, ListPerformanceAnalysisReportsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-email/src/pagination/GetDedicatedIpsPaginator.ts b/clients/client-pinpoint-email/src/pagination/GetDedicatedIpsPaginator.ts index 49ecfbc31d67..955e190041f4 100644 --- a/clients/client-pinpoint-email/src/pagination/GetDedicatedIpsPaginator.ts +++ b/clients/client-pinpoint-email/src/pagination/GetDedicatedIpsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointEmailClient } from "../PinpointEmailClient"; import { PinpointEmailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointEmailClient, - input: GetDedicatedIpsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetDedicatedIpsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetDedicatedIps( +export const paginateGetDedicatedIps: ( config: PinpointEmailPaginationConfiguration, input: GetDedicatedIpsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetDedicatedIpsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof PinpointEmailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointEmail | PinpointEmailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointEmailPaginationConfiguration, + GetDedicatedIpsCommandInput, + GetDedicatedIpsCommandOutput +>(PinpointEmailClient, GetDedicatedIpsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-pinpoint-email/src/pagination/ListConfigurationSetsPaginator.ts b/clients/client-pinpoint-email/src/pagination/ListConfigurationSetsPaginator.ts index 54e554583b25..47d463bde1dc 100644 --- a/clients/client-pinpoint-email/src/pagination/ListConfigurationSetsPaginator.ts +++ b/clients/client-pinpoint-email/src/pagination/ListConfigurationSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointEmailClient } from "../PinpointEmailClient"; import { PinpointEmailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointEmailClient, - input: ListConfigurationSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConfigurationSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConfigurationSets( +export const paginateListConfigurationSets: ( config: PinpointEmailPaginationConfiguration, input: ListConfigurationSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConfigurationSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof PinpointEmailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointEmail | PinpointEmailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointEmailPaginationConfiguration, + ListConfigurationSetsCommandInput, + ListConfigurationSetsCommandOutput +>(PinpointEmailClient, ListConfigurationSetsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-pinpoint-email/src/pagination/ListDedicatedIpPoolsPaginator.ts b/clients/client-pinpoint-email/src/pagination/ListDedicatedIpPoolsPaginator.ts index 2c6c1c61183a..7b8e93643b91 100644 --- a/clients/client-pinpoint-email/src/pagination/ListDedicatedIpPoolsPaginator.ts +++ b/clients/client-pinpoint-email/src/pagination/ListDedicatedIpPoolsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointEmailClient } from "../PinpointEmailClient"; import { PinpointEmailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointEmailClient, - input: ListDedicatedIpPoolsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDedicatedIpPoolsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDedicatedIpPools( +export const paginateListDedicatedIpPools: ( config: PinpointEmailPaginationConfiguration, input: ListDedicatedIpPoolsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDedicatedIpPoolsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof PinpointEmailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointEmail | PinpointEmailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointEmailPaginationConfiguration, + ListDedicatedIpPoolsCommandInput, + ListDedicatedIpPoolsCommandOutput +>(PinpointEmailClient, ListDedicatedIpPoolsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-pinpoint-email/src/pagination/ListDeliverabilityTestReportsPaginator.ts b/clients/client-pinpoint-email/src/pagination/ListDeliverabilityTestReportsPaginator.ts index a229222893e2..27f3f580a26a 100644 --- a/clients/client-pinpoint-email/src/pagination/ListDeliverabilityTestReportsPaginator.ts +++ b/clients/client-pinpoint-email/src/pagination/ListDeliverabilityTestReportsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointEmailClient } from "../PinpointEmailClient"; import { PinpointEmailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointEmailClient, - input: ListDeliverabilityTestReportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeliverabilityTestReportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeliverabilityTestReports( +export const paginateListDeliverabilityTestReports: ( config: PinpointEmailPaginationConfiguration, input: ListDeliverabilityTestReportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeliverabilityTestReportsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof PinpointEmailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointEmail | PinpointEmailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointEmailPaginationConfiguration, + ListDeliverabilityTestReportsCommandInput, + ListDeliverabilityTestReportsCommandOutput +>(PinpointEmailClient, ListDeliverabilityTestReportsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-pinpoint-email/src/pagination/ListDomainDeliverabilityCampaignsPaginator.ts b/clients/client-pinpoint-email/src/pagination/ListDomainDeliverabilityCampaignsPaginator.ts index 17425602bc7d..f02ffd205db0 100644 --- a/clients/client-pinpoint-email/src/pagination/ListDomainDeliverabilityCampaignsPaginator.ts +++ b/clients/client-pinpoint-email/src/pagination/ListDomainDeliverabilityCampaignsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointEmailClient } from "../PinpointEmailClient"; import { PinpointEmailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointEmailClient, - input: ListDomainDeliverabilityCampaignsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainDeliverabilityCampaignsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomainDeliverabilityCampaigns( +export const paginateListDomainDeliverabilityCampaigns: ( config: PinpointEmailPaginationConfiguration, input: ListDomainDeliverabilityCampaignsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainDeliverabilityCampaignsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof PinpointEmailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointEmail | PinpointEmailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointEmailPaginationConfiguration, + ListDomainDeliverabilityCampaignsCommandInput, + ListDomainDeliverabilityCampaignsCommandOutput +>(PinpointEmailClient, ListDomainDeliverabilityCampaignsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-pinpoint-email/src/pagination/ListEmailIdentitiesPaginator.ts b/clients/client-pinpoint-email/src/pagination/ListEmailIdentitiesPaginator.ts index a2e2b534ed62..e9273de8e65c 100644 --- a/clients/client-pinpoint-email/src/pagination/ListEmailIdentitiesPaginator.ts +++ b/clients/client-pinpoint-email/src/pagination/ListEmailIdentitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointEmailClient } from "../PinpointEmailClient"; import { PinpointEmailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointEmailClient, - input: ListEmailIdentitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEmailIdentitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEmailIdentities( +export const paginateListEmailIdentities: ( config: PinpointEmailPaginationConfiguration, input: ListEmailIdentitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEmailIdentitiesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof PinpointEmailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointEmail | PinpointEmailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointEmailPaginationConfiguration, + ListEmailIdentitiesCommandInput, + ListEmailIdentitiesCommandOutput +>(PinpointEmailClient, ListEmailIdentitiesCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-pinpoint-sms-voice-v2/package.json b/clients/client-pinpoint-sms-voice-v2/package.json index b7130384d84f..17d452803068 100644 --- a/clients/client-pinpoint-sms-voice-v2/package.json +++ b/clients/client-pinpoint-sms-voice-v2/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeAccountAttributesPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeAccountAttributesPaginator.ts index 39b614d4c65c..72153063ceff 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeAccountAttributesPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeAccountAttributesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeAccountAttributesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAccountAttributesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAccountAttributes( +export const paginateDescribeAccountAttributes: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeAccountAttributesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAccountAttributesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeAccountAttributesCommandInput, + DescribeAccountAttributesCommandOutput +>(PinpointSMSVoiceV2Client, DescribeAccountAttributesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeAccountLimitsPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeAccountLimitsPaginator.ts index 9c98b832a3fa..e3670039046b 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeAccountLimitsPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeAccountLimitsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeAccountLimitsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAccountLimitsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAccountLimits( +export const paginateDescribeAccountLimits: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeAccountLimitsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAccountLimitsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeAccountLimitsCommandInput, + DescribeAccountLimitsCommandOutput +>(PinpointSMSVoiceV2Client, DescribeAccountLimitsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeConfigurationSetsPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeConfigurationSetsPaginator.ts index de3932e21b75..c015d5361c49 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeConfigurationSetsPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeConfigurationSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeConfigurationSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeConfigurationSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeConfigurationSets( +export const paginateDescribeConfigurationSets: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeConfigurationSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeConfigurationSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeConfigurationSetsCommandInput, + DescribeConfigurationSetsCommandOutput +>(PinpointSMSVoiceV2Client, DescribeConfigurationSetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeKeywordsPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeKeywordsPaginator.ts index c309efd66f37..83075f39399e 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeKeywordsPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeKeywordsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeKeywordsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeKeywordsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeKeywords( +export const paginateDescribeKeywords: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeKeywordsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeKeywordsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeKeywordsCommandInput, + DescribeKeywordsCommandOutput +>(PinpointSMSVoiceV2Client, DescribeKeywordsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeOptOutListsPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeOptOutListsPaginator.ts index 9d7f273f3a56..9716cee9791d 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeOptOutListsPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeOptOutListsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeOptOutListsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOptOutListsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOptOutLists( +export const paginateDescribeOptOutLists: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeOptOutListsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOptOutListsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeOptOutListsCommandInput, + DescribeOptOutListsCommandOutput +>(PinpointSMSVoiceV2Client, DescribeOptOutListsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeOptedOutNumbersPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeOptedOutNumbersPaginator.ts index 07ca3ccecad6..5135e696a935 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeOptedOutNumbersPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeOptedOutNumbersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeOptedOutNumbersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOptedOutNumbersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOptedOutNumbers( +export const paginateDescribeOptedOutNumbers: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeOptedOutNumbersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOptedOutNumbersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeOptedOutNumbersCommandInput, + DescribeOptedOutNumbersCommandOutput +>(PinpointSMSVoiceV2Client, DescribeOptedOutNumbersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribePhoneNumbersPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribePhoneNumbersPaginator.ts index 6b5c4df38d6f..de4340a7f75f 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribePhoneNumbersPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribePhoneNumbersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribePhoneNumbersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePhoneNumbersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePhoneNumbers( +export const paginateDescribePhoneNumbers: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribePhoneNumbersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePhoneNumbersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribePhoneNumbersCommandInput, + DescribePhoneNumbersCommandOutput +>(PinpointSMSVoiceV2Client, DescribePhoneNumbersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribePoolsPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribePoolsPaginator.ts index 0beb80233bb8..d59ce7ddb029 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribePoolsPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribePoolsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribePoolsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePoolsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePools( +export const paginateDescribePools: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribePoolsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePoolsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribePoolsCommandInput, + DescribePoolsCommandOutput +>(PinpointSMSVoiceV2Client, DescribePoolsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationAttachmentsPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationAttachmentsPaginator.ts index a78d72df1c1a..c5963e622fb5 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationAttachmentsPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationAttachmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeRegistrationAttachmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRegistrationAttachmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRegistrationAttachments( +export const paginateDescribeRegistrationAttachments: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeRegistrationAttachmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRegistrationAttachmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeRegistrationAttachmentsCommandInput, + DescribeRegistrationAttachmentsCommandOutput +>(PinpointSMSVoiceV2Client, DescribeRegistrationAttachmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationFieldDefinitionsPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationFieldDefinitionsPaginator.ts index e3df102a0847..fd56339c2471 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationFieldDefinitionsPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationFieldDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeRegistrationFieldDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRegistrationFieldDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRegistrationFieldDefinitions( +export const paginateDescribeRegistrationFieldDefinitions: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeRegistrationFieldDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRegistrationFieldDefinitionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeRegistrationFieldDefinitionsCommandInput, + DescribeRegistrationFieldDefinitionsCommandOutput +>(PinpointSMSVoiceV2Client, DescribeRegistrationFieldDefinitionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationFieldValuesPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationFieldValuesPaginator.ts index 43418660fcda..9815d146e0ba 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationFieldValuesPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationFieldValuesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeRegistrationFieldValuesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRegistrationFieldValuesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRegistrationFieldValues( +export const paginateDescribeRegistrationFieldValues: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeRegistrationFieldValuesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRegistrationFieldValuesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeRegistrationFieldValuesCommandInput, + DescribeRegistrationFieldValuesCommandOutput +>(PinpointSMSVoiceV2Client, DescribeRegistrationFieldValuesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationSectionDefinitionsPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationSectionDefinitionsPaginator.ts index 90bdd68d8abb..141734b22f2e 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationSectionDefinitionsPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationSectionDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeRegistrationSectionDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRegistrationSectionDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRegistrationSectionDefinitions( +export const paginateDescribeRegistrationSectionDefinitions: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeRegistrationSectionDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRegistrationSectionDefinitionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeRegistrationSectionDefinitionsCommandInput, + DescribeRegistrationSectionDefinitionsCommandOutput +>(PinpointSMSVoiceV2Client, DescribeRegistrationSectionDefinitionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationTypeDefinitionsPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationTypeDefinitionsPaginator.ts index 6ebb45c7a62b..4cfb0ef60020 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationTypeDefinitionsPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationTypeDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeRegistrationTypeDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRegistrationTypeDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRegistrationTypeDefinitions( +export const paginateDescribeRegistrationTypeDefinitions: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeRegistrationTypeDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRegistrationTypeDefinitionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeRegistrationTypeDefinitionsCommandInput, + DescribeRegistrationTypeDefinitionsCommandOutput +>(PinpointSMSVoiceV2Client, DescribeRegistrationTypeDefinitionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationVersionsPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationVersionsPaginator.ts index 215fd7ec1eb0..1cad238a177a 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationVersionsPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeRegistrationVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRegistrationVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRegistrationVersions( +export const paginateDescribeRegistrationVersions: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeRegistrationVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRegistrationVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeRegistrationVersionsCommandInput, + DescribeRegistrationVersionsCommandOutput +>(PinpointSMSVoiceV2Client, DescribeRegistrationVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationsPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationsPaginator.ts index eb050e3c8ca9..2ea10a787d70 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationsPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeRegistrationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeRegistrationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRegistrationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRegistrations( +export const paginateDescribeRegistrations: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeRegistrationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRegistrationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeRegistrationsCommandInput, + DescribeRegistrationsCommandOutput +>(PinpointSMSVoiceV2Client, DescribeRegistrationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeSenderIdsPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeSenderIdsPaginator.ts index e7849fc1ff9c..fdfcc7268712 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeSenderIdsPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeSenderIdsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeSenderIdsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSenderIdsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSenderIds( +export const paginateDescribeSenderIds: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeSenderIdsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSenderIdsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeSenderIdsCommandInput, + DescribeSenderIdsCommandOutput +>(PinpointSMSVoiceV2Client, DescribeSenderIdsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeSpendLimitsPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeSpendLimitsPaginator.ts index 9e402814207d..658e7c0f9b74 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeSpendLimitsPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeSpendLimitsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeSpendLimitsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSpendLimitsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSpendLimits( +export const paginateDescribeSpendLimits: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeSpendLimitsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSpendLimitsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeSpendLimitsCommandInput, + DescribeSpendLimitsCommandOutput +>(PinpointSMSVoiceV2Client, DescribeSpendLimitsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeVerifiedDestinationNumbersPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeVerifiedDestinationNumbersPaginator.ts index 174a5eee7cc3..c4f219f8cee0 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeVerifiedDestinationNumbersPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/DescribeVerifiedDestinationNumbersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: DescribeVerifiedDestinationNumbersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVerifiedDestinationNumbersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVerifiedDestinationNumbers( +export const paginateDescribeVerifiedDestinationNumbers: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: DescribeVerifiedDestinationNumbersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVerifiedDestinationNumbersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + DescribeVerifiedDestinationNumbersCommandInput, + DescribeVerifiedDestinationNumbersCommandOutput +>(PinpointSMSVoiceV2Client, DescribeVerifiedDestinationNumbersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/ListPoolOriginationIdentitiesPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/ListPoolOriginationIdentitiesPaginator.ts index b24b61b6f54f..2abf7a609ade 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/ListPoolOriginationIdentitiesPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/ListPoolOriginationIdentitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: ListPoolOriginationIdentitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPoolOriginationIdentitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPoolOriginationIdentities( +export const paginateListPoolOriginationIdentities: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: ListPoolOriginationIdentitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPoolOriginationIdentitiesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + ListPoolOriginationIdentitiesCommandInput, + ListPoolOriginationIdentitiesCommandOutput +>(PinpointSMSVoiceV2Client, ListPoolOriginationIdentitiesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pinpoint-sms-voice-v2/src/pagination/ListRegistrationAssociationsPaginator.ts b/clients/client-pinpoint-sms-voice-v2/src/pagination/ListRegistrationAssociationsPaginator.ts index 5da282bad52f..6ffeed407fdc 100644 --- a/clients/client-pinpoint-sms-voice-v2/src/pagination/ListRegistrationAssociationsPaginator.ts +++ b/clients/client-pinpoint-sms-voice-v2/src/pagination/ListRegistrationAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PinpointSMSVoiceV2Client } from "../PinpointSMSVoiceV2Client"; import { PinpointSMSVoiceV2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PinpointSMSVoiceV2Client, - input: ListRegistrationAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRegistrationAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRegistrationAssociations( +export const paginateListRegistrationAssociations: ( config: PinpointSMSVoiceV2PaginationConfiguration, input: ListRegistrationAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRegistrationAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PinpointSMSVoiceV2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PinpointSMSVoiceV2 | PinpointSMSVoiceV2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PinpointSMSVoiceV2PaginationConfiguration, + ListRegistrationAssociationsCommandInput, + ListRegistrationAssociationsCommandOutput +>(PinpointSMSVoiceV2Client, ListRegistrationAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pipes/src/pagination/ListPipesPaginator.ts b/clients/client-pipes/src/pagination/ListPipesPaginator.ts index a8034a61bef2..10e78218e367 100644 --- a/clients/client-pipes/src/pagination/ListPipesPaginator.ts +++ b/clients/client-pipes/src/pagination/ListPipesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListPipesCommand, ListPipesCommandInput, ListPipesCommandOutput } from "../commands/ListPipesCommand"; import { PipesClient } from "../PipesClient"; import { PipesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PipesClient, - input: ListPipesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPipesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPipes( +export const paginateListPipes: ( config: PipesPaginationConfiguration, input: ListPipesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPipesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof PipesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Pipes | PipesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PipesPaginationConfiguration, + ListPipesCommandInput, + ListPipesCommandOutput +>(PipesClient, ListPipesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-polly/src/pagination/ListSpeechSynthesisTasksPaginator.ts b/clients/client-polly/src/pagination/ListSpeechSynthesisTasksPaginator.ts index 166bfc94006c..fc578011e062 100644 --- a/clients/client-polly/src/pagination/ListSpeechSynthesisTasksPaginator.ts +++ b/clients/client-polly/src/pagination/ListSpeechSynthesisTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PollyClient } from "../PollyClient"; import { PollyPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PollyClient, - input: ListSpeechSynthesisTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSpeechSynthesisTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSpeechSynthesisTasks( +export const paginateListSpeechSynthesisTasks: ( config: PollyPaginationConfiguration, input: ListSpeechSynthesisTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSpeechSynthesisTasksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PollyClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Polly | PollyClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PollyPaginationConfiguration, + ListSpeechSynthesisTasksCommandInput, + ListSpeechSynthesisTasksCommandOutput +>(PollyClient, ListSpeechSynthesisTasksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pricing/package.json b/clients/client-pricing/package.json index 52f0bceb5c6f..d23f130b4305 100644 --- a/clients/client-pricing/package.json +++ b/clients/client-pricing/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-pricing/src/pagination/DescribeServicesPaginator.ts b/clients/client-pricing/src/pagination/DescribeServicesPaginator.ts index 0fa2f37f1426..9cbc4b66660b 100644 --- a/clients/client-pricing/src/pagination/DescribeServicesPaginator.ts +++ b/clients/client-pricing/src/pagination/DescribeServicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PricingClient } from "../PricingClient"; import { PricingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PricingClient, - input: DescribeServicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeServicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeServices( +export const paginateDescribeServices: ( config: PricingPaginationConfiguration, input: DescribeServicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeServicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PricingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Pricing | PricingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PricingPaginationConfiguration, + DescribeServicesCommandInput, + DescribeServicesCommandOutput +>(PricingClient, DescribeServicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pricing/src/pagination/GetAttributeValuesPaginator.ts b/clients/client-pricing/src/pagination/GetAttributeValuesPaginator.ts index ed864721907a..5ef42b963e55 100644 --- a/clients/client-pricing/src/pagination/GetAttributeValuesPaginator.ts +++ b/clients/client-pricing/src/pagination/GetAttributeValuesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PricingClient } from "../PricingClient"; import { PricingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PricingClient, - input: GetAttributeValuesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetAttributeValuesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetAttributeValues( +export const paginateGetAttributeValues: ( config: PricingPaginationConfiguration, input: GetAttributeValuesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetAttributeValuesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PricingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Pricing | PricingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PricingPaginationConfiguration, + GetAttributeValuesCommandInput, + GetAttributeValuesCommandOutput +>(PricingClient, GetAttributeValuesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pricing/src/pagination/GetProductsPaginator.ts b/clients/client-pricing/src/pagination/GetProductsPaginator.ts index 20e0c0488915..e2a023f210a2 100644 --- a/clients/client-pricing/src/pagination/GetProductsPaginator.ts +++ b/clients/client-pricing/src/pagination/GetProductsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetProductsCommand, GetProductsCommandInput, GetProductsCommandOutput } from "../commands/GetProductsCommand"; import { PricingClient } from "../PricingClient"; import { PricingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PricingClient, - input: GetProductsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetProductsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetProducts( +export const paginateGetProducts: ( config: PricingPaginationConfiguration, input: GetProductsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetProductsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PricingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Pricing | PricingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PricingPaginationConfiguration, + GetProductsCommandInput, + GetProductsCommandOutput +>(PricingClient, GetProductsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-pricing/src/pagination/ListPriceListsPaginator.ts b/clients/client-pricing/src/pagination/ListPriceListsPaginator.ts index a592d0b02d85..5e45c7e15215 100644 --- a/clients/client-pricing/src/pagination/ListPriceListsPaginator.ts +++ b/clients/client-pricing/src/pagination/ListPriceListsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PricingClient } from "../PricingClient"; import { PricingPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PricingClient, - input: ListPriceListsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPriceListsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPriceLists( +export const paginateListPriceLists: ( config: PricingPaginationConfiguration, input: ListPriceListsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPriceListsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof PricingClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Pricing | PricingClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PricingPaginationConfiguration, + ListPriceListsCommandInput, + ListPriceListsCommandOutput +>(PricingClient, ListPriceListsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-privatenetworks/src/pagination/ListDeviceIdentifiersPaginator.ts b/clients/client-privatenetworks/src/pagination/ListDeviceIdentifiersPaginator.ts index 798abd5327f3..4d52933a47a8 100644 --- a/clients/client-privatenetworks/src/pagination/ListDeviceIdentifiersPaginator.ts +++ b/clients/client-privatenetworks/src/pagination/ListDeviceIdentifiersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PrivateNetworksClient } from "../PrivateNetworksClient"; import { PrivateNetworksPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PrivateNetworksClient, - input: ListDeviceIdentifiersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeviceIdentifiersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeviceIdentifiers( +export const paginateListDeviceIdentifiers: ( config: PrivateNetworksPaginationConfiguration, input: ListDeviceIdentifiersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.startToken - let token: typeof input.startToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeviceIdentifiersCommandOutput; - while (hasNext) { - input.startToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PrivateNetworksClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PrivateNetworks | PrivateNetworksClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PrivateNetworksPaginationConfiguration, + ListDeviceIdentifiersCommandInput, + ListDeviceIdentifiersCommandOutput +>(PrivateNetworksClient, ListDeviceIdentifiersCommand, "startToken", "nextToken", "maxResults"); diff --git a/clients/client-privatenetworks/src/pagination/ListNetworkResourcesPaginator.ts b/clients/client-privatenetworks/src/pagination/ListNetworkResourcesPaginator.ts index afc46bde0763..4a759ab48730 100644 --- a/clients/client-privatenetworks/src/pagination/ListNetworkResourcesPaginator.ts +++ b/clients/client-privatenetworks/src/pagination/ListNetworkResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PrivateNetworksClient } from "../PrivateNetworksClient"; import { PrivateNetworksPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PrivateNetworksClient, - input: ListNetworkResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNetworkResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNetworkResources( +export const paginateListNetworkResources: ( config: PrivateNetworksPaginationConfiguration, input: ListNetworkResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.startToken - let token: typeof input.startToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNetworkResourcesCommandOutput; - while (hasNext) { - input.startToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PrivateNetworksClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PrivateNetworks | PrivateNetworksClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PrivateNetworksPaginationConfiguration, + ListNetworkResourcesCommandInput, + ListNetworkResourcesCommandOutput +>(PrivateNetworksClient, ListNetworkResourcesCommand, "startToken", "nextToken", "maxResults"); diff --git a/clients/client-privatenetworks/src/pagination/ListNetworkSitesPaginator.ts b/clients/client-privatenetworks/src/pagination/ListNetworkSitesPaginator.ts index 8d90a0de0caf..c0c859f09583 100644 --- a/clients/client-privatenetworks/src/pagination/ListNetworkSitesPaginator.ts +++ b/clients/client-privatenetworks/src/pagination/ListNetworkSitesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PrivateNetworksClient } from "../PrivateNetworksClient"; import { PrivateNetworksPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PrivateNetworksClient, - input: ListNetworkSitesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNetworkSitesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNetworkSites( +export const paginateListNetworkSites: ( config: PrivateNetworksPaginationConfiguration, input: ListNetworkSitesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.startToken - let token: typeof input.startToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNetworkSitesCommandOutput; - while (hasNext) { - input.startToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PrivateNetworksClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PrivateNetworks | PrivateNetworksClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PrivateNetworksPaginationConfiguration, + ListNetworkSitesCommandInput, + ListNetworkSitesCommandOutput +>(PrivateNetworksClient, ListNetworkSitesCommand, "startToken", "nextToken", "maxResults"); diff --git a/clients/client-privatenetworks/src/pagination/ListNetworksPaginator.ts b/clients/client-privatenetworks/src/pagination/ListNetworksPaginator.ts index 05e30622cff3..f1dd2210f296 100644 --- a/clients/client-privatenetworks/src/pagination/ListNetworksPaginator.ts +++ b/clients/client-privatenetworks/src/pagination/ListNetworksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { PrivateNetworksClient } from "../PrivateNetworksClient"; import { PrivateNetworksPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PrivateNetworksClient, - input: ListNetworksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNetworksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNetworks( +export const paginateListNetworks: ( config: PrivateNetworksPaginationConfiguration, input: ListNetworksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.startToken - let token: typeof input.startToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNetworksCommandOutput; - while (hasNext) { - input.startToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PrivateNetworksClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PrivateNetworks | PrivateNetworksClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PrivateNetworksPaginationConfiguration, + ListNetworksCommandInput, + ListNetworksCommandOutput +>(PrivateNetworksClient, ListNetworksCommand, "startToken", "nextToken", "maxResults"); diff --git a/clients/client-privatenetworks/src/pagination/ListOrdersPaginator.ts b/clients/client-privatenetworks/src/pagination/ListOrdersPaginator.ts index ab4d33a22c41..e56fd932f49f 100644 --- a/clients/client-privatenetworks/src/pagination/ListOrdersPaginator.ts +++ b/clients/client-privatenetworks/src/pagination/ListOrdersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListOrdersCommand, ListOrdersCommandInput, ListOrdersCommandOutput } from "../commands/ListOrdersCommand"; import { PrivateNetworksClient } from "../PrivateNetworksClient"; import { PrivateNetworksPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: PrivateNetworksClient, - input: ListOrdersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOrdersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOrders( +export const paginateListOrders: ( config: PrivateNetworksPaginationConfiguration, input: ListOrdersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.startToken - let token: typeof input.startToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOrdersCommandOutput; - while (hasNext) { - input.startToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof PrivateNetworksClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected PrivateNetworks | PrivateNetworksClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + PrivateNetworksPaginationConfiguration, + ListOrdersCommandInput, + ListOrdersCommandOutput +>(PrivateNetworksClient, ListOrdersCommand, "startToken", "nextToken", "maxResults"); diff --git a/clients/client-proton/package.json b/clients/client-proton/package.json index 1dbc16a4edd2..192c2fd76c82 100644 --- a/clients/client-proton/package.json +++ b/clients/client-proton/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-proton/src/pagination/ListComponentOutputsPaginator.ts b/clients/client-proton/src/pagination/ListComponentOutputsPaginator.ts index 6e370b1528c0..4fb597f937cc 100644 --- a/clients/client-proton/src/pagination/ListComponentOutputsPaginator.ts +++ b/clients/client-proton/src/pagination/ListComponentOutputsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListComponentOutputsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComponentOutputsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComponentOutputs( +export const paginateListComponentOutputs: ( config: ProtonPaginationConfiguration, input: ListComponentOutputsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComponentOutputsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListComponentOutputsCommandInput, + ListComponentOutputsCommandOutput +>(ProtonClient, ListComponentOutputsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-proton/src/pagination/ListComponentProvisionedResourcesPaginator.ts b/clients/client-proton/src/pagination/ListComponentProvisionedResourcesPaginator.ts index efe51b5008af..47ba74e9db1a 100644 --- a/clients/client-proton/src/pagination/ListComponentProvisionedResourcesPaginator.ts +++ b/clients/client-proton/src/pagination/ListComponentProvisionedResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListComponentProvisionedResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComponentProvisionedResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComponentProvisionedResources( +export const paginateListComponentProvisionedResources: ( config: ProtonPaginationConfiguration, input: ListComponentProvisionedResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComponentProvisionedResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListComponentProvisionedResourcesCommandInput, + ListComponentProvisionedResourcesCommandOutput +>(ProtonClient, ListComponentProvisionedResourcesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-proton/src/pagination/ListComponentsPaginator.ts b/clients/client-proton/src/pagination/ListComponentsPaginator.ts index 83d8330ef829..050c1db5d42a 100644 --- a/clients/client-proton/src/pagination/ListComponentsPaginator.ts +++ b/clients/client-proton/src/pagination/ListComponentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListComponentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComponentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComponents( +export const paginateListComponents: ( config: ProtonPaginationConfiguration, input: ListComponentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComponentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListComponentsCommandInput, + ListComponentsCommandOutput +>(ProtonClient, ListComponentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-proton/src/pagination/ListDeploymentsPaginator.ts b/clients/client-proton/src/pagination/ListDeploymentsPaginator.ts index 2c43a19cfe09..353711c273f8 100644 --- a/clients/client-proton/src/pagination/ListDeploymentsPaginator.ts +++ b/clients/client-proton/src/pagination/ListDeploymentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListDeploymentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeploymentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeployments( +export const paginateListDeployments: ( config: ProtonPaginationConfiguration, input: ListDeploymentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeploymentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListDeploymentsCommandInput, + ListDeploymentsCommandOutput +>(ProtonClient, ListDeploymentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-proton/src/pagination/ListEnvironmentAccountConnectionsPaginator.ts b/clients/client-proton/src/pagination/ListEnvironmentAccountConnectionsPaginator.ts index 31328df0d22e..c340aabc1ab8 100644 --- a/clients/client-proton/src/pagination/ListEnvironmentAccountConnectionsPaginator.ts +++ b/clients/client-proton/src/pagination/ListEnvironmentAccountConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListEnvironmentAccountConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentAccountConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironmentAccountConnections( +export const paginateListEnvironmentAccountConnections: ( config: ProtonPaginationConfiguration, input: ListEnvironmentAccountConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentAccountConnectionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListEnvironmentAccountConnectionsCommandInput, + ListEnvironmentAccountConnectionsCommandOutput +>(ProtonClient, ListEnvironmentAccountConnectionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-proton/src/pagination/ListEnvironmentOutputsPaginator.ts b/clients/client-proton/src/pagination/ListEnvironmentOutputsPaginator.ts index c2a037cb3425..bcbf0a5649dc 100644 --- a/clients/client-proton/src/pagination/ListEnvironmentOutputsPaginator.ts +++ b/clients/client-proton/src/pagination/ListEnvironmentOutputsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListEnvironmentOutputsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentOutputsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironmentOutputs( +export const paginateListEnvironmentOutputs: ( config: ProtonPaginationConfiguration, input: ListEnvironmentOutputsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentOutputsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListEnvironmentOutputsCommandInput, + ListEnvironmentOutputsCommandOutput +>(ProtonClient, ListEnvironmentOutputsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-proton/src/pagination/ListEnvironmentProvisionedResourcesPaginator.ts b/clients/client-proton/src/pagination/ListEnvironmentProvisionedResourcesPaginator.ts index 5791c05b6b42..5f43f2e77d82 100644 --- a/clients/client-proton/src/pagination/ListEnvironmentProvisionedResourcesPaginator.ts +++ b/clients/client-proton/src/pagination/ListEnvironmentProvisionedResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListEnvironmentProvisionedResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentProvisionedResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironmentProvisionedResources( +export const paginateListEnvironmentProvisionedResources: ( config: ProtonPaginationConfiguration, input: ListEnvironmentProvisionedResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentProvisionedResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListEnvironmentProvisionedResourcesCommandInput, + ListEnvironmentProvisionedResourcesCommandOutput +>(ProtonClient, ListEnvironmentProvisionedResourcesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-proton/src/pagination/ListEnvironmentTemplateVersionsPaginator.ts b/clients/client-proton/src/pagination/ListEnvironmentTemplateVersionsPaginator.ts index d2231b57e0ba..c2d38d6fbb95 100644 --- a/clients/client-proton/src/pagination/ListEnvironmentTemplateVersionsPaginator.ts +++ b/clients/client-proton/src/pagination/ListEnvironmentTemplateVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListEnvironmentTemplateVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentTemplateVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironmentTemplateVersions( +export const paginateListEnvironmentTemplateVersions: ( config: ProtonPaginationConfiguration, input: ListEnvironmentTemplateVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentTemplateVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListEnvironmentTemplateVersionsCommandInput, + ListEnvironmentTemplateVersionsCommandOutput +>(ProtonClient, ListEnvironmentTemplateVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-proton/src/pagination/ListEnvironmentTemplatesPaginator.ts b/clients/client-proton/src/pagination/ListEnvironmentTemplatesPaginator.ts index 44f64a05ab3e..79f96a8e03de 100644 --- a/clients/client-proton/src/pagination/ListEnvironmentTemplatesPaginator.ts +++ b/clients/client-proton/src/pagination/ListEnvironmentTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListEnvironmentTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironmentTemplates( +export const paginateListEnvironmentTemplates: ( config: ProtonPaginationConfiguration, input: ListEnvironmentTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListEnvironmentTemplatesCommandInput, + ListEnvironmentTemplatesCommandOutput +>(ProtonClient, ListEnvironmentTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-proton/src/pagination/ListEnvironmentsPaginator.ts b/clients/client-proton/src/pagination/ListEnvironmentsPaginator.ts index 3c55e117df5f..4464334175b4 100644 --- a/clients/client-proton/src/pagination/ListEnvironmentsPaginator.ts +++ b/clients/client-proton/src/pagination/ListEnvironmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListEnvironmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironments( +export const paginateListEnvironments: ( config: ProtonPaginationConfiguration, input: ListEnvironmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListEnvironmentsCommandInput, + ListEnvironmentsCommandOutput +>(ProtonClient, ListEnvironmentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-proton/src/pagination/ListRepositoriesPaginator.ts b/clients/client-proton/src/pagination/ListRepositoriesPaginator.ts index 2fd5ed192aa5..7c062c7e46d3 100644 --- a/clients/client-proton/src/pagination/ListRepositoriesPaginator.ts +++ b/clients/client-proton/src/pagination/ListRepositoriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListRepositoriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRepositoriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRepositories( +export const paginateListRepositories: ( config: ProtonPaginationConfiguration, input: ListRepositoriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRepositoriesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListRepositoriesCommandInput, + ListRepositoriesCommandOutput +>(ProtonClient, ListRepositoriesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-proton/src/pagination/ListRepositorySyncDefinitionsPaginator.ts b/clients/client-proton/src/pagination/ListRepositorySyncDefinitionsPaginator.ts index 6b3688823367..8046474f8da5 100644 --- a/clients/client-proton/src/pagination/ListRepositorySyncDefinitionsPaginator.ts +++ b/clients/client-proton/src/pagination/ListRepositorySyncDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListRepositorySyncDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRepositorySyncDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRepositorySyncDefinitions( +export const paginateListRepositorySyncDefinitions: ( config: ProtonPaginationConfiguration, input: ListRepositorySyncDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRepositorySyncDefinitionsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListRepositorySyncDefinitionsCommandInput, + ListRepositorySyncDefinitionsCommandOutput +>(ProtonClient, ListRepositorySyncDefinitionsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-proton/src/pagination/ListServiceInstanceOutputsPaginator.ts b/clients/client-proton/src/pagination/ListServiceInstanceOutputsPaginator.ts index 7bbeb0de8068..e8b70b3b7e57 100644 --- a/clients/client-proton/src/pagination/ListServiceInstanceOutputsPaginator.ts +++ b/clients/client-proton/src/pagination/ListServiceInstanceOutputsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListServiceInstanceOutputsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServiceInstanceOutputsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServiceInstanceOutputs( +export const paginateListServiceInstanceOutputs: ( config: ProtonPaginationConfiguration, input: ListServiceInstanceOutputsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServiceInstanceOutputsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListServiceInstanceOutputsCommandInput, + ListServiceInstanceOutputsCommandOutput +>(ProtonClient, ListServiceInstanceOutputsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-proton/src/pagination/ListServiceInstanceProvisionedResourcesPaginator.ts b/clients/client-proton/src/pagination/ListServiceInstanceProvisionedResourcesPaginator.ts index 0c7d17c51a55..82edc492ef27 100644 --- a/clients/client-proton/src/pagination/ListServiceInstanceProvisionedResourcesPaginator.ts +++ b/clients/client-proton/src/pagination/ListServiceInstanceProvisionedResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListServiceInstanceProvisionedResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServiceInstanceProvisionedResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServiceInstanceProvisionedResources( +export const paginateListServiceInstanceProvisionedResources: ( config: ProtonPaginationConfiguration, input: ListServiceInstanceProvisionedResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServiceInstanceProvisionedResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListServiceInstanceProvisionedResourcesCommandInput, + ListServiceInstanceProvisionedResourcesCommandOutput +>(ProtonClient, ListServiceInstanceProvisionedResourcesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-proton/src/pagination/ListServiceInstancesPaginator.ts b/clients/client-proton/src/pagination/ListServiceInstancesPaginator.ts index cb0c72f16892..a47ad9d60c4c 100644 --- a/clients/client-proton/src/pagination/ListServiceInstancesPaginator.ts +++ b/clients/client-proton/src/pagination/ListServiceInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListServiceInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServiceInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServiceInstances( +export const paginateListServiceInstances: ( config: ProtonPaginationConfiguration, input: ListServiceInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServiceInstancesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListServiceInstancesCommandInput, + ListServiceInstancesCommandOutput +>(ProtonClient, ListServiceInstancesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-proton/src/pagination/ListServicePipelineOutputsPaginator.ts b/clients/client-proton/src/pagination/ListServicePipelineOutputsPaginator.ts index c3994fcde114..e49cae2dfa32 100644 --- a/clients/client-proton/src/pagination/ListServicePipelineOutputsPaginator.ts +++ b/clients/client-proton/src/pagination/ListServicePipelineOutputsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListServicePipelineOutputsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServicePipelineOutputsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServicePipelineOutputs( +export const paginateListServicePipelineOutputs: ( config: ProtonPaginationConfiguration, input: ListServicePipelineOutputsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServicePipelineOutputsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListServicePipelineOutputsCommandInput, + ListServicePipelineOutputsCommandOutput +>(ProtonClient, ListServicePipelineOutputsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-proton/src/pagination/ListServicePipelineProvisionedResourcesPaginator.ts b/clients/client-proton/src/pagination/ListServicePipelineProvisionedResourcesPaginator.ts index a279cad4ab23..5238065835e7 100644 --- a/clients/client-proton/src/pagination/ListServicePipelineProvisionedResourcesPaginator.ts +++ b/clients/client-proton/src/pagination/ListServicePipelineProvisionedResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListServicePipelineProvisionedResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServicePipelineProvisionedResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServicePipelineProvisionedResources( +export const paginateListServicePipelineProvisionedResources: ( config: ProtonPaginationConfiguration, input: ListServicePipelineProvisionedResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServicePipelineProvisionedResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListServicePipelineProvisionedResourcesCommandInput, + ListServicePipelineProvisionedResourcesCommandOutput +>(ProtonClient, ListServicePipelineProvisionedResourcesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-proton/src/pagination/ListServiceTemplateVersionsPaginator.ts b/clients/client-proton/src/pagination/ListServiceTemplateVersionsPaginator.ts index dc656a856e4e..02132f32b9fa 100644 --- a/clients/client-proton/src/pagination/ListServiceTemplateVersionsPaginator.ts +++ b/clients/client-proton/src/pagination/ListServiceTemplateVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListServiceTemplateVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServiceTemplateVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServiceTemplateVersions( +export const paginateListServiceTemplateVersions: ( config: ProtonPaginationConfiguration, input: ListServiceTemplateVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServiceTemplateVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListServiceTemplateVersionsCommandInput, + ListServiceTemplateVersionsCommandOutput +>(ProtonClient, ListServiceTemplateVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-proton/src/pagination/ListServiceTemplatesPaginator.ts b/clients/client-proton/src/pagination/ListServiceTemplatesPaginator.ts index 7288703edd08..7686f077b54c 100644 --- a/clients/client-proton/src/pagination/ListServiceTemplatesPaginator.ts +++ b/clients/client-proton/src/pagination/ListServiceTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListServiceTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServiceTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServiceTemplates( +export const paginateListServiceTemplates: ( config: ProtonPaginationConfiguration, input: ListServiceTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServiceTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListServiceTemplatesCommandInput, + ListServiceTemplatesCommandOutput +>(ProtonClient, ListServiceTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-proton/src/pagination/ListServicesPaginator.ts b/clients/client-proton/src/pagination/ListServicesPaginator.ts index f181b55f9b99..f6d9efec26cb 100644 --- a/clients/client-proton/src/pagination/ListServicesPaginator.ts +++ b/clients/client-proton/src/pagination/ListServicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListServicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServices( +export const paginateListServices: ( config: ProtonPaginationConfiguration, input: ListServicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServicesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListServicesCommandInput, + ListServicesCommandOutput +>(ProtonClient, ListServicesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-proton/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-proton/src/pagination/ListTagsForResourcePaginator.ts index b297f53e9cd2..3122f220c2ad 100644 --- a/clients/client-proton/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-proton/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ProtonClient } from "../ProtonClient"; import { ProtonPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ProtonClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: ProtonPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ProtonClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Proton | ProtonClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ProtonPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(ProtonClient, ListTagsForResourceCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qbusiness/src/pagination/GetChatControlsConfigurationPaginator.ts b/clients/client-qbusiness/src/pagination/GetChatControlsConfigurationPaginator.ts index 4718f5bc5860..758c3dbaf780 100644 --- a/clients/client-qbusiness/src/pagination/GetChatControlsConfigurationPaginator.ts +++ b/clients/client-qbusiness/src/pagination/GetChatControlsConfigurationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QBusinessClient } from "../QBusinessClient"; import { QBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QBusinessClient, - input: GetChatControlsConfigurationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetChatControlsConfigurationCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetChatControlsConfiguration( +export const paginateGetChatControlsConfiguration: ( config: QBusinessPaginationConfiguration, input: GetChatControlsConfigurationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetChatControlsConfigurationCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QBusiness | QBusinessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QBusinessPaginationConfiguration, + GetChatControlsConfigurationCommandInput, + GetChatControlsConfigurationCommandOutput +>(QBusinessClient, GetChatControlsConfigurationCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qbusiness/src/pagination/ListApplicationsPaginator.ts b/clients/client-qbusiness/src/pagination/ListApplicationsPaginator.ts index 75dc7b0deae7..ceb1eaf5c2cf 100644 --- a/clients/client-qbusiness/src/pagination/ListApplicationsPaginator.ts +++ b/clients/client-qbusiness/src/pagination/ListApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QBusinessClient } from "../QBusinessClient"; import { QBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QBusinessClient, - input: ListApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplications( +export const paginateListApplications: ( config: QBusinessPaginationConfiguration, input: ListApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QBusiness | QBusinessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QBusinessPaginationConfiguration, + ListApplicationsCommandInput, + ListApplicationsCommandOutput +>(QBusinessClient, ListApplicationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qbusiness/src/pagination/ListConversationsPaginator.ts b/clients/client-qbusiness/src/pagination/ListConversationsPaginator.ts index 68553aa60fc0..61a79073c1ce 100644 --- a/clients/client-qbusiness/src/pagination/ListConversationsPaginator.ts +++ b/clients/client-qbusiness/src/pagination/ListConversationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QBusinessClient } from "../QBusinessClient"; import { QBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QBusinessClient, - input: ListConversationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConversationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConversations( +export const paginateListConversations: ( config: QBusinessPaginationConfiguration, input: ListConversationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConversationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QBusiness | QBusinessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QBusinessPaginationConfiguration, + ListConversationsCommandInput, + ListConversationsCommandOutput +>(QBusinessClient, ListConversationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qbusiness/src/pagination/ListDataSourceSyncJobsPaginator.ts b/clients/client-qbusiness/src/pagination/ListDataSourceSyncJobsPaginator.ts index 1368801165ca..a14a5ffa345b 100644 --- a/clients/client-qbusiness/src/pagination/ListDataSourceSyncJobsPaginator.ts +++ b/clients/client-qbusiness/src/pagination/ListDataSourceSyncJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QBusinessClient } from "../QBusinessClient"; import { QBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QBusinessClient, - input: ListDataSourceSyncJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataSourceSyncJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataSourceSyncJobs( +export const paginateListDataSourceSyncJobs: ( config: QBusinessPaginationConfiguration, input: ListDataSourceSyncJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataSourceSyncJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QBusiness | QBusinessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QBusinessPaginationConfiguration, + ListDataSourceSyncJobsCommandInput, + ListDataSourceSyncJobsCommandOutput +>(QBusinessClient, ListDataSourceSyncJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qbusiness/src/pagination/ListDataSourcesPaginator.ts b/clients/client-qbusiness/src/pagination/ListDataSourcesPaginator.ts index 96df0e4174f3..fe5ce1aa2765 100644 --- a/clients/client-qbusiness/src/pagination/ListDataSourcesPaginator.ts +++ b/clients/client-qbusiness/src/pagination/ListDataSourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QBusinessClient } from "../QBusinessClient"; import { QBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QBusinessClient, - input: ListDataSourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataSourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataSources( +export const paginateListDataSources: ( config: QBusinessPaginationConfiguration, input: ListDataSourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataSourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QBusiness | QBusinessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QBusinessPaginationConfiguration, + ListDataSourcesCommandInput, + ListDataSourcesCommandOutput +>(QBusinessClient, ListDataSourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qbusiness/src/pagination/ListDocumentsPaginator.ts b/clients/client-qbusiness/src/pagination/ListDocumentsPaginator.ts index 1e8555cc82ef..bb1fea27522c 100644 --- a/clients/client-qbusiness/src/pagination/ListDocumentsPaginator.ts +++ b/clients/client-qbusiness/src/pagination/ListDocumentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QBusinessClient } from "../QBusinessClient"; import { QBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QBusinessClient, - input: ListDocumentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDocumentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDocuments( +export const paginateListDocuments: ( config: QBusinessPaginationConfiguration, input: ListDocumentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDocumentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QBusiness | QBusinessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QBusinessPaginationConfiguration, + ListDocumentsCommandInput, + ListDocumentsCommandOutput +>(QBusinessClient, ListDocumentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qbusiness/src/pagination/ListGroupsPaginator.ts b/clients/client-qbusiness/src/pagination/ListGroupsPaginator.ts index 1e24c5a40b74..7d622000dad1 100644 --- a/clients/client-qbusiness/src/pagination/ListGroupsPaginator.ts +++ b/clients/client-qbusiness/src/pagination/ListGroupsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListGroupsCommand, ListGroupsCommandInput, ListGroupsCommandOutput } from "../commands/ListGroupsCommand"; import { QBusinessClient } from "../QBusinessClient"; import { QBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QBusinessClient, - input: ListGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroups( +export const paginateListGroups: ( config: QBusinessPaginationConfiguration, input: ListGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QBusiness | QBusinessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QBusinessPaginationConfiguration, + ListGroupsCommandInput, + ListGroupsCommandOutput +>(QBusinessClient, ListGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qbusiness/src/pagination/ListIndicesPaginator.ts b/clients/client-qbusiness/src/pagination/ListIndicesPaginator.ts index 5f319017bb20..7086de503518 100644 --- a/clients/client-qbusiness/src/pagination/ListIndicesPaginator.ts +++ b/clients/client-qbusiness/src/pagination/ListIndicesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListIndicesCommand, ListIndicesCommandInput, ListIndicesCommandOutput } from "../commands/ListIndicesCommand"; import { QBusinessClient } from "../QBusinessClient"; import { QBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QBusinessClient, - input: ListIndicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIndicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIndices( +export const paginateListIndices: ( config: QBusinessPaginationConfiguration, input: ListIndicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIndicesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QBusiness | QBusinessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QBusinessPaginationConfiguration, + ListIndicesCommandInput, + ListIndicesCommandOutput +>(QBusinessClient, ListIndicesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qbusiness/src/pagination/ListMessagesPaginator.ts b/clients/client-qbusiness/src/pagination/ListMessagesPaginator.ts index 2167e8423b41..78a95661421d 100644 --- a/clients/client-qbusiness/src/pagination/ListMessagesPaginator.ts +++ b/clients/client-qbusiness/src/pagination/ListMessagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QBusinessClient } from "../QBusinessClient"; import { QBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QBusinessClient, - input: ListMessagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMessagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMessages( +export const paginateListMessages: ( config: QBusinessPaginationConfiguration, input: ListMessagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMessagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QBusiness | QBusinessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QBusinessPaginationConfiguration, + ListMessagesCommandInput, + ListMessagesCommandOutput +>(QBusinessClient, ListMessagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qbusiness/src/pagination/ListPluginsPaginator.ts b/clients/client-qbusiness/src/pagination/ListPluginsPaginator.ts index d405572b62f3..e3d480064eb8 100644 --- a/clients/client-qbusiness/src/pagination/ListPluginsPaginator.ts +++ b/clients/client-qbusiness/src/pagination/ListPluginsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListPluginsCommand, ListPluginsCommandInput, ListPluginsCommandOutput } from "../commands/ListPluginsCommand"; import { QBusinessClient } from "../QBusinessClient"; import { QBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QBusinessClient, - input: ListPluginsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPluginsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPlugins( +export const paginateListPlugins: ( config: QBusinessPaginationConfiguration, input: ListPluginsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPluginsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QBusiness | QBusinessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QBusinessPaginationConfiguration, + ListPluginsCommandInput, + ListPluginsCommandOutput +>(QBusinessClient, ListPluginsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qbusiness/src/pagination/ListRetrieversPaginator.ts b/clients/client-qbusiness/src/pagination/ListRetrieversPaginator.ts index 4201a33d4132..ae5b16b0c621 100644 --- a/clients/client-qbusiness/src/pagination/ListRetrieversPaginator.ts +++ b/clients/client-qbusiness/src/pagination/ListRetrieversPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QBusinessClient } from "../QBusinessClient"; import { QBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QBusinessClient, - input: ListRetrieversCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRetrieversCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRetrievers( +export const paginateListRetrievers: ( config: QBusinessPaginationConfiguration, input: ListRetrieversCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRetrieversCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QBusiness | QBusinessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QBusinessPaginationConfiguration, + ListRetrieversCommandInput, + ListRetrieversCommandOutput +>(QBusinessClient, ListRetrieversCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qbusiness/src/pagination/ListWebExperiencesPaginator.ts b/clients/client-qbusiness/src/pagination/ListWebExperiencesPaginator.ts index bf5b02d073c1..04da1e92ad82 100644 --- a/clients/client-qbusiness/src/pagination/ListWebExperiencesPaginator.ts +++ b/clients/client-qbusiness/src/pagination/ListWebExperiencesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QBusinessClient } from "../QBusinessClient"; import { QBusinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QBusinessClient, - input: ListWebExperiencesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWebExperiencesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWebExperiences( +export const paginateListWebExperiences: ( config: QBusinessPaginationConfiguration, input: ListWebExperiencesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWebExperiencesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QBusinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QBusiness | QBusinessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QBusinessPaginationConfiguration, + ListWebExperiencesCommandInput, + ListWebExperiencesCommandOutput +>(QBusinessClient, ListWebExperiencesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qconnect/src/pagination/ListAssistantAssociationsPaginator.ts b/clients/client-qconnect/src/pagination/ListAssistantAssociationsPaginator.ts index 3397c13397dd..bf25f5db493b 100644 --- a/clients/client-qconnect/src/pagination/ListAssistantAssociationsPaginator.ts +++ b/clients/client-qconnect/src/pagination/ListAssistantAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QConnectClient } from "../QConnectClient"; import { QConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QConnectClient, - input: ListAssistantAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssistantAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssistantAssociations( +export const paginateListAssistantAssociations: ( config: QConnectPaginationConfiguration, input: ListAssistantAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssistantAssociationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QConnect | QConnectClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QConnectPaginationConfiguration, + ListAssistantAssociationsCommandInput, + ListAssistantAssociationsCommandOutput +>(QConnectClient, ListAssistantAssociationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qconnect/src/pagination/ListAssistantsPaginator.ts b/clients/client-qconnect/src/pagination/ListAssistantsPaginator.ts index 6db0339f5f8a..8eed843607b2 100644 --- a/clients/client-qconnect/src/pagination/ListAssistantsPaginator.ts +++ b/clients/client-qconnect/src/pagination/ListAssistantsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QConnectClient } from "../QConnectClient"; import { QConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QConnectClient, - input: ListAssistantsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssistantsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssistants( +export const paginateListAssistants: ( config: QConnectPaginationConfiguration, input: ListAssistantsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssistantsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QConnect | QConnectClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QConnectPaginationConfiguration, + ListAssistantsCommandInput, + ListAssistantsCommandOutput +>(QConnectClient, ListAssistantsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qconnect/src/pagination/ListContentsPaginator.ts b/clients/client-qconnect/src/pagination/ListContentsPaginator.ts index c602481ed1e3..29adf2ca09f6 100644 --- a/clients/client-qconnect/src/pagination/ListContentsPaginator.ts +++ b/clients/client-qconnect/src/pagination/ListContentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QConnectClient } from "../QConnectClient"; import { QConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QConnectClient, - input: ListContentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContents( +export const paginateListContents: ( config: QConnectPaginationConfiguration, input: ListContentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QConnect | QConnectClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QConnectPaginationConfiguration, + ListContentsCommandInput, + ListContentsCommandOutput +>(QConnectClient, ListContentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qconnect/src/pagination/ListImportJobsPaginator.ts b/clients/client-qconnect/src/pagination/ListImportJobsPaginator.ts index 3f08bce638bd..c406e3c01d05 100644 --- a/clients/client-qconnect/src/pagination/ListImportJobsPaginator.ts +++ b/clients/client-qconnect/src/pagination/ListImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QConnectClient } from "../QConnectClient"; import { QConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QConnectClient, - input: ListImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImportJobs( +export const paginateListImportJobs: ( config: QConnectPaginationConfiguration, input: ListImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QConnect | QConnectClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QConnectPaginationConfiguration, + ListImportJobsCommandInput, + ListImportJobsCommandOutput +>(QConnectClient, ListImportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qconnect/src/pagination/ListKnowledgeBasesPaginator.ts b/clients/client-qconnect/src/pagination/ListKnowledgeBasesPaginator.ts index 662639ee6660..4b0155bda3c4 100644 --- a/clients/client-qconnect/src/pagination/ListKnowledgeBasesPaginator.ts +++ b/clients/client-qconnect/src/pagination/ListKnowledgeBasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QConnectClient } from "../QConnectClient"; import { QConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QConnectClient, - input: ListKnowledgeBasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKnowledgeBasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKnowledgeBases( +export const paginateListKnowledgeBases: ( config: QConnectPaginationConfiguration, input: ListKnowledgeBasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKnowledgeBasesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QConnect | QConnectClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QConnectPaginationConfiguration, + ListKnowledgeBasesCommandInput, + ListKnowledgeBasesCommandOutput +>(QConnectClient, ListKnowledgeBasesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qconnect/src/pagination/ListQuickResponsesPaginator.ts b/clients/client-qconnect/src/pagination/ListQuickResponsesPaginator.ts index 4a0a13bdf90d..991689d23f91 100644 --- a/clients/client-qconnect/src/pagination/ListQuickResponsesPaginator.ts +++ b/clients/client-qconnect/src/pagination/ListQuickResponsesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QConnectClient } from "../QConnectClient"; import { QConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QConnectClient, - input: ListQuickResponsesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListQuickResponsesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListQuickResponses( +export const paginateListQuickResponses: ( config: QConnectPaginationConfiguration, input: ListQuickResponsesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListQuickResponsesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QConnect | QConnectClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QConnectPaginationConfiguration, + ListQuickResponsesCommandInput, + ListQuickResponsesCommandOutput +>(QConnectClient, ListQuickResponsesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qconnect/src/pagination/QueryAssistantPaginator.ts b/clients/client-qconnect/src/pagination/QueryAssistantPaginator.ts index d25ec1f9bf1a..4f3b4c3bd621 100644 --- a/clients/client-qconnect/src/pagination/QueryAssistantPaginator.ts +++ b/clients/client-qconnect/src/pagination/QueryAssistantPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QConnectClient } from "../QConnectClient"; import { QConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QConnectClient, - input: QueryAssistantCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new QueryAssistantCommand(input), ...args); -}; /** * @public */ -export async function* paginateQueryAssistant( +export const paginateQueryAssistant: ( config: QConnectPaginationConfiguration, input: QueryAssistantCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: QueryAssistantCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QConnect | QConnectClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QConnectPaginationConfiguration, + QueryAssistantCommandInput, + QueryAssistantCommandOutput +>(QConnectClient, QueryAssistantCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qconnect/src/pagination/SearchContentPaginator.ts b/clients/client-qconnect/src/pagination/SearchContentPaginator.ts index c00a6433d653..a202133548a9 100644 --- a/clients/client-qconnect/src/pagination/SearchContentPaginator.ts +++ b/clients/client-qconnect/src/pagination/SearchContentPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QConnectClient } from "../QConnectClient"; import { QConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QConnectClient, - input: SearchContentCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchContentCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchContent( +export const paginateSearchContent: ( config: QConnectPaginationConfiguration, input: SearchContentCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchContentCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QConnect | QConnectClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QConnectPaginationConfiguration, + SearchContentCommandInput, + SearchContentCommandOutput +>(QConnectClient, SearchContentCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qconnect/src/pagination/SearchQuickResponsesPaginator.ts b/clients/client-qconnect/src/pagination/SearchQuickResponsesPaginator.ts index 4105f58a0f5c..781a30178241 100644 --- a/clients/client-qconnect/src/pagination/SearchQuickResponsesPaginator.ts +++ b/clients/client-qconnect/src/pagination/SearchQuickResponsesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QConnectClient } from "../QConnectClient"; import { QConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QConnectClient, - input: SearchQuickResponsesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchQuickResponsesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchQuickResponses( +export const paginateSearchQuickResponses: ( config: QConnectPaginationConfiguration, input: SearchQuickResponsesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchQuickResponsesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QConnect | QConnectClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QConnectPaginationConfiguration, + SearchQuickResponsesCommandInput, + SearchQuickResponsesCommandOutput +>(QConnectClient, SearchQuickResponsesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qconnect/src/pagination/SearchSessionsPaginator.ts b/clients/client-qconnect/src/pagination/SearchSessionsPaginator.ts index 18da0cf33035..1322c104cc20 100644 --- a/clients/client-qconnect/src/pagination/SearchSessionsPaginator.ts +++ b/clients/client-qconnect/src/pagination/SearchSessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QConnectClient } from "../QConnectClient"; import { QConnectPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QConnectClient, - input: SearchSessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchSessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchSessions( +export const paginateSearchSessions: ( config: QConnectPaginationConfiguration, input: SearchSessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchSessionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof QConnectClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QConnect | QConnectClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QConnectPaginationConfiguration, + SearchSessionsCommandInput, + SearchSessionsCommandOutput +>(QConnectClient, SearchSessionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-qldb/src/pagination/ListJournalKinesisStreamsForLedgerPaginator.ts b/clients/client-qldb/src/pagination/ListJournalKinesisStreamsForLedgerPaginator.ts index 4cc647e2dd6c..26a525048226 100644 --- a/clients/client-qldb/src/pagination/ListJournalKinesisStreamsForLedgerPaginator.ts +++ b/clients/client-qldb/src/pagination/ListJournalKinesisStreamsForLedgerPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QLDBClient } from "../QLDBClient"; import { QLDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QLDBClient, - input: ListJournalKinesisStreamsForLedgerCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJournalKinesisStreamsForLedgerCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJournalKinesisStreamsForLedger( +export const paginateListJournalKinesisStreamsForLedger: ( config: QLDBPaginationConfiguration, input: ListJournalKinesisStreamsForLedgerCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJournalKinesisStreamsForLedgerCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QLDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QLDB | QLDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QLDBPaginationConfiguration, + ListJournalKinesisStreamsForLedgerCommandInput, + ListJournalKinesisStreamsForLedgerCommandOutput +>(QLDBClient, ListJournalKinesisStreamsForLedgerCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-qldb/src/pagination/ListJournalS3ExportsForLedgerPaginator.ts b/clients/client-qldb/src/pagination/ListJournalS3ExportsForLedgerPaginator.ts index 21faf0cd134f..2402f19ac9b6 100644 --- a/clients/client-qldb/src/pagination/ListJournalS3ExportsForLedgerPaginator.ts +++ b/clients/client-qldb/src/pagination/ListJournalS3ExportsForLedgerPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QLDBClient } from "../QLDBClient"; import { QLDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QLDBClient, - input: ListJournalS3ExportsForLedgerCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJournalS3ExportsForLedgerCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJournalS3ExportsForLedger( +export const paginateListJournalS3ExportsForLedger: ( config: QLDBPaginationConfiguration, input: ListJournalS3ExportsForLedgerCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJournalS3ExportsForLedgerCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QLDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QLDB | QLDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QLDBPaginationConfiguration, + ListJournalS3ExportsForLedgerCommandInput, + ListJournalS3ExportsForLedgerCommandOutput +>(QLDBClient, ListJournalS3ExportsForLedgerCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-qldb/src/pagination/ListJournalS3ExportsPaginator.ts b/clients/client-qldb/src/pagination/ListJournalS3ExportsPaginator.ts index c2a6887f8ace..8c38ffd5b33c 100644 --- a/clients/client-qldb/src/pagination/ListJournalS3ExportsPaginator.ts +++ b/clients/client-qldb/src/pagination/ListJournalS3ExportsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QLDBClient } from "../QLDBClient"; import { QLDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QLDBClient, - input: ListJournalS3ExportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJournalS3ExportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJournalS3Exports( +export const paginateListJournalS3Exports: ( config: QLDBPaginationConfiguration, input: ListJournalS3ExportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJournalS3ExportsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QLDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QLDB | QLDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QLDBPaginationConfiguration, + ListJournalS3ExportsCommandInput, + ListJournalS3ExportsCommandOutput +>(QLDBClient, ListJournalS3ExportsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-qldb/src/pagination/ListLedgersPaginator.ts b/clients/client-qldb/src/pagination/ListLedgersPaginator.ts index 8441dc44c385..6060bc30c43c 100644 --- a/clients/client-qldb/src/pagination/ListLedgersPaginator.ts +++ b/clients/client-qldb/src/pagination/ListLedgersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListLedgersCommand, ListLedgersCommandInput, ListLedgersCommandOutput } from "../commands/ListLedgersCommand"; import { QLDBClient } from "../QLDBClient"; import { QLDBPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QLDBClient, - input: ListLedgersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLedgersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLedgers( +export const paginateListLedgers: ( config: QLDBPaginationConfiguration, input: ListLedgersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLedgersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QLDBClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QLDB | QLDBClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QLDBPaginationConfiguration, + ListLedgersCommandInput, + ListLedgersCommandOutput +>(QLDBClient, ListLedgersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/DescribeFolderPermissionsPaginator.ts b/clients/client-quicksight/src/pagination/DescribeFolderPermissionsPaginator.ts index 679b07858df4..c10d99563af9 100644 --- a/clients/client-quicksight/src/pagination/DescribeFolderPermissionsPaginator.ts +++ b/clients/client-quicksight/src/pagination/DescribeFolderPermissionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: DescribeFolderPermissionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFolderPermissionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFolderPermissions( +export const paginateDescribeFolderPermissions: ( config: QuickSightPaginationConfiguration, input: DescribeFolderPermissionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFolderPermissionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + DescribeFolderPermissionsCommandInput, + DescribeFolderPermissionsCommandOutput +>(QuickSightClient, DescribeFolderPermissionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/DescribeFolderResolvedPermissionsPaginator.ts b/clients/client-quicksight/src/pagination/DescribeFolderResolvedPermissionsPaginator.ts index 36f343ecb46c..77ee5c65d61f 100644 --- a/clients/client-quicksight/src/pagination/DescribeFolderResolvedPermissionsPaginator.ts +++ b/clients/client-quicksight/src/pagination/DescribeFolderResolvedPermissionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: DescribeFolderResolvedPermissionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFolderResolvedPermissionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFolderResolvedPermissions( +export const paginateDescribeFolderResolvedPermissions: ( config: QuickSightPaginationConfiguration, input: DescribeFolderResolvedPermissionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFolderResolvedPermissionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + DescribeFolderResolvedPermissionsCommandInput, + DescribeFolderResolvedPermissionsCommandOutput +>(QuickSightClient, DescribeFolderResolvedPermissionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListAnalysesPaginator.ts b/clients/client-quicksight/src/pagination/ListAnalysesPaginator.ts index 7013446482df..43a2f765079c 100644 --- a/clients/client-quicksight/src/pagination/ListAnalysesPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListAnalysesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListAnalysesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnalysesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnalyses( +export const paginateListAnalyses: ( config: QuickSightPaginationConfiguration, input: ListAnalysesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnalysesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListAnalysesCommandInput, + ListAnalysesCommandOutput +>(QuickSightClient, ListAnalysesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListAssetBundleExportJobsPaginator.ts b/clients/client-quicksight/src/pagination/ListAssetBundleExportJobsPaginator.ts index 66be4a7f3407..f55c960147a1 100644 --- a/clients/client-quicksight/src/pagination/ListAssetBundleExportJobsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListAssetBundleExportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListAssetBundleExportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssetBundleExportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssetBundleExportJobs( +export const paginateListAssetBundleExportJobs: ( config: QuickSightPaginationConfiguration, input: ListAssetBundleExportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssetBundleExportJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListAssetBundleExportJobsCommandInput, + ListAssetBundleExportJobsCommandOutput +>(QuickSightClient, ListAssetBundleExportJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListAssetBundleImportJobsPaginator.ts b/clients/client-quicksight/src/pagination/ListAssetBundleImportJobsPaginator.ts index f0f1cb34841e..c8d6edfcb7b0 100644 --- a/clients/client-quicksight/src/pagination/ListAssetBundleImportJobsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListAssetBundleImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListAssetBundleImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssetBundleImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssetBundleImportJobs( +export const paginateListAssetBundleImportJobs: ( config: QuickSightPaginationConfiguration, input: ListAssetBundleImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssetBundleImportJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListAssetBundleImportJobsCommandInput, + ListAssetBundleImportJobsCommandOutput +>(QuickSightClient, ListAssetBundleImportJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListDashboardVersionsPaginator.ts b/clients/client-quicksight/src/pagination/ListDashboardVersionsPaginator.ts index 4ea698215ca4..e9af684f68d6 100644 --- a/clients/client-quicksight/src/pagination/ListDashboardVersionsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListDashboardVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListDashboardVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDashboardVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDashboardVersions( +export const paginateListDashboardVersions: ( config: QuickSightPaginationConfiguration, input: ListDashboardVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDashboardVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListDashboardVersionsCommandInput, + ListDashboardVersionsCommandOutput +>(QuickSightClient, ListDashboardVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListDashboardsPaginator.ts b/clients/client-quicksight/src/pagination/ListDashboardsPaginator.ts index 801446be8089..6b1c3ee40397 100644 --- a/clients/client-quicksight/src/pagination/ListDashboardsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListDashboardsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListDashboardsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDashboardsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDashboards( +export const paginateListDashboards: ( config: QuickSightPaginationConfiguration, input: ListDashboardsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDashboardsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListDashboardsCommandInput, + ListDashboardsCommandOutput +>(QuickSightClient, ListDashboardsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListDataSetsPaginator.ts b/clients/client-quicksight/src/pagination/ListDataSetsPaginator.ts index afce30af4d7e..186e85578dee 100644 --- a/clients/client-quicksight/src/pagination/ListDataSetsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListDataSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListDataSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataSets( +export const paginateListDataSets: ( config: QuickSightPaginationConfiguration, input: ListDataSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListDataSetsCommandInput, + ListDataSetsCommandOutput +>(QuickSightClient, ListDataSetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListDataSourcesPaginator.ts b/clients/client-quicksight/src/pagination/ListDataSourcesPaginator.ts index 0fffca1cb704..96438229a56d 100644 --- a/clients/client-quicksight/src/pagination/ListDataSourcesPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListDataSourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListDataSourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataSourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataSources( +export const paginateListDataSources: ( config: QuickSightPaginationConfiguration, input: ListDataSourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataSourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListDataSourcesCommandInput, + ListDataSourcesCommandOutput +>(QuickSightClient, ListDataSourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListFolderMembersPaginator.ts b/clients/client-quicksight/src/pagination/ListFolderMembersPaginator.ts index 5ecc2f309b45..3ed4039af83d 100644 --- a/clients/client-quicksight/src/pagination/ListFolderMembersPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListFolderMembersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListFolderMembersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFolderMembersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFolderMembers( +export const paginateListFolderMembers: ( config: QuickSightPaginationConfiguration, input: ListFolderMembersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFolderMembersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListFolderMembersCommandInput, + ListFolderMembersCommandOutput +>(QuickSightClient, ListFolderMembersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListFoldersPaginator.ts b/clients/client-quicksight/src/pagination/ListFoldersPaginator.ts index 8d7f5797aebd..ea3a4a716020 100644 --- a/clients/client-quicksight/src/pagination/ListFoldersPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListFoldersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListFoldersCommand, ListFoldersCommandInput, ListFoldersCommandOutput } from "../commands/ListFoldersCommand"; import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListFoldersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFoldersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFolders( +export const paginateListFolders: ( config: QuickSightPaginationConfiguration, input: ListFoldersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFoldersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListFoldersCommandInput, + ListFoldersCommandOutput +>(QuickSightClient, ListFoldersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListGroupMembershipsPaginator.ts b/clients/client-quicksight/src/pagination/ListGroupMembershipsPaginator.ts index 1211bee252a8..bc2de7fdbabb 100644 --- a/clients/client-quicksight/src/pagination/ListGroupMembershipsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListGroupMembershipsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListGroupMembershipsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupMembershipsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroupMemberships( +export const paginateListGroupMemberships: ( config: QuickSightPaginationConfiguration, input: ListGroupMembershipsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupMembershipsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListGroupMembershipsCommandInput, + ListGroupMembershipsCommandOutput +>(QuickSightClient, ListGroupMembershipsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListGroupsPaginator.ts b/clients/client-quicksight/src/pagination/ListGroupsPaginator.ts index c23931907a66..d9052d1f780f 100644 --- a/clients/client-quicksight/src/pagination/ListGroupsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListGroupsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListGroupsCommand, ListGroupsCommandInput, ListGroupsCommandOutput } from "../commands/ListGroupsCommand"; import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroups( +export const paginateListGroups: ( config: QuickSightPaginationConfiguration, input: ListGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListGroupsCommandInput, + ListGroupsCommandOutput +>(QuickSightClient, ListGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListIAMPolicyAssignmentsForUserPaginator.ts b/clients/client-quicksight/src/pagination/ListIAMPolicyAssignmentsForUserPaginator.ts index 4ea4f1ebdcad..3d336dd587ba 100644 --- a/clients/client-quicksight/src/pagination/ListIAMPolicyAssignmentsForUserPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListIAMPolicyAssignmentsForUserPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListIAMPolicyAssignmentsForUserCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIAMPolicyAssignmentsForUserCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIAMPolicyAssignmentsForUser( +export const paginateListIAMPolicyAssignmentsForUser: ( config: QuickSightPaginationConfiguration, input: ListIAMPolicyAssignmentsForUserCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIAMPolicyAssignmentsForUserCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListIAMPolicyAssignmentsForUserCommandInput, + ListIAMPolicyAssignmentsForUserCommandOutput +>(QuickSightClient, ListIAMPolicyAssignmentsForUserCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListIAMPolicyAssignmentsPaginator.ts b/clients/client-quicksight/src/pagination/ListIAMPolicyAssignmentsPaginator.ts index fccf9557c5a2..c45e649bd439 100644 --- a/clients/client-quicksight/src/pagination/ListIAMPolicyAssignmentsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListIAMPolicyAssignmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListIAMPolicyAssignmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIAMPolicyAssignmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIAMPolicyAssignments( +export const paginateListIAMPolicyAssignments: ( config: QuickSightPaginationConfiguration, input: ListIAMPolicyAssignmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIAMPolicyAssignmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListIAMPolicyAssignmentsCommandInput, + ListIAMPolicyAssignmentsCommandOutput +>(QuickSightClient, ListIAMPolicyAssignmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListIngestionsPaginator.ts b/clients/client-quicksight/src/pagination/ListIngestionsPaginator.ts index cd1d302eace2..c7178b849eaa 100644 --- a/clients/client-quicksight/src/pagination/ListIngestionsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListIngestionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListIngestionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIngestionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIngestions( +export const paginateListIngestions: ( config: QuickSightPaginationConfiguration, input: ListIngestionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIngestionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListIngestionsCommandInput, + ListIngestionsCommandOutput +>(QuickSightClient, ListIngestionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListNamespacesPaginator.ts b/clients/client-quicksight/src/pagination/ListNamespacesPaginator.ts index 518a921dffba..64a2e8b6bde7 100644 --- a/clients/client-quicksight/src/pagination/ListNamespacesPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListNamespacesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListNamespacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNamespacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNamespaces( +export const paginateListNamespaces: ( config: QuickSightPaginationConfiguration, input: ListNamespacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNamespacesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListNamespacesCommandInput, + ListNamespacesCommandOutput +>(QuickSightClient, ListNamespacesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListRoleMembershipsPaginator.ts b/clients/client-quicksight/src/pagination/ListRoleMembershipsPaginator.ts index 5cf5f12ecf90..fcc880d86e6d 100644 --- a/clients/client-quicksight/src/pagination/ListRoleMembershipsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListRoleMembershipsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListRoleMembershipsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRoleMembershipsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRoleMemberships( +export const paginateListRoleMemberships: ( config: QuickSightPaginationConfiguration, input: ListRoleMembershipsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRoleMembershipsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListRoleMembershipsCommandInput, + ListRoleMembershipsCommandOutput +>(QuickSightClient, ListRoleMembershipsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListTemplateAliasesPaginator.ts b/clients/client-quicksight/src/pagination/ListTemplateAliasesPaginator.ts index 6746ec0b8f3a..f9617132f492 100644 --- a/clients/client-quicksight/src/pagination/ListTemplateAliasesPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListTemplateAliasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListTemplateAliasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTemplateAliasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTemplateAliases( +export const paginateListTemplateAliases: ( config: QuickSightPaginationConfiguration, input: ListTemplateAliasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTemplateAliasesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListTemplateAliasesCommandInput, + ListTemplateAliasesCommandOutput +>(QuickSightClient, ListTemplateAliasesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListTemplateVersionsPaginator.ts b/clients/client-quicksight/src/pagination/ListTemplateVersionsPaginator.ts index d9e3396cddfd..8811b65dfffb 100644 --- a/clients/client-quicksight/src/pagination/ListTemplateVersionsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListTemplateVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListTemplateVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTemplateVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTemplateVersions( +export const paginateListTemplateVersions: ( config: QuickSightPaginationConfiguration, input: ListTemplateVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTemplateVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListTemplateVersionsCommandInput, + ListTemplateVersionsCommandOutput +>(QuickSightClient, ListTemplateVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListTemplatesPaginator.ts b/clients/client-quicksight/src/pagination/ListTemplatesPaginator.ts index 3a042e44aa93..5693500715be 100644 --- a/clients/client-quicksight/src/pagination/ListTemplatesPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTemplates( +export const paginateListTemplates: ( config: QuickSightPaginationConfiguration, input: ListTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTemplatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListTemplatesCommandInput, + ListTemplatesCommandOutput +>(QuickSightClient, ListTemplatesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListThemeVersionsPaginator.ts b/clients/client-quicksight/src/pagination/ListThemeVersionsPaginator.ts index a0cdd727aa42..acf71d568d96 100644 --- a/clients/client-quicksight/src/pagination/ListThemeVersionsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListThemeVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListThemeVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThemeVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThemeVersions( +export const paginateListThemeVersions: ( config: QuickSightPaginationConfiguration, input: ListThemeVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThemeVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListThemeVersionsCommandInput, + ListThemeVersionsCommandOutput +>(QuickSightClient, ListThemeVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListThemesPaginator.ts b/clients/client-quicksight/src/pagination/ListThemesPaginator.ts index 7bd16e439d54..fc3daccda16c 100644 --- a/clients/client-quicksight/src/pagination/ListThemesPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListThemesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListThemesCommand, ListThemesCommandInput, ListThemesCommandOutput } from "../commands/ListThemesCommand"; import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListThemesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListThemesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListThemes( +export const paginateListThemes: ( config: QuickSightPaginationConfiguration, input: ListThemesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListThemesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListThemesCommandInput, + ListThemesCommandOutput +>(QuickSightClient, ListThemesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListTopicsPaginator.ts b/clients/client-quicksight/src/pagination/ListTopicsPaginator.ts index 5db9140d9156..a7ec00a857fb 100644 --- a/clients/client-quicksight/src/pagination/ListTopicsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListTopicsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTopicsCommand, ListTopicsCommandInput, ListTopicsCommandOutput } from "../commands/ListTopicsCommand"; import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListTopicsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTopicsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTopics( +export const paginateListTopics: ( config: QuickSightPaginationConfiguration, input: ListTopicsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTopicsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListTopicsCommandInput, + ListTopicsCommandOutput +>(QuickSightClient, ListTopicsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListUserGroupsPaginator.ts b/clients/client-quicksight/src/pagination/ListUserGroupsPaginator.ts index ed887e373084..180e81641596 100644 --- a/clients/client-quicksight/src/pagination/ListUserGroupsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListUserGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListUserGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUserGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUserGroups( +export const paginateListUserGroups: ( config: QuickSightPaginationConfiguration, input: ListUserGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUserGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListUserGroupsCommandInput, + ListUserGroupsCommandOutput +>(QuickSightClient, ListUserGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListUsersPaginator.ts b/clients/client-quicksight/src/pagination/ListUsersPaginator.ts index 677387cceeb2..52965fb55e32 100644 --- a/clients/client-quicksight/src/pagination/ListUsersPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListUsersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListUsersCommand, ListUsersCommandInput, ListUsersCommandOutput } from "../commands/ListUsersCommand"; import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUsers( +export const paginateListUsers: ( config: QuickSightPaginationConfiguration, input: ListUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUsersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListUsersCommandInput, + ListUsersCommandOutput +>(QuickSightClient, ListUsersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/ListVPCConnectionsPaginator.ts b/clients/client-quicksight/src/pagination/ListVPCConnectionsPaginator.ts index afda3d4d85d4..c527834c5060 100644 --- a/clients/client-quicksight/src/pagination/ListVPCConnectionsPaginator.ts +++ b/clients/client-quicksight/src/pagination/ListVPCConnectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: ListVPCConnectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVPCConnectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVPCConnections( +export const paginateListVPCConnections: ( config: QuickSightPaginationConfiguration, input: ListVPCConnectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVPCConnectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + ListVPCConnectionsCommandInput, + ListVPCConnectionsCommandOutput +>(QuickSightClient, ListVPCConnectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/SearchAnalysesPaginator.ts b/clients/client-quicksight/src/pagination/SearchAnalysesPaginator.ts index ef461616c115..f739a5e1178e 100644 --- a/clients/client-quicksight/src/pagination/SearchAnalysesPaginator.ts +++ b/clients/client-quicksight/src/pagination/SearchAnalysesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: SearchAnalysesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchAnalysesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchAnalyses( +export const paginateSearchAnalyses: ( config: QuickSightPaginationConfiguration, input: SearchAnalysesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchAnalysesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + SearchAnalysesCommandInput, + SearchAnalysesCommandOutput +>(QuickSightClient, SearchAnalysesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/SearchDashboardsPaginator.ts b/clients/client-quicksight/src/pagination/SearchDashboardsPaginator.ts index 15ce35271401..64b3dad59df0 100644 --- a/clients/client-quicksight/src/pagination/SearchDashboardsPaginator.ts +++ b/clients/client-quicksight/src/pagination/SearchDashboardsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: SearchDashboardsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchDashboardsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchDashboards( +export const paginateSearchDashboards: ( config: QuickSightPaginationConfiguration, input: SearchDashboardsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchDashboardsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + SearchDashboardsCommandInput, + SearchDashboardsCommandOutput +>(QuickSightClient, SearchDashboardsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/SearchDataSetsPaginator.ts b/clients/client-quicksight/src/pagination/SearchDataSetsPaginator.ts index 132a5e7589e9..0152232d91de 100644 --- a/clients/client-quicksight/src/pagination/SearchDataSetsPaginator.ts +++ b/clients/client-quicksight/src/pagination/SearchDataSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: SearchDataSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchDataSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchDataSets( +export const paginateSearchDataSets: ( config: QuickSightPaginationConfiguration, input: SearchDataSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchDataSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + SearchDataSetsCommandInput, + SearchDataSetsCommandOutput +>(QuickSightClient, SearchDataSetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/SearchDataSourcesPaginator.ts b/clients/client-quicksight/src/pagination/SearchDataSourcesPaginator.ts index 6165318b6726..a637b35083a6 100644 --- a/clients/client-quicksight/src/pagination/SearchDataSourcesPaginator.ts +++ b/clients/client-quicksight/src/pagination/SearchDataSourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: SearchDataSourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchDataSourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchDataSources( +export const paginateSearchDataSources: ( config: QuickSightPaginationConfiguration, input: SearchDataSourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchDataSourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + SearchDataSourcesCommandInput, + SearchDataSourcesCommandOutput +>(QuickSightClient, SearchDataSourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/SearchFoldersPaginator.ts b/clients/client-quicksight/src/pagination/SearchFoldersPaginator.ts index cbb11f556c1d..0207980d806a 100644 --- a/clients/client-quicksight/src/pagination/SearchFoldersPaginator.ts +++ b/clients/client-quicksight/src/pagination/SearchFoldersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: SearchFoldersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchFoldersCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchFolders( +export const paginateSearchFolders: ( config: QuickSightPaginationConfiguration, input: SearchFoldersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchFoldersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + SearchFoldersCommandInput, + SearchFoldersCommandOutput +>(QuickSightClient, SearchFoldersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-quicksight/src/pagination/SearchGroupsPaginator.ts b/clients/client-quicksight/src/pagination/SearchGroupsPaginator.ts index 971160506b87..01e65e714393 100644 --- a/clients/client-quicksight/src/pagination/SearchGroupsPaginator.ts +++ b/clients/client-quicksight/src/pagination/SearchGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { QuickSightClient } from "../QuickSightClient"; import { QuickSightPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: QuickSightClient, - input: SearchGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchGroups( +export const paginateSearchGroups: ( config: QuickSightPaginationConfiguration, input: SearchGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof QuickSightClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected QuickSight | QuickSightClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + QuickSightPaginationConfiguration, + SearchGroupsCommandInput, + SearchGroupsCommandOutput +>(QuickSightClient, SearchGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ram/src/pagination/GetResourcePoliciesPaginator.ts b/clients/client-ram/src/pagination/GetResourcePoliciesPaginator.ts index 2c595fd0fa52..74fe84360790 100644 --- a/clients/client-ram/src/pagination/GetResourcePoliciesPaginator.ts +++ b/clients/client-ram/src/pagination/GetResourcePoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RAMClient } from "../RAMClient"; import { RAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RAMClient, - input: GetResourcePoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetResourcePoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetResourcePolicies( +export const paginateGetResourcePolicies: ( config: RAMPaginationConfiguration, input: GetResourcePoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetResourcePoliciesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RAM | RAMClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RAMPaginationConfiguration, + GetResourcePoliciesCommandInput, + GetResourcePoliciesCommandOutput +>(RAMClient, GetResourcePoliciesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ram/src/pagination/GetResourceShareAssociationsPaginator.ts b/clients/client-ram/src/pagination/GetResourceShareAssociationsPaginator.ts index 7b91bfb89da0..97e3ccc1ca3f 100644 --- a/clients/client-ram/src/pagination/GetResourceShareAssociationsPaginator.ts +++ b/clients/client-ram/src/pagination/GetResourceShareAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RAMClient } from "../RAMClient"; import { RAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RAMClient, - input: GetResourceShareAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetResourceShareAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetResourceShareAssociations( +export const paginateGetResourceShareAssociations: ( config: RAMPaginationConfiguration, input: GetResourceShareAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetResourceShareAssociationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RAM | RAMClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RAMPaginationConfiguration, + GetResourceShareAssociationsCommandInput, + GetResourceShareAssociationsCommandOutput +>(RAMClient, GetResourceShareAssociationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ram/src/pagination/GetResourceShareInvitationsPaginator.ts b/clients/client-ram/src/pagination/GetResourceShareInvitationsPaginator.ts index e3c881136096..c3bc54cb3744 100644 --- a/clients/client-ram/src/pagination/GetResourceShareInvitationsPaginator.ts +++ b/clients/client-ram/src/pagination/GetResourceShareInvitationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RAMClient } from "../RAMClient"; import { RAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RAMClient, - input: GetResourceShareInvitationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetResourceShareInvitationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetResourceShareInvitations( +export const paginateGetResourceShareInvitations: ( config: RAMPaginationConfiguration, input: GetResourceShareInvitationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetResourceShareInvitationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RAM | RAMClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RAMPaginationConfiguration, + GetResourceShareInvitationsCommandInput, + GetResourceShareInvitationsCommandOutput +>(RAMClient, GetResourceShareInvitationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ram/src/pagination/GetResourceSharesPaginator.ts b/clients/client-ram/src/pagination/GetResourceSharesPaginator.ts index 9d7d1be89463..d4bcf5a95fc1 100644 --- a/clients/client-ram/src/pagination/GetResourceSharesPaginator.ts +++ b/clients/client-ram/src/pagination/GetResourceSharesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RAMClient } from "../RAMClient"; import { RAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RAMClient, - input: GetResourceSharesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetResourceSharesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetResourceShares( +export const paginateGetResourceShares: ( config: RAMPaginationConfiguration, input: GetResourceSharesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetResourceSharesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RAM | RAMClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RAMPaginationConfiguration, + GetResourceSharesCommandInput, + GetResourceSharesCommandOutput +>(RAMClient, GetResourceSharesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ram/src/pagination/ListPendingInvitationResourcesPaginator.ts b/clients/client-ram/src/pagination/ListPendingInvitationResourcesPaginator.ts index 4925a7487e7c..e89ba629679c 100644 --- a/clients/client-ram/src/pagination/ListPendingInvitationResourcesPaginator.ts +++ b/clients/client-ram/src/pagination/ListPendingInvitationResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RAMClient } from "../RAMClient"; import { RAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RAMClient, - input: ListPendingInvitationResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPendingInvitationResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPendingInvitationResources( +export const paginateListPendingInvitationResources: ( config: RAMPaginationConfiguration, input: ListPendingInvitationResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPendingInvitationResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RAM | RAMClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RAMPaginationConfiguration, + ListPendingInvitationResourcesCommandInput, + ListPendingInvitationResourcesCommandOutput +>(RAMClient, ListPendingInvitationResourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ram/src/pagination/ListPermissionAssociationsPaginator.ts b/clients/client-ram/src/pagination/ListPermissionAssociationsPaginator.ts index 4d051d0c3396..f64de0180e7c 100644 --- a/clients/client-ram/src/pagination/ListPermissionAssociationsPaginator.ts +++ b/clients/client-ram/src/pagination/ListPermissionAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RAMClient } from "../RAMClient"; import { RAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RAMClient, - input: ListPermissionAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPermissionAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPermissionAssociations( +export const paginateListPermissionAssociations: ( config: RAMPaginationConfiguration, input: ListPermissionAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPermissionAssociationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RAM | RAMClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RAMPaginationConfiguration, + ListPermissionAssociationsCommandInput, + ListPermissionAssociationsCommandOutput +>(RAMClient, ListPermissionAssociationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ram/src/pagination/ListPermissionVersionsPaginator.ts b/clients/client-ram/src/pagination/ListPermissionVersionsPaginator.ts index f8319de4262f..2568cb5edbf3 100644 --- a/clients/client-ram/src/pagination/ListPermissionVersionsPaginator.ts +++ b/clients/client-ram/src/pagination/ListPermissionVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RAMClient } from "../RAMClient"; import { RAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RAMClient, - input: ListPermissionVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPermissionVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPermissionVersions( +export const paginateListPermissionVersions: ( config: RAMPaginationConfiguration, input: ListPermissionVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPermissionVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RAM | RAMClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RAMPaginationConfiguration, + ListPermissionVersionsCommandInput, + ListPermissionVersionsCommandOutput +>(RAMClient, ListPermissionVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ram/src/pagination/ListPermissionsPaginator.ts b/clients/client-ram/src/pagination/ListPermissionsPaginator.ts index 4b21baa4d3a9..02fa1f628bf2 100644 --- a/clients/client-ram/src/pagination/ListPermissionsPaginator.ts +++ b/clients/client-ram/src/pagination/ListPermissionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RAMClient } from "../RAMClient"; import { RAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RAMClient, - input: ListPermissionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPermissionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPermissions( +export const paginateListPermissions: ( config: RAMPaginationConfiguration, input: ListPermissionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPermissionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RAM | RAMClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RAMPaginationConfiguration, + ListPermissionsCommandInput, + ListPermissionsCommandOutput +>(RAMClient, ListPermissionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ram/src/pagination/ListPrincipalsPaginator.ts b/clients/client-ram/src/pagination/ListPrincipalsPaginator.ts index 24e5acbb58f7..ef979c94a15c 100644 --- a/clients/client-ram/src/pagination/ListPrincipalsPaginator.ts +++ b/clients/client-ram/src/pagination/ListPrincipalsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RAMClient } from "../RAMClient"; import { RAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RAMClient, - input: ListPrincipalsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPrincipalsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPrincipals( +export const paginateListPrincipals: ( config: RAMPaginationConfiguration, input: ListPrincipalsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPrincipalsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RAM | RAMClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RAMPaginationConfiguration, + ListPrincipalsCommandInput, + ListPrincipalsCommandOutput +>(RAMClient, ListPrincipalsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ram/src/pagination/ListReplacePermissionAssociationsWorkPaginator.ts b/clients/client-ram/src/pagination/ListReplacePermissionAssociationsWorkPaginator.ts index cc8aa1d29eef..01e87aa8a977 100644 --- a/clients/client-ram/src/pagination/ListReplacePermissionAssociationsWorkPaginator.ts +++ b/clients/client-ram/src/pagination/ListReplacePermissionAssociationsWorkPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RAMClient } from "../RAMClient"; import { RAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RAMClient, - input: ListReplacePermissionAssociationsWorkCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReplacePermissionAssociationsWorkCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReplacePermissionAssociationsWork( +export const paginateListReplacePermissionAssociationsWork: ( config: RAMPaginationConfiguration, input: ListReplacePermissionAssociationsWorkCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReplacePermissionAssociationsWorkCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RAM | RAMClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RAMPaginationConfiguration, + ListReplacePermissionAssociationsWorkCommandInput, + ListReplacePermissionAssociationsWorkCommandOutput +>(RAMClient, ListReplacePermissionAssociationsWorkCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ram/src/pagination/ListResourceSharePermissionsPaginator.ts b/clients/client-ram/src/pagination/ListResourceSharePermissionsPaginator.ts index c028fffd75e3..ad52f70314a7 100644 --- a/clients/client-ram/src/pagination/ListResourceSharePermissionsPaginator.ts +++ b/clients/client-ram/src/pagination/ListResourceSharePermissionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RAMClient } from "../RAMClient"; import { RAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RAMClient, - input: ListResourceSharePermissionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourceSharePermissionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourceSharePermissions( +export const paginateListResourceSharePermissions: ( config: RAMPaginationConfiguration, input: ListResourceSharePermissionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourceSharePermissionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RAM | RAMClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RAMPaginationConfiguration, + ListResourceSharePermissionsCommandInput, + ListResourceSharePermissionsCommandOutput +>(RAMClient, ListResourceSharePermissionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ram/src/pagination/ListResourceTypesPaginator.ts b/clients/client-ram/src/pagination/ListResourceTypesPaginator.ts index 6253a53f6403..afcf0e654466 100644 --- a/clients/client-ram/src/pagination/ListResourceTypesPaginator.ts +++ b/clients/client-ram/src/pagination/ListResourceTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RAMClient } from "../RAMClient"; import { RAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RAMClient, - input: ListResourceTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourceTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourceTypes( +export const paginateListResourceTypes: ( config: RAMPaginationConfiguration, input: ListResourceTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourceTypesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RAM | RAMClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RAMPaginationConfiguration, + ListResourceTypesCommandInput, + ListResourceTypesCommandOutput +>(RAMClient, ListResourceTypesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ram/src/pagination/ListResourcesPaginator.ts b/clients/client-ram/src/pagination/ListResourcesPaginator.ts index 77c85ef3437c..b8e75a6260a8 100644 --- a/clients/client-ram/src/pagination/ListResourcesPaginator.ts +++ b/clients/client-ram/src/pagination/ListResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RAMClient } from "../RAMClient"; import { RAMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RAMClient, - input: ListResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResources( +export const paginateListResources: ( config: RAMPaginationConfiguration, input: ListResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RAMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RAM | RAMClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RAMPaginationConfiguration, + ListResourcesCommandInput, + ListResourcesCommandOutput +>(RAMClient, ListResourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-rbin/src/pagination/ListRulesPaginator.ts b/clients/client-rbin/src/pagination/ListRulesPaginator.ts index bedae2ac774e..f23460013567 100644 --- a/clients/client-rbin/src/pagination/ListRulesPaginator.ts +++ b/clients/client-rbin/src/pagination/ListRulesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListRulesCommand, ListRulesCommandInput, ListRulesCommandOutput } from "../commands/ListRulesCommand"; import { RbinClient } from "../RbinClient"; import { RbinPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RbinClient, - input: ListRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRules( +export const paginateListRules: ( config: RbinPaginationConfiguration, input: ListRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RbinClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rbin | RbinClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RbinPaginationConfiguration, + ListRulesCommandInput, + ListRulesCommandOutput +>(RbinClient, ListRulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rds/package.json b/clients/client-rds/package.json index 8d4a1b1e0986..b0f1e97a7957 100644 --- a/clients/client-rds/package.json +++ b/clients/client-rds/package.json @@ -35,6 +35,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-rds/src/pagination/DescribeBlueGreenDeploymentsPaginator.ts b/clients/client-rds/src/pagination/DescribeBlueGreenDeploymentsPaginator.ts index 2a75f9816aa7..d9c4795dc107 100644 --- a/clients/client-rds/src/pagination/DescribeBlueGreenDeploymentsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeBlueGreenDeploymentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeBlueGreenDeploymentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeBlueGreenDeploymentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeBlueGreenDeployments( +export const paginateDescribeBlueGreenDeployments: ( config: RDSPaginationConfiguration, input: DescribeBlueGreenDeploymentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeBlueGreenDeploymentsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeBlueGreenDeploymentsCommandInput, + DescribeBlueGreenDeploymentsCommandOutput +>(RDSClient, DescribeBlueGreenDeploymentsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeCertificatesPaginator.ts b/clients/client-rds/src/pagination/DescribeCertificatesPaginator.ts index 23c313fc108f..2d68a980e329 100644 --- a/clients/client-rds/src/pagination/DescribeCertificatesPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeCertificatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeCertificatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCertificatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCertificates( +export const paginateDescribeCertificates: ( config: RDSPaginationConfiguration, input: DescribeCertificatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCertificatesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeCertificatesCommandInput, + DescribeCertificatesCommandOutput +>(RDSClient, DescribeCertificatesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBClusterAutomatedBackupsPaginator.ts b/clients/client-rds/src/pagination/DescribeDBClusterAutomatedBackupsPaginator.ts index 78f67f25e141..e920465f8d82 100644 --- a/clients/client-rds/src/pagination/DescribeDBClusterAutomatedBackupsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBClusterAutomatedBackupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBClusterAutomatedBackupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClusterAutomatedBackupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusterAutomatedBackups( +export const paginateDescribeDBClusterAutomatedBackups: ( config: RDSPaginationConfiguration, input: DescribeDBClusterAutomatedBackupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClusterAutomatedBackupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBClusterAutomatedBackupsCommandInput, + DescribeDBClusterAutomatedBackupsCommandOutput +>(RDSClient, DescribeDBClusterAutomatedBackupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBClusterBacktracksPaginator.ts b/clients/client-rds/src/pagination/DescribeDBClusterBacktracksPaginator.ts index a82ec2fd15e0..420ce5865be2 100644 --- a/clients/client-rds/src/pagination/DescribeDBClusterBacktracksPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBClusterBacktracksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBClusterBacktracksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClusterBacktracksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusterBacktracks( +export const paginateDescribeDBClusterBacktracks: ( config: RDSPaginationConfiguration, input: DescribeDBClusterBacktracksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClusterBacktracksCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBClusterBacktracksCommandInput, + DescribeDBClusterBacktracksCommandOutput +>(RDSClient, DescribeDBClusterBacktracksCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBClusterEndpointsPaginator.ts b/clients/client-rds/src/pagination/DescribeDBClusterEndpointsPaginator.ts index 2f6d2309a0e0..59a67c92c917 100644 --- a/clients/client-rds/src/pagination/DescribeDBClusterEndpointsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBClusterEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBClusterEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClusterEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusterEndpoints( +export const paginateDescribeDBClusterEndpoints: ( config: RDSPaginationConfiguration, input: DescribeDBClusterEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClusterEndpointsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBClusterEndpointsCommandInput, + DescribeDBClusterEndpointsCommandOutput +>(RDSClient, DescribeDBClusterEndpointsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBClusterParameterGroupsPaginator.ts b/clients/client-rds/src/pagination/DescribeDBClusterParameterGroupsPaginator.ts index 7b5d03c45e2b..1ffcede90337 100644 --- a/clients/client-rds/src/pagination/DescribeDBClusterParameterGroupsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBClusterParameterGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBClusterParameterGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClusterParameterGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusterParameterGroups( +export const paginateDescribeDBClusterParameterGroups: ( config: RDSPaginationConfiguration, input: DescribeDBClusterParameterGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClusterParameterGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBClusterParameterGroupsCommandInput, + DescribeDBClusterParameterGroupsCommandOutput +>(RDSClient, DescribeDBClusterParameterGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBClusterParametersPaginator.ts b/clients/client-rds/src/pagination/DescribeDBClusterParametersPaginator.ts index 2b0f858b8105..033567d6311e 100644 --- a/clients/client-rds/src/pagination/DescribeDBClusterParametersPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBClusterParametersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBClusterParametersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClusterParametersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusterParameters( +export const paginateDescribeDBClusterParameters: ( config: RDSPaginationConfiguration, input: DescribeDBClusterParametersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClusterParametersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBClusterParametersCommandInput, + DescribeDBClusterParametersCommandOutput +>(RDSClient, DescribeDBClusterParametersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBClusterSnapshotsPaginator.ts b/clients/client-rds/src/pagination/DescribeDBClusterSnapshotsPaginator.ts index 2593114a16ba..d6547405cb9a 100644 --- a/clients/client-rds/src/pagination/DescribeDBClusterSnapshotsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBClusterSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBClusterSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClusterSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusterSnapshots( +export const paginateDescribeDBClusterSnapshots: ( config: RDSPaginationConfiguration, input: DescribeDBClusterSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClusterSnapshotsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBClusterSnapshotsCommandInput, + DescribeDBClusterSnapshotsCommandOutput +>(RDSClient, DescribeDBClusterSnapshotsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBClustersPaginator.ts b/clients/client-rds/src/pagination/DescribeDBClustersPaginator.ts index cde3957abfb5..317b1ccb39d7 100644 --- a/clients/client-rds/src/pagination/DescribeDBClustersPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBClusters( +export const paginateDescribeDBClusters: ( config: RDSPaginationConfiguration, input: DescribeDBClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBClustersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBClustersCommandInput, + DescribeDBClustersCommandOutput +>(RDSClient, DescribeDBClustersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBEngineVersionsPaginator.ts b/clients/client-rds/src/pagination/DescribeDBEngineVersionsPaginator.ts index 1b63597aa853..ff9e508f22fc 100644 --- a/clients/client-rds/src/pagination/DescribeDBEngineVersionsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBEngineVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBEngineVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBEngineVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBEngineVersions( +export const paginateDescribeDBEngineVersions: ( config: RDSPaginationConfiguration, input: DescribeDBEngineVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBEngineVersionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBEngineVersionsCommandInput, + DescribeDBEngineVersionsCommandOutput +>(RDSClient, DescribeDBEngineVersionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBInstanceAutomatedBackupsPaginator.ts b/clients/client-rds/src/pagination/DescribeDBInstanceAutomatedBackupsPaginator.ts index 0f0eb2197e32..9e393cc6ee4f 100644 --- a/clients/client-rds/src/pagination/DescribeDBInstanceAutomatedBackupsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBInstanceAutomatedBackupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBInstanceAutomatedBackupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBInstanceAutomatedBackupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBInstanceAutomatedBackups( +export const paginateDescribeDBInstanceAutomatedBackups: ( config: RDSPaginationConfiguration, input: DescribeDBInstanceAutomatedBackupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBInstanceAutomatedBackupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBInstanceAutomatedBackupsCommandInput, + DescribeDBInstanceAutomatedBackupsCommandOutput +>(RDSClient, DescribeDBInstanceAutomatedBackupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBInstancesPaginator.ts b/clients/client-rds/src/pagination/DescribeDBInstancesPaginator.ts index ea44c3e06dca..f5680133e0e2 100644 --- a/clients/client-rds/src/pagination/DescribeDBInstancesPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBInstances( +export const paginateDescribeDBInstances: ( config: RDSPaginationConfiguration, input: DescribeDBInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBInstancesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBInstancesCommandInput, + DescribeDBInstancesCommandOutput +>(RDSClient, DescribeDBInstancesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBLogFilesPaginator.ts b/clients/client-rds/src/pagination/DescribeDBLogFilesPaginator.ts index dfd00e8e510e..2d5f0be8187e 100644 --- a/clients/client-rds/src/pagination/DescribeDBLogFilesPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBLogFilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBLogFilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBLogFilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBLogFiles( +export const paginateDescribeDBLogFiles: ( config: RDSPaginationConfiguration, input: DescribeDBLogFilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBLogFilesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBLogFilesCommandInput, + DescribeDBLogFilesCommandOutput +>(RDSClient, DescribeDBLogFilesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBParameterGroupsPaginator.ts b/clients/client-rds/src/pagination/DescribeDBParameterGroupsPaginator.ts index d5bfe936232d..a20763cd09c5 100644 --- a/clients/client-rds/src/pagination/DescribeDBParameterGroupsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBParameterGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBParameterGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBParameterGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBParameterGroups( +export const paginateDescribeDBParameterGroups: ( config: RDSPaginationConfiguration, input: DescribeDBParameterGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBParameterGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBParameterGroupsCommandInput, + DescribeDBParameterGroupsCommandOutput +>(RDSClient, DescribeDBParameterGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBParametersPaginator.ts b/clients/client-rds/src/pagination/DescribeDBParametersPaginator.ts index 6918a19bc022..43062f826929 100644 --- a/clients/client-rds/src/pagination/DescribeDBParametersPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBParametersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBParametersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBParametersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBParameters( +export const paginateDescribeDBParameters: ( config: RDSPaginationConfiguration, input: DescribeDBParametersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBParametersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBParametersCommandInput, + DescribeDBParametersCommandOutput +>(RDSClient, DescribeDBParametersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBProxiesPaginator.ts b/clients/client-rds/src/pagination/DescribeDBProxiesPaginator.ts index dcdb4760aa31..41a809539aea 100644 --- a/clients/client-rds/src/pagination/DescribeDBProxiesPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBProxiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBProxiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBProxiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBProxies( +export const paginateDescribeDBProxies: ( config: RDSPaginationConfiguration, input: DescribeDBProxiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBProxiesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBProxiesCommandInput, + DescribeDBProxiesCommandOutput +>(RDSClient, DescribeDBProxiesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBProxyEndpointsPaginator.ts b/clients/client-rds/src/pagination/DescribeDBProxyEndpointsPaginator.ts index 8d61b7df9fdb..6716f9f12f42 100644 --- a/clients/client-rds/src/pagination/DescribeDBProxyEndpointsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBProxyEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBProxyEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBProxyEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBProxyEndpoints( +export const paginateDescribeDBProxyEndpoints: ( config: RDSPaginationConfiguration, input: DescribeDBProxyEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBProxyEndpointsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBProxyEndpointsCommandInput, + DescribeDBProxyEndpointsCommandOutput +>(RDSClient, DescribeDBProxyEndpointsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBProxyTargetGroupsPaginator.ts b/clients/client-rds/src/pagination/DescribeDBProxyTargetGroupsPaginator.ts index 2ed2b6b6e73f..be599eee859d 100644 --- a/clients/client-rds/src/pagination/DescribeDBProxyTargetGroupsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBProxyTargetGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBProxyTargetGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBProxyTargetGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBProxyTargetGroups( +export const paginateDescribeDBProxyTargetGroups: ( config: RDSPaginationConfiguration, input: DescribeDBProxyTargetGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBProxyTargetGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBProxyTargetGroupsCommandInput, + DescribeDBProxyTargetGroupsCommandOutput +>(RDSClient, DescribeDBProxyTargetGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBProxyTargetsPaginator.ts b/clients/client-rds/src/pagination/DescribeDBProxyTargetsPaginator.ts index 465a511231b3..5ddf79707543 100644 --- a/clients/client-rds/src/pagination/DescribeDBProxyTargetsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBProxyTargetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBProxyTargetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBProxyTargetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBProxyTargets( +export const paginateDescribeDBProxyTargets: ( config: RDSPaginationConfiguration, input: DescribeDBProxyTargetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBProxyTargetsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBProxyTargetsCommandInput, + DescribeDBProxyTargetsCommandOutput +>(RDSClient, DescribeDBProxyTargetsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBRecommendationsPaginator.ts b/clients/client-rds/src/pagination/DescribeDBRecommendationsPaginator.ts index a6fe9cf296bd..c6f48fe68546 100644 --- a/clients/client-rds/src/pagination/DescribeDBRecommendationsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBRecommendationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBRecommendationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBRecommendationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBRecommendations( +export const paginateDescribeDBRecommendations: ( config: RDSPaginationConfiguration, input: DescribeDBRecommendationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBRecommendationsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBRecommendationsCommandInput, + DescribeDBRecommendationsCommandOutput +>(RDSClient, DescribeDBRecommendationsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBSecurityGroupsPaginator.ts b/clients/client-rds/src/pagination/DescribeDBSecurityGroupsPaginator.ts index b4fa728ef7e8..4afe530947a5 100644 --- a/clients/client-rds/src/pagination/DescribeDBSecurityGroupsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBSecurityGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBSecurityGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBSecurityGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBSecurityGroups( +export const paginateDescribeDBSecurityGroups: ( config: RDSPaginationConfiguration, input: DescribeDBSecurityGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBSecurityGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBSecurityGroupsCommandInput, + DescribeDBSecurityGroupsCommandOutput +>(RDSClient, DescribeDBSecurityGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBSnapshotTenantDatabasesPaginator.ts b/clients/client-rds/src/pagination/DescribeDBSnapshotTenantDatabasesPaginator.ts index e1a96e6196d8..747c4fe9e3a3 100644 --- a/clients/client-rds/src/pagination/DescribeDBSnapshotTenantDatabasesPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBSnapshotTenantDatabasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBSnapshotTenantDatabasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBSnapshotTenantDatabasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBSnapshotTenantDatabases( +export const paginateDescribeDBSnapshotTenantDatabases: ( config: RDSPaginationConfiguration, input: DescribeDBSnapshotTenantDatabasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBSnapshotTenantDatabasesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBSnapshotTenantDatabasesCommandInput, + DescribeDBSnapshotTenantDatabasesCommandOutput +>(RDSClient, DescribeDBSnapshotTenantDatabasesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBSnapshotsPaginator.ts b/clients/client-rds/src/pagination/DescribeDBSnapshotsPaginator.ts index b459d8468b0d..3e8e9f9046a1 100644 --- a/clients/client-rds/src/pagination/DescribeDBSnapshotsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBSnapshots( +export const paginateDescribeDBSnapshots: ( config: RDSPaginationConfiguration, input: DescribeDBSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBSnapshotsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBSnapshotsCommandInput, + DescribeDBSnapshotsCommandOutput +>(RDSClient, DescribeDBSnapshotsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeDBSubnetGroupsPaginator.ts b/clients/client-rds/src/pagination/DescribeDBSubnetGroupsPaginator.ts index aef93d100f6b..0ff53a02e246 100644 --- a/clients/client-rds/src/pagination/DescribeDBSubnetGroupsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeDBSubnetGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeDBSubnetGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDBSubnetGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDBSubnetGroups( +export const paginateDescribeDBSubnetGroups: ( config: RDSPaginationConfiguration, input: DescribeDBSubnetGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDBSubnetGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeDBSubnetGroupsCommandInput, + DescribeDBSubnetGroupsCommandOutput +>(RDSClient, DescribeDBSubnetGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeEngineDefaultParametersPaginator.ts b/clients/client-rds/src/pagination/DescribeEngineDefaultParametersPaginator.ts index 6f295a1d8b7b..9d224bb87b00 100644 --- a/clients/client-rds/src/pagination/DescribeEngineDefaultParametersPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeEngineDefaultParametersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeEngineDefaultParametersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEngineDefaultParametersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEngineDefaultParameters( +export const paginateDescribeEngineDefaultParameters: ( config: RDSPaginationConfiguration, input: DescribeEngineDefaultParametersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEngineDefaultParametersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.EngineDefaults!.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeEngineDefaultParametersCommandInput, + DescribeEngineDefaultParametersCommandOutput +>(RDSClient, DescribeEngineDefaultParametersCommand, "Marker", "EngineDefaults.Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeEventSubscriptionsPaginator.ts b/clients/client-rds/src/pagination/DescribeEventSubscriptionsPaginator.ts index f779428fb5dd..59379e7cea1d 100644 --- a/clients/client-rds/src/pagination/DescribeEventSubscriptionsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeEventSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeEventSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEventSubscriptions( +export const paginateDescribeEventSubscriptions: ( config: RDSPaginationConfiguration, input: DescribeEventSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventSubscriptionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeEventSubscriptionsCommandInput, + DescribeEventSubscriptionsCommandOutput +>(RDSClient, DescribeEventSubscriptionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeEventsPaginator.ts b/clients/client-rds/src/pagination/DescribeEventsPaginator.ts index dc3fe5996a75..b84750c257d3 100644 --- a/clients/client-rds/src/pagination/DescribeEventsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEvents( +export const paginateDescribeEvents: ( config: RDSPaginationConfiguration, input: DescribeEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeEventsCommandInput, + DescribeEventsCommandOutput +>(RDSClient, DescribeEventsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeExportTasksPaginator.ts b/clients/client-rds/src/pagination/DescribeExportTasksPaginator.ts index 3c4f44185fae..4320fe39e3d6 100644 --- a/clients/client-rds/src/pagination/DescribeExportTasksPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeExportTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeExportTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeExportTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeExportTasks( +export const paginateDescribeExportTasks: ( config: RDSPaginationConfiguration, input: DescribeExportTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeExportTasksCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeExportTasksCommandInput, + DescribeExportTasksCommandOutput +>(RDSClient, DescribeExportTasksCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeGlobalClustersPaginator.ts b/clients/client-rds/src/pagination/DescribeGlobalClustersPaginator.ts index b3ef36b87dcc..ea46532282eb 100644 --- a/clients/client-rds/src/pagination/DescribeGlobalClustersPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeGlobalClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeGlobalClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeGlobalClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeGlobalClusters( +export const paginateDescribeGlobalClusters: ( config: RDSPaginationConfiguration, input: DescribeGlobalClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeGlobalClustersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeGlobalClustersCommandInput, + DescribeGlobalClustersCommandOutput +>(RDSClient, DescribeGlobalClustersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeIntegrationsPaginator.ts b/clients/client-rds/src/pagination/DescribeIntegrationsPaginator.ts index 1e98af6e6531..c5d1fa73d135 100644 --- a/clients/client-rds/src/pagination/DescribeIntegrationsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeIntegrationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeIntegrationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeIntegrationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeIntegrations( +export const paginateDescribeIntegrations: ( config: RDSPaginationConfiguration, input: DescribeIntegrationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeIntegrationsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeIntegrationsCommandInput, + DescribeIntegrationsCommandOutput +>(RDSClient, DescribeIntegrationsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeOptionGroupOptionsPaginator.ts b/clients/client-rds/src/pagination/DescribeOptionGroupOptionsPaginator.ts index 971adeda17ca..e978093d29e3 100644 --- a/clients/client-rds/src/pagination/DescribeOptionGroupOptionsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeOptionGroupOptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeOptionGroupOptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOptionGroupOptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOptionGroupOptions( +export const paginateDescribeOptionGroupOptions: ( config: RDSPaginationConfiguration, input: DescribeOptionGroupOptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOptionGroupOptionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeOptionGroupOptionsCommandInput, + DescribeOptionGroupOptionsCommandOutput +>(RDSClient, DescribeOptionGroupOptionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeOptionGroupsPaginator.ts b/clients/client-rds/src/pagination/DescribeOptionGroupsPaginator.ts index 0b60c50600fe..73c37636c802 100644 --- a/clients/client-rds/src/pagination/DescribeOptionGroupsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeOptionGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeOptionGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOptionGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOptionGroups( +export const paginateDescribeOptionGroups: ( config: RDSPaginationConfiguration, input: DescribeOptionGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOptionGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeOptionGroupsCommandInput, + DescribeOptionGroupsCommandOutput +>(RDSClient, DescribeOptionGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeOrderableDBInstanceOptionsPaginator.ts b/clients/client-rds/src/pagination/DescribeOrderableDBInstanceOptionsPaginator.ts index fb4339233644..b44839f09d76 100644 --- a/clients/client-rds/src/pagination/DescribeOrderableDBInstanceOptionsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeOrderableDBInstanceOptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeOrderableDBInstanceOptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOrderableDBInstanceOptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOrderableDBInstanceOptions( +export const paginateDescribeOrderableDBInstanceOptions: ( config: RDSPaginationConfiguration, input: DescribeOrderableDBInstanceOptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOrderableDBInstanceOptionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeOrderableDBInstanceOptionsCommandInput, + DescribeOrderableDBInstanceOptionsCommandOutput +>(RDSClient, DescribeOrderableDBInstanceOptionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribePendingMaintenanceActionsPaginator.ts b/clients/client-rds/src/pagination/DescribePendingMaintenanceActionsPaginator.ts index ecb2e04274de..0071c1302999 100644 --- a/clients/client-rds/src/pagination/DescribePendingMaintenanceActionsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribePendingMaintenanceActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribePendingMaintenanceActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePendingMaintenanceActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePendingMaintenanceActions( +export const paginateDescribePendingMaintenanceActions: ( config: RDSPaginationConfiguration, input: DescribePendingMaintenanceActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePendingMaintenanceActionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribePendingMaintenanceActionsCommandInput, + DescribePendingMaintenanceActionsCommandOutput +>(RDSClient, DescribePendingMaintenanceActionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeReservedDBInstancesOfferingsPaginator.ts b/clients/client-rds/src/pagination/DescribeReservedDBInstancesOfferingsPaginator.ts index de6adcb35b9f..003551804d6f 100644 --- a/clients/client-rds/src/pagination/DescribeReservedDBInstancesOfferingsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeReservedDBInstancesOfferingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeReservedDBInstancesOfferingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedDBInstancesOfferingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedDBInstancesOfferings( +export const paginateDescribeReservedDBInstancesOfferings: ( config: RDSPaginationConfiguration, input: DescribeReservedDBInstancesOfferingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedDBInstancesOfferingsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeReservedDBInstancesOfferingsCommandInput, + DescribeReservedDBInstancesOfferingsCommandOutput +>(RDSClient, DescribeReservedDBInstancesOfferingsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeReservedDBInstancesPaginator.ts b/clients/client-rds/src/pagination/DescribeReservedDBInstancesPaginator.ts index 387de8ff5768..ed85eaef1f6b 100644 --- a/clients/client-rds/src/pagination/DescribeReservedDBInstancesPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeReservedDBInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeReservedDBInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedDBInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedDBInstances( +export const paginateDescribeReservedDBInstances: ( config: RDSPaginationConfiguration, input: DescribeReservedDBInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedDBInstancesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeReservedDBInstancesCommandInput, + DescribeReservedDBInstancesCommandOutput +>(RDSClient, DescribeReservedDBInstancesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeSourceRegionsPaginator.ts b/clients/client-rds/src/pagination/DescribeSourceRegionsPaginator.ts index 61a8cad66293..c02a63db37fd 100644 --- a/clients/client-rds/src/pagination/DescribeSourceRegionsPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeSourceRegionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeSourceRegionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSourceRegionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSourceRegions( +export const paginateDescribeSourceRegions: ( config: RDSPaginationConfiguration, input: DescribeSourceRegionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSourceRegionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeSourceRegionsCommandInput, + DescribeSourceRegionsCommandOutput +>(RDSClient, DescribeSourceRegionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DescribeTenantDatabasesPaginator.ts b/clients/client-rds/src/pagination/DescribeTenantDatabasesPaginator.ts index 25ce136531b7..c4bcdeeb0373 100644 --- a/clients/client-rds/src/pagination/DescribeTenantDatabasesPaginator.ts +++ b/clients/client-rds/src/pagination/DescribeTenantDatabasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DescribeTenantDatabasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTenantDatabasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTenantDatabases( +export const paginateDescribeTenantDatabases: ( config: RDSPaginationConfiguration, input: DescribeTenantDatabasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTenantDatabasesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DescribeTenantDatabasesCommandInput, + DescribeTenantDatabasesCommandOutput +>(RDSClient, DescribeTenantDatabasesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rds/src/pagination/DownloadDBLogFilePortionPaginator.ts b/clients/client-rds/src/pagination/DownloadDBLogFilePortionPaginator.ts index 99b9ef5d10f3..d6ef9558a854 100644 --- a/clients/client-rds/src/pagination/DownloadDBLogFilePortionPaginator.ts +++ b/clients/client-rds/src/pagination/DownloadDBLogFilePortionPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RDSClient } from "../RDSClient"; import { RDSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RDSClient, - input: DownloadDBLogFilePortionCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DownloadDBLogFilePortionCommand(input), ...args); -}; /** * @public */ -export async function* paginateDownloadDBLogFilePortion( +export const paginateDownloadDBLogFilePortion: ( config: RDSPaginationConfiguration, input: DownloadDBLogFilePortionCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DownloadDBLogFilePortionCommandOutput; - while (hasNext) { - input.Marker = token; - input["NumberOfLines"] = config.pageSize; - if (config.client instanceof RDSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RDS | RDSClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RDSPaginationConfiguration, + DownloadDBLogFilePortionCommandInput, + DownloadDBLogFilePortionCommandOutput +>(RDSClient, DownloadDBLogFilePortionCommand, "Marker", "Marker", "NumberOfLines"); diff --git a/clients/client-redshift-data/package.json b/clients/client-redshift-data/package.json index c90f764b999b..95bda15b998a 100644 --- a/clients/client-redshift-data/package.json +++ b/clients/client-redshift-data/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-redshift-data/src/pagination/DescribeTablePaginator.ts b/clients/client-redshift-data/src/pagination/DescribeTablePaginator.ts index c38bd8cd848e..1348dddc0642 100644 --- a/clients/client-redshift-data/src/pagination/DescribeTablePaginator.ts +++ b/clients/client-redshift-data/src/pagination/DescribeTablePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftDataClient } from "../RedshiftDataClient"; import { RedshiftDataPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftDataClient, - input: DescribeTableCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTableCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTable( +export const paginateDescribeTable: ( config: RedshiftDataPaginationConfiguration, input: DescribeTableCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTableCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RedshiftDataClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftData | RedshiftDataClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftDataPaginationConfiguration, + DescribeTableCommandInput, + DescribeTableCommandOutput +>(RedshiftDataClient, DescribeTableCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-redshift-data/src/pagination/GetStatementResultPaginator.ts b/clients/client-redshift-data/src/pagination/GetStatementResultPaginator.ts index d1eae0af80c6..47d4cb7c830d 100644 --- a/clients/client-redshift-data/src/pagination/GetStatementResultPaginator.ts +++ b/clients/client-redshift-data/src/pagination/GetStatementResultPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { RedshiftDataClient } from "../RedshiftDataClient"; import { RedshiftDataPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftDataClient, - input: GetStatementResultCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetStatementResultCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetStatementResult( +export const paginateGetStatementResult: ( config: RedshiftDataPaginationConfiguration, input: GetStatementResultCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetStatementResultCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof RedshiftDataClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftData | RedshiftDataClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftDataPaginationConfiguration, + GetStatementResultCommandInput, + GetStatementResultCommandOutput +>(RedshiftDataClient, GetStatementResultCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-redshift-data/src/pagination/ListDatabasesPaginator.ts b/clients/client-redshift-data/src/pagination/ListDatabasesPaginator.ts index 2c861e2c7845..8d6cf051bc25 100644 --- a/clients/client-redshift-data/src/pagination/ListDatabasesPaginator.ts +++ b/clients/client-redshift-data/src/pagination/ListDatabasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftDataClient } from "../RedshiftDataClient"; import { RedshiftDataPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftDataClient, - input: ListDatabasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatabasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatabases( +export const paginateListDatabases: ( config: RedshiftDataPaginationConfiguration, input: ListDatabasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatabasesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RedshiftDataClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftData | RedshiftDataClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftDataPaginationConfiguration, + ListDatabasesCommandInput, + ListDatabasesCommandOutput +>(RedshiftDataClient, ListDatabasesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-redshift-data/src/pagination/ListSchemasPaginator.ts b/clients/client-redshift-data/src/pagination/ListSchemasPaginator.ts index d3479596ac5e..deb5d5c57679 100644 --- a/clients/client-redshift-data/src/pagination/ListSchemasPaginator.ts +++ b/clients/client-redshift-data/src/pagination/ListSchemasPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListSchemasCommand, ListSchemasCommandInput, ListSchemasCommandOutput } from "../commands/ListSchemasCommand"; import { RedshiftDataClient } from "../RedshiftDataClient"; import { RedshiftDataPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftDataClient, - input: ListSchemasCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSchemasCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSchemas( +export const paginateListSchemas: ( config: RedshiftDataPaginationConfiguration, input: ListSchemasCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSchemasCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RedshiftDataClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftData | RedshiftDataClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftDataPaginationConfiguration, + ListSchemasCommandInput, + ListSchemasCommandOutput +>(RedshiftDataClient, ListSchemasCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-redshift-data/src/pagination/ListStatementsPaginator.ts b/clients/client-redshift-data/src/pagination/ListStatementsPaginator.ts index d6b7be2c4310..0b91f97a5e1f 100644 --- a/clients/client-redshift-data/src/pagination/ListStatementsPaginator.ts +++ b/clients/client-redshift-data/src/pagination/ListStatementsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftDataClient } from "../RedshiftDataClient"; import { RedshiftDataPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftDataClient, - input: ListStatementsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStatementsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStatements( +export const paginateListStatements: ( config: RedshiftDataPaginationConfiguration, input: ListStatementsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStatementsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RedshiftDataClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftData | RedshiftDataClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftDataPaginationConfiguration, + ListStatementsCommandInput, + ListStatementsCommandOutput +>(RedshiftDataClient, ListStatementsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-redshift-data/src/pagination/ListTablesPaginator.ts b/clients/client-redshift-data/src/pagination/ListTablesPaginator.ts index b49453259550..fbcbf1d18d71 100644 --- a/clients/client-redshift-data/src/pagination/ListTablesPaginator.ts +++ b/clients/client-redshift-data/src/pagination/ListTablesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTablesCommand, ListTablesCommandInput, ListTablesCommandOutput } from "../commands/ListTablesCommand"; import { RedshiftDataClient } from "../RedshiftDataClient"; import { RedshiftDataPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftDataClient, - input: ListTablesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTablesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTables( +export const paginateListTables: ( config: RedshiftDataPaginationConfiguration, input: ListTablesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTablesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RedshiftDataClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftData | RedshiftDataClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftDataPaginationConfiguration, + ListTablesCommandInput, + ListTablesCommandOutput +>(RedshiftDataClient, ListTablesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-redshift-serverless/package.json b/clients/client-redshift-serverless/package.json index edbcd33954be..093a493f474a 100644 --- a/clients/client-redshift-serverless/package.json +++ b/clients/client-redshift-serverless/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-redshift-serverless/src/pagination/ListCustomDomainAssociationsPaginator.ts b/clients/client-redshift-serverless/src/pagination/ListCustomDomainAssociationsPaginator.ts index 5d3b241944c5..890db15004a3 100644 --- a/clients/client-redshift-serverless/src/pagination/ListCustomDomainAssociationsPaginator.ts +++ b/clients/client-redshift-serverless/src/pagination/ListCustomDomainAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftServerlessClient } from "../RedshiftServerlessClient"; import { RedshiftServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftServerlessClient, - input: ListCustomDomainAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomDomainAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomDomainAssociations( +export const paginateListCustomDomainAssociations: ( config: RedshiftServerlessPaginationConfiguration, input: ListCustomDomainAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomDomainAssociationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RedshiftServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftServerless | RedshiftServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftServerlessPaginationConfiguration, + ListCustomDomainAssociationsCommandInput, + ListCustomDomainAssociationsCommandOutput +>(RedshiftServerlessClient, ListCustomDomainAssociationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-redshift-serverless/src/pagination/ListEndpointAccessPaginator.ts b/clients/client-redshift-serverless/src/pagination/ListEndpointAccessPaginator.ts index ef4ef4501695..c5b3e18f0909 100644 --- a/clients/client-redshift-serverless/src/pagination/ListEndpointAccessPaginator.ts +++ b/clients/client-redshift-serverless/src/pagination/ListEndpointAccessPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftServerlessClient } from "../RedshiftServerlessClient"; import { RedshiftServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftServerlessClient, - input: ListEndpointAccessCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEndpointAccessCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEndpointAccess( +export const paginateListEndpointAccess: ( config: RedshiftServerlessPaginationConfiguration, input: ListEndpointAccessCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEndpointAccessCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RedshiftServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftServerless | RedshiftServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftServerlessPaginationConfiguration, + ListEndpointAccessCommandInput, + ListEndpointAccessCommandOutput +>(RedshiftServerlessClient, ListEndpointAccessCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-redshift-serverless/src/pagination/ListNamespacesPaginator.ts b/clients/client-redshift-serverless/src/pagination/ListNamespacesPaginator.ts index e371b375ada9..7bf42ec9f366 100644 --- a/clients/client-redshift-serverless/src/pagination/ListNamespacesPaginator.ts +++ b/clients/client-redshift-serverless/src/pagination/ListNamespacesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftServerlessClient } from "../RedshiftServerlessClient"; import { RedshiftServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftServerlessClient, - input: ListNamespacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNamespacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNamespaces( +export const paginateListNamespaces: ( config: RedshiftServerlessPaginationConfiguration, input: ListNamespacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNamespacesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RedshiftServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftServerless | RedshiftServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftServerlessPaginationConfiguration, + ListNamespacesCommandInput, + ListNamespacesCommandOutput +>(RedshiftServerlessClient, ListNamespacesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-redshift-serverless/src/pagination/ListRecoveryPointsPaginator.ts b/clients/client-redshift-serverless/src/pagination/ListRecoveryPointsPaginator.ts index 6b8965176f7d..5e3ddd7ece99 100644 --- a/clients/client-redshift-serverless/src/pagination/ListRecoveryPointsPaginator.ts +++ b/clients/client-redshift-serverless/src/pagination/ListRecoveryPointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftServerlessClient } from "../RedshiftServerlessClient"; import { RedshiftServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftServerlessClient, - input: ListRecoveryPointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecoveryPointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecoveryPoints( +export const paginateListRecoveryPoints: ( config: RedshiftServerlessPaginationConfiguration, input: ListRecoveryPointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecoveryPointsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RedshiftServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftServerless | RedshiftServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftServerlessPaginationConfiguration, + ListRecoveryPointsCommandInput, + ListRecoveryPointsCommandOutput +>(RedshiftServerlessClient, ListRecoveryPointsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-redshift-serverless/src/pagination/ListScheduledActionsPaginator.ts b/clients/client-redshift-serverless/src/pagination/ListScheduledActionsPaginator.ts index bf857e49ed27..ee454f849478 100644 --- a/clients/client-redshift-serverless/src/pagination/ListScheduledActionsPaginator.ts +++ b/clients/client-redshift-serverless/src/pagination/ListScheduledActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftServerlessClient } from "../RedshiftServerlessClient"; import { RedshiftServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftServerlessClient, - input: ListScheduledActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListScheduledActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListScheduledActions( +export const paginateListScheduledActions: ( config: RedshiftServerlessPaginationConfiguration, input: ListScheduledActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListScheduledActionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RedshiftServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftServerless | RedshiftServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftServerlessPaginationConfiguration, + ListScheduledActionsCommandInput, + ListScheduledActionsCommandOutput +>(RedshiftServerlessClient, ListScheduledActionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-redshift-serverless/src/pagination/ListSnapshotCopyConfigurationsPaginator.ts b/clients/client-redshift-serverless/src/pagination/ListSnapshotCopyConfigurationsPaginator.ts index 41c981b66775..cb40f716f0b0 100644 --- a/clients/client-redshift-serverless/src/pagination/ListSnapshotCopyConfigurationsPaginator.ts +++ b/clients/client-redshift-serverless/src/pagination/ListSnapshotCopyConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftServerlessClient } from "../RedshiftServerlessClient"; import { RedshiftServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftServerlessClient, - input: ListSnapshotCopyConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSnapshotCopyConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSnapshotCopyConfigurations( +export const paginateListSnapshotCopyConfigurations: ( config: RedshiftServerlessPaginationConfiguration, input: ListSnapshotCopyConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSnapshotCopyConfigurationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RedshiftServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftServerless | RedshiftServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftServerlessPaginationConfiguration, + ListSnapshotCopyConfigurationsCommandInput, + ListSnapshotCopyConfigurationsCommandOutput +>(RedshiftServerlessClient, ListSnapshotCopyConfigurationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-redshift-serverless/src/pagination/ListSnapshotsPaginator.ts b/clients/client-redshift-serverless/src/pagination/ListSnapshotsPaginator.ts index 7fcebab7dabf..875dfa827495 100644 --- a/clients/client-redshift-serverless/src/pagination/ListSnapshotsPaginator.ts +++ b/clients/client-redshift-serverless/src/pagination/ListSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftServerlessClient } from "../RedshiftServerlessClient"; import { RedshiftServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftServerlessClient, - input: ListSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSnapshots( +export const paginateListSnapshots: ( config: RedshiftServerlessPaginationConfiguration, input: ListSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSnapshotsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RedshiftServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftServerless | RedshiftServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftServerlessPaginationConfiguration, + ListSnapshotsCommandInput, + ListSnapshotsCommandOutput +>(RedshiftServerlessClient, ListSnapshotsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-redshift-serverless/src/pagination/ListTableRestoreStatusPaginator.ts b/clients/client-redshift-serverless/src/pagination/ListTableRestoreStatusPaginator.ts index c7a8ca0453fd..b91bfe7e14ef 100644 --- a/clients/client-redshift-serverless/src/pagination/ListTableRestoreStatusPaginator.ts +++ b/clients/client-redshift-serverless/src/pagination/ListTableRestoreStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftServerlessClient } from "../RedshiftServerlessClient"; import { RedshiftServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftServerlessClient, - input: ListTableRestoreStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTableRestoreStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTableRestoreStatus( +export const paginateListTableRestoreStatus: ( config: RedshiftServerlessPaginationConfiguration, input: ListTableRestoreStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTableRestoreStatusCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RedshiftServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftServerless | RedshiftServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftServerlessPaginationConfiguration, + ListTableRestoreStatusCommandInput, + ListTableRestoreStatusCommandOutput +>(RedshiftServerlessClient, ListTableRestoreStatusCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-redshift-serverless/src/pagination/ListUsageLimitsPaginator.ts b/clients/client-redshift-serverless/src/pagination/ListUsageLimitsPaginator.ts index 49a221e8a1e2..159c51538a29 100644 --- a/clients/client-redshift-serverless/src/pagination/ListUsageLimitsPaginator.ts +++ b/clients/client-redshift-serverless/src/pagination/ListUsageLimitsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftServerlessClient } from "../RedshiftServerlessClient"; import { RedshiftServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftServerlessClient, - input: ListUsageLimitsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUsageLimitsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUsageLimits( +export const paginateListUsageLimits: ( config: RedshiftServerlessPaginationConfiguration, input: ListUsageLimitsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUsageLimitsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RedshiftServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftServerless | RedshiftServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftServerlessPaginationConfiguration, + ListUsageLimitsCommandInput, + ListUsageLimitsCommandOutput +>(RedshiftServerlessClient, ListUsageLimitsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-redshift-serverless/src/pagination/ListWorkgroupsPaginator.ts b/clients/client-redshift-serverless/src/pagination/ListWorkgroupsPaginator.ts index a268d7b6bdd1..7d23858c81d4 100644 --- a/clients/client-redshift-serverless/src/pagination/ListWorkgroupsPaginator.ts +++ b/clients/client-redshift-serverless/src/pagination/ListWorkgroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftServerlessClient } from "../RedshiftServerlessClient"; import { RedshiftServerlessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftServerlessClient, - input: ListWorkgroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkgroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkgroups( +export const paginateListWorkgroups: ( config: RedshiftServerlessPaginationConfiguration, input: ListWorkgroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkgroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RedshiftServerlessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RedshiftServerless | RedshiftServerlessClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftServerlessPaginationConfiguration, + ListWorkgroupsCommandInput, + ListWorkgroupsCommandOutput +>(RedshiftServerlessClient, ListWorkgroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-redshift/package.json b/clients/client-redshift/package.json index 629917b9e3bf..686c828513c9 100644 --- a/clients/client-redshift/package.json +++ b/clients/client-redshift/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-redshift/src/pagination/DescribeClusterDbRevisionsPaginator.ts b/clients/client-redshift/src/pagination/DescribeClusterDbRevisionsPaginator.ts index 0e9b9c92950c..b23165399633 100644 --- a/clients/client-redshift/src/pagination/DescribeClusterDbRevisionsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeClusterDbRevisionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeClusterDbRevisionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClusterDbRevisionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClusterDbRevisions( +export const paginateDescribeClusterDbRevisions: ( config: RedshiftPaginationConfiguration, input: DescribeClusterDbRevisionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClusterDbRevisionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeClusterDbRevisionsCommandInput, + DescribeClusterDbRevisionsCommandOutput +>(RedshiftClient, DescribeClusterDbRevisionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeClusterParameterGroupsPaginator.ts b/clients/client-redshift/src/pagination/DescribeClusterParameterGroupsPaginator.ts index bcf03121cb10..3cb41314f5c7 100644 --- a/clients/client-redshift/src/pagination/DescribeClusterParameterGroupsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeClusterParameterGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeClusterParameterGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClusterParameterGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClusterParameterGroups( +export const paginateDescribeClusterParameterGroups: ( config: RedshiftPaginationConfiguration, input: DescribeClusterParameterGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClusterParameterGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeClusterParameterGroupsCommandInput, + DescribeClusterParameterGroupsCommandOutput +>(RedshiftClient, DescribeClusterParameterGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeClusterParametersPaginator.ts b/clients/client-redshift/src/pagination/DescribeClusterParametersPaginator.ts index 8be6db33baf7..b194730fa60f 100644 --- a/clients/client-redshift/src/pagination/DescribeClusterParametersPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeClusterParametersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeClusterParametersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClusterParametersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClusterParameters( +export const paginateDescribeClusterParameters: ( config: RedshiftPaginationConfiguration, input: DescribeClusterParametersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClusterParametersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeClusterParametersCommandInput, + DescribeClusterParametersCommandOutput +>(RedshiftClient, DescribeClusterParametersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeClusterSecurityGroupsPaginator.ts b/clients/client-redshift/src/pagination/DescribeClusterSecurityGroupsPaginator.ts index 43bd00c55d57..270773fce634 100644 --- a/clients/client-redshift/src/pagination/DescribeClusterSecurityGroupsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeClusterSecurityGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeClusterSecurityGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClusterSecurityGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClusterSecurityGroups( +export const paginateDescribeClusterSecurityGroups: ( config: RedshiftPaginationConfiguration, input: DescribeClusterSecurityGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClusterSecurityGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeClusterSecurityGroupsCommandInput, + DescribeClusterSecurityGroupsCommandOutput +>(RedshiftClient, DescribeClusterSecurityGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeClusterSnapshotsPaginator.ts b/clients/client-redshift/src/pagination/DescribeClusterSnapshotsPaginator.ts index 6cf901ec63f2..ae03c59070c1 100644 --- a/clients/client-redshift/src/pagination/DescribeClusterSnapshotsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeClusterSnapshotsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeClusterSnapshotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClusterSnapshotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClusterSnapshots( +export const paginateDescribeClusterSnapshots: ( config: RedshiftPaginationConfiguration, input: DescribeClusterSnapshotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClusterSnapshotsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeClusterSnapshotsCommandInput, + DescribeClusterSnapshotsCommandOutput +>(RedshiftClient, DescribeClusterSnapshotsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeClusterSubnetGroupsPaginator.ts b/clients/client-redshift/src/pagination/DescribeClusterSubnetGroupsPaginator.ts index b8c699eeab3e..301d3b4fa1e6 100644 --- a/clients/client-redshift/src/pagination/DescribeClusterSubnetGroupsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeClusterSubnetGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeClusterSubnetGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClusterSubnetGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClusterSubnetGroups( +export const paginateDescribeClusterSubnetGroups: ( config: RedshiftPaginationConfiguration, input: DescribeClusterSubnetGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClusterSubnetGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeClusterSubnetGroupsCommandInput, + DescribeClusterSubnetGroupsCommandOutput +>(RedshiftClient, DescribeClusterSubnetGroupsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeClusterTracksPaginator.ts b/clients/client-redshift/src/pagination/DescribeClusterTracksPaginator.ts index 9c6ed1d97a05..05a7aadf45b0 100644 --- a/clients/client-redshift/src/pagination/DescribeClusterTracksPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeClusterTracksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeClusterTracksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClusterTracksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClusterTracks( +export const paginateDescribeClusterTracks: ( config: RedshiftPaginationConfiguration, input: DescribeClusterTracksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClusterTracksCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeClusterTracksCommandInput, + DescribeClusterTracksCommandOutput +>(RedshiftClient, DescribeClusterTracksCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeClusterVersionsPaginator.ts b/clients/client-redshift/src/pagination/DescribeClusterVersionsPaginator.ts index d0584c7dd8e1..6a94bb7b5733 100644 --- a/clients/client-redshift/src/pagination/DescribeClusterVersionsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeClusterVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeClusterVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClusterVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClusterVersions( +export const paginateDescribeClusterVersions: ( config: RedshiftPaginationConfiguration, input: DescribeClusterVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClusterVersionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeClusterVersionsCommandInput, + DescribeClusterVersionsCommandOutput +>(RedshiftClient, DescribeClusterVersionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeClustersPaginator.ts b/clients/client-redshift/src/pagination/DescribeClustersPaginator.ts index 3074bd10c339..798cea8821fb 100644 --- a/clients/client-redshift/src/pagination/DescribeClustersPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeClusters( +export const paginateDescribeClusters: ( config: RedshiftPaginationConfiguration, input: DescribeClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeClustersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeClustersCommandInput, + DescribeClustersCommandOutput +>(RedshiftClient, DescribeClustersCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeCustomDomainAssociationsPaginator.ts b/clients/client-redshift/src/pagination/DescribeCustomDomainAssociationsPaginator.ts index 0c0091755999..6b349f0b0755 100644 --- a/clients/client-redshift/src/pagination/DescribeCustomDomainAssociationsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeCustomDomainAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeCustomDomainAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCustomDomainAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCustomDomainAssociations( +export const paginateDescribeCustomDomainAssociations: ( config: RedshiftPaginationConfiguration, input: DescribeCustomDomainAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCustomDomainAssociationsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeCustomDomainAssociationsCommandInput, + DescribeCustomDomainAssociationsCommandOutput +>(RedshiftClient, DescribeCustomDomainAssociationsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeDataSharesForConsumerPaginator.ts b/clients/client-redshift/src/pagination/DescribeDataSharesForConsumerPaginator.ts index dbab829cc0ca..0d3462509cf6 100644 --- a/clients/client-redshift/src/pagination/DescribeDataSharesForConsumerPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeDataSharesForConsumerPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeDataSharesForConsumerCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDataSharesForConsumerCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDataSharesForConsumer( +export const paginateDescribeDataSharesForConsumer: ( config: RedshiftPaginationConfiguration, input: DescribeDataSharesForConsumerCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDataSharesForConsumerCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeDataSharesForConsumerCommandInput, + DescribeDataSharesForConsumerCommandOutput +>(RedshiftClient, DescribeDataSharesForConsumerCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeDataSharesForProducerPaginator.ts b/clients/client-redshift/src/pagination/DescribeDataSharesForProducerPaginator.ts index 34f94e23bcfa..ef1c0d39e8ba 100644 --- a/clients/client-redshift/src/pagination/DescribeDataSharesForProducerPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeDataSharesForProducerPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeDataSharesForProducerCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDataSharesForProducerCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDataSharesForProducer( +export const paginateDescribeDataSharesForProducer: ( config: RedshiftPaginationConfiguration, input: DescribeDataSharesForProducerCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDataSharesForProducerCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeDataSharesForProducerCommandInput, + DescribeDataSharesForProducerCommandOutput +>(RedshiftClient, DescribeDataSharesForProducerCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeDataSharesPaginator.ts b/clients/client-redshift/src/pagination/DescribeDataSharesPaginator.ts index c9a47561eef9..3a2597692fab 100644 --- a/clients/client-redshift/src/pagination/DescribeDataSharesPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeDataSharesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeDataSharesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDataSharesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDataShares( +export const paginateDescribeDataShares: ( config: RedshiftPaginationConfiguration, input: DescribeDataSharesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDataSharesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeDataSharesCommandInput, + DescribeDataSharesCommandOutput +>(RedshiftClient, DescribeDataSharesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeDefaultClusterParametersPaginator.ts b/clients/client-redshift/src/pagination/DescribeDefaultClusterParametersPaginator.ts index 65ba24fad4ad..4f52459a0438 100644 --- a/clients/client-redshift/src/pagination/DescribeDefaultClusterParametersPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeDefaultClusterParametersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeDefaultClusterParametersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDefaultClusterParametersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDefaultClusterParameters( +export const paginateDescribeDefaultClusterParameters: ( config: RedshiftPaginationConfiguration, input: DescribeDefaultClusterParametersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDefaultClusterParametersCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.DefaultClusterParameters!.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeDefaultClusterParametersCommandInput, + DescribeDefaultClusterParametersCommandOutput +>(RedshiftClient, DescribeDefaultClusterParametersCommand, "Marker", "DefaultClusterParameters.Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeEndpointAccessPaginator.ts b/clients/client-redshift/src/pagination/DescribeEndpointAccessPaginator.ts index be660b54c6d7..639d8b78ed0a 100644 --- a/clients/client-redshift/src/pagination/DescribeEndpointAccessPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeEndpointAccessPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeEndpointAccessCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEndpointAccessCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEndpointAccess( +export const paginateDescribeEndpointAccess: ( config: RedshiftPaginationConfiguration, input: DescribeEndpointAccessCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEndpointAccessCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeEndpointAccessCommandInput, + DescribeEndpointAccessCommandOutput +>(RedshiftClient, DescribeEndpointAccessCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeEndpointAuthorizationPaginator.ts b/clients/client-redshift/src/pagination/DescribeEndpointAuthorizationPaginator.ts index 4d52eb95fb88..99b404b4a21b 100644 --- a/clients/client-redshift/src/pagination/DescribeEndpointAuthorizationPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeEndpointAuthorizationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeEndpointAuthorizationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEndpointAuthorizationCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEndpointAuthorization( +export const paginateDescribeEndpointAuthorization: ( config: RedshiftPaginationConfiguration, input: DescribeEndpointAuthorizationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEndpointAuthorizationCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeEndpointAuthorizationCommandInput, + DescribeEndpointAuthorizationCommandOutput +>(RedshiftClient, DescribeEndpointAuthorizationCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeEventSubscriptionsPaginator.ts b/clients/client-redshift/src/pagination/DescribeEventSubscriptionsPaginator.ts index ccb243e4dabb..038d986da913 100644 --- a/clients/client-redshift/src/pagination/DescribeEventSubscriptionsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeEventSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeEventSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEventSubscriptions( +export const paginateDescribeEventSubscriptions: ( config: RedshiftPaginationConfiguration, input: DescribeEventSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventSubscriptionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeEventSubscriptionsCommandInput, + DescribeEventSubscriptionsCommandOutput +>(RedshiftClient, DescribeEventSubscriptionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeEventsPaginator.ts b/clients/client-redshift/src/pagination/DescribeEventsPaginator.ts index db13257dea47..6a4e8744587d 100644 --- a/clients/client-redshift/src/pagination/DescribeEventsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEvents( +export const paginateDescribeEvents: ( config: RedshiftPaginationConfiguration, input: DescribeEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEventsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeEventsCommandInput, + DescribeEventsCommandOutput +>(RedshiftClient, DescribeEventsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeHsmClientCertificatesPaginator.ts b/clients/client-redshift/src/pagination/DescribeHsmClientCertificatesPaginator.ts index 0ba69e710135..a1daff6571b2 100644 --- a/clients/client-redshift/src/pagination/DescribeHsmClientCertificatesPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeHsmClientCertificatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeHsmClientCertificatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeHsmClientCertificatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeHsmClientCertificates( +export const paginateDescribeHsmClientCertificates: ( config: RedshiftPaginationConfiguration, input: DescribeHsmClientCertificatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeHsmClientCertificatesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeHsmClientCertificatesCommandInput, + DescribeHsmClientCertificatesCommandOutput +>(RedshiftClient, DescribeHsmClientCertificatesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeHsmConfigurationsPaginator.ts b/clients/client-redshift/src/pagination/DescribeHsmConfigurationsPaginator.ts index 9562be491349..bb6f60c93340 100644 --- a/clients/client-redshift/src/pagination/DescribeHsmConfigurationsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeHsmConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeHsmConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeHsmConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeHsmConfigurations( +export const paginateDescribeHsmConfigurations: ( config: RedshiftPaginationConfiguration, input: DescribeHsmConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeHsmConfigurationsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeHsmConfigurationsCommandInput, + DescribeHsmConfigurationsCommandOutput +>(RedshiftClient, DescribeHsmConfigurationsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeInboundIntegrationsPaginator.ts b/clients/client-redshift/src/pagination/DescribeInboundIntegrationsPaginator.ts index 349830148778..635e91a30f8a 100644 --- a/clients/client-redshift/src/pagination/DescribeInboundIntegrationsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeInboundIntegrationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeInboundIntegrationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInboundIntegrationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInboundIntegrations( +export const paginateDescribeInboundIntegrations: ( config: RedshiftPaginationConfiguration, input: DescribeInboundIntegrationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInboundIntegrationsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeInboundIntegrationsCommandInput, + DescribeInboundIntegrationsCommandOutput +>(RedshiftClient, DescribeInboundIntegrationsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeNodeConfigurationOptionsPaginator.ts b/clients/client-redshift/src/pagination/DescribeNodeConfigurationOptionsPaginator.ts index 43ab91a022f3..412950f04519 100644 --- a/clients/client-redshift/src/pagination/DescribeNodeConfigurationOptionsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeNodeConfigurationOptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeNodeConfigurationOptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeNodeConfigurationOptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeNodeConfigurationOptions( +export const paginateDescribeNodeConfigurationOptions: ( config: RedshiftPaginationConfiguration, input: DescribeNodeConfigurationOptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeNodeConfigurationOptionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeNodeConfigurationOptionsCommandInput, + DescribeNodeConfigurationOptionsCommandOutput +>(RedshiftClient, DescribeNodeConfigurationOptionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeOrderableClusterOptionsPaginator.ts b/clients/client-redshift/src/pagination/DescribeOrderableClusterOptionsPaginator.ts index da0829604980..1c00c6522a48 100644 --- a/clients/client-redshift/src/pagination/DescribeOrderableClusterOptionsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeOrderableClusterOptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeOrderableClusterOptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOrderableClusterOptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOrderableClusterOptions( +export const paginateDescribeOrderableClusterOptions: ( config: RedshiftPaginationConfiguration, input: DescribeOrderableClusterOptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOrderableClusterOptionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeOrderableClusterOptionsCommandInput, + DescribeOrderableClusterOptionsCommandOutput +>(RedshiftClient, DescribeOrderableClusterOptionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeRedshiftIdcApplicationsPaginator.ts b/clients/client-redshift/src/pagination/DescribeRedshiftIdcApplicationsPaginator.ts index e45b31a6e914..658dbf42059a 100644 --- a/clients/client-redshift/src/pagination/DescribeRedshiftIdcApplicationsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeRedshiftIdcApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeRedshiftIdcApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRedshiftIdcApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRedshiftIdcApplications( +export const paginateDescribeRedshiftIdcApplications: ( config: RedshiftPaginationConfiguration, input: DescribeRedshiftIdcApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRedshiftIdcApplicationsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeRedshiftIdcApplicationsCommandInput, + DescribeRedshiftIdcApplicationsCommandOutput +>(RedshiftClient, DescribeRedshiftIdcApplicationsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeReservedNodeExchangeStatusPaginator.ts b/clients/client-redshift/src/pagination/DescribeReservedNodeExchangeStatusPaginator.ts index d1a7ffa4a037..48b4df08902f 100644 --- a/clients/client-redshift/src/pagination/DescribeReservedNodeExchangeStatusPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeReservedNodeExchangeStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeReservedNodeExchangeStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedNodeExchangeStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedNodeExchangeStatus( +export const paginateDescribeReservedNodeExchangeStatus: ( config: RedshiftPaginationConfiguration, input: DescribeReservedNodeExchangeStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedNodeExchangeStatusCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeReservedNodeExchangeStatusCommandInput, + DescribeReservedNodeExchangeStatusCommandOutput +>(RedshiftClient, DescribeReservedNodeExchangeStatusCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeReservedNodeOfferingsPaginator.ts b/clients/client-redshift/src/pagination/DescribeReservedNodeOfferingsPaginator.ts index 7a548bac8c1c..c68096049277 100644 --- a/clients/client-redshift/src/pagination/DescribeReservedNodeOfferingsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeReservedNodeOfferingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeReservedNodeOfferingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedNodeOfferingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedNodeOfferings( +export const paginateDescribeReservedNodeOfferings: ( config: RedshiftPaginationConfiguration, input: DescribeReservedNodeOfferingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedNodeOfferingsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeReservedNodeOfferingsCommandInput, + DescribeReservedNodeOfferingsCommandOutput +>(RedshiftClient, DescribeReservedNodeOfferingsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeReservedNodesPaginator.ts b/clients/client-redshift/src/pagination/DescribeReservedNodesPaginator.ts index 7bb8eb48fdfc..bc0cb9ac6a24 100644 --- a/clients/client-redshift/src/pagination/DescribeReservedNodesPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeReservedNodesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeReservedNodesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeReservedNodesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeReservedNodes( +export const paginateDescribeReservedNodes: ( config: RedshiftPaginationConfiguration, input: DescribeReservedNodesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeReservedNodesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeReservedNodesCommandInput, + DescribeReservedNodesCommandOutput +>(RedshiftClient, DescribeReservedNodesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeScheduledActionsPaginator.ts b/clients/client-redshift/src/pagination/DescribeScheduledActionsPaginator.ts index 8acdf0786916..f243e7fa0750 100644 --- a/clients/client-redshift/src/pagination/DescribeScheduledActionsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeScheduledActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeScheduledActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeScheduledActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeScheduledActions( +export const paginateDescribeScheduledActions: ( config: RedshiftPaginationConfiguration, input: DescribeScheduledActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeScheduledActionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeScheduledActionsCommandInput, + DescribeScheduledActionsCommandOutput +>(RedshiftClient, DescribeScheduledActionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeSnapshotCopyGrantsPaginator.ts b/clients/client-redshift/src/pagination/DescribeSnapshotCopyGrantsPaginator.ts index ea621e73c907..026fc1d55745 100644 --- a/clients/client-redshift/src/pagination/DescribeSnapshotCopyGrantsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeSnapshotCopyGrantsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeSnapshotCopyGrantsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSnapshotCopyGrantsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSnapshotCopyGrants( +export const paginateDescribeSnapshotCopyGrants: ( config: RedshiftPaginationConfiguration, input: DescribeSnapshotCopyGrantsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSnapshotCopyGrantsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeSnapshotCopyGrantsCommandInput, + DescribeSnapshotCopyGrantsCommandOutput +>(RedshiftClient, DescribeSnapshotCopyGrantsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeSnapshotSchedulesPaginator.ts b/clients/client-redshift/src/pagination/DescribeSnapshotSchedulesPaginator.ts index d85b0bc2fae9..e611c949b8e0 100644 --- a/clients/client-redshift/src/pagination/DescribeSnapshotSchedulesPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeSnapshotSchedulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeSnapshotSchedulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSnapshotSchedulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSnapshotSchedules( +export const paginateDescribeSnapshotSchedules: ( config: RedshiftPaginationConfiguration, input: DescribeSnapshotSchedulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSnapshotSchedulesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeSnapshotSchedulesCommandInput, + DescribeSnapshotSchedulesCommandOutput +>(RedshiftClient, DescribeSnapshotSchedulesCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeTableRestoreStatusPaginator.ts b/clients/client-redshift/src/pagination/DescribeTableRestoreStatusPaginator.ts index 9aee6a2f41a2..25f50e95ad85 100644 --- a/clients/client-redshift/src/pagination/DescribeTableRestoreStatusPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeTableRestoreStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeTableRestoreStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTableRestoreStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTableRestoreStatus( +export const paginateDescribeTableRestoreStatus: ( config: RedshiftPaginationConfiguration, input: DescribeTableRestoreStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTableRestoreStatusCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeTableRestoreStatusCommandInput, + DescribeTableRestoreStatusCommandOutput +>(RedshiftClient, DescribeTableRestoreStatusCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeTagsPaginator.ts b/clients/client-redshift/src/pagination/DescribeTagsPaginator.ts index e03e1e99bafa..2fc545de66c6 100644 --- a/clients/client-redshift/src/pagination/DescribeTagsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeTagsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTags( +export const paginateDescribeTags: ( config: RedshiftPaginationConfiguration, input: DescribeTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTagsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeTagsCommandInput, + DescribeTagsCommandOutput +>(RedshiftClient, DescribeTagsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/DescribeUsageLimitsPaginator.ts b/clients/client-redshift/src/pagination/DescribeUsageLimitsPaginator.ts index 419b5ba326ec..7ac5fa60c715 100644 --- a/clients/client-redshift/src/pagination/DescribeUsageLimitsPaginator.ts +++ b/clients/client-redshift/src/pagination/DescribeUsageLimitsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: DescribeUsageLimitsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeUsageLimitsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeUsageLimits( +export const paginateDescribeUsageLimits: ( config: RedshiftPaginationConfiguration, input: DescribeUsageLimitsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeUsageLimitsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + DescribeUsageLimitsCommandInput, + DescribeUsageLimitsCommandOutput +>(RedshiftClient, DescribeUsageLimitsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/GetReservedNodeExchangeConfigurationOptionsPaginator.ts b/clients/client-redshift/src/pagination/GetReservedNodeExchangeConfigurationOptionsPaginator.ts index 1927873624a2..50275d4d2374 100644 --- a/clients/client-redshift/src/pagination/GetReservedNodeExchangeConfigurationOptionsPaginator.ts +++ b/clients/client-redshift/src/pagination/GetReservedNodeExchangeConfigurationOptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: GetReservedNodeExchangeConfigurationOptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetReservedNodeExchangeConfigurationOptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetReservedNodeExchangeConfigurationOptions( +export const paginateGetReservedNodeExchangeConfigurationOptions: ( config: RedshiftPaginationConfiguration, input: GetReservedNodeExchangeConfigurationOptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetReservedNodeExchangeConfigurationOptionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + GetReservedNodeExchangeConfigurationOptionsCommandInput, + GetReservedNodeExchangeConfigurationOptionsCommandOutput +>(RedshiftClient, GetReservedNodeExchangeConfigurationOptionsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-redshift/src/pagination/GetReservedNodeExchangeOfferingsPaginator.ts b/clients/client-redshift/src/pagination/GetReservedNodeExchangeOfferingsPaginator.ts index 78cd7174ada9..05f09d7993f3 100644 --- a/clients/client-redshift/src/pagination/GetReservedNodeExchangeOfferingsPaginator.ts +++ b/clients/client-redshift/src/pagination/GetReservedNodeExchangeOfferingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RedshiftClient } from "../RedshiftClient"; import { RedshiftPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RedshiftClient, - input: GetReservedNodeExchangeOfferingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetReservedNodeExchangeOfferingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetReservedNodeExchangeOfferings( +export const paginateGetReservedNodeExchangeOfferings: ( config: RedshiftPaginationConfiguration, input: GetReservedNodeExchangeOfferingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetReservedNodeExchangeOfferingsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxRecords"] = config.pageSize; - if (config.client instanceof RedshiftClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Redshift | RedshiftClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RedshiftPaginationConfiguration, + GetReservedNodeExchangeOfferingsCommandInput, + GetReservedNodeExchangeOfferingsCommandOutput +>(RedshiftClient, GetReservedNodeExchangeOfferingsCommand, "Marker", "Marker", "MaxRecords"); diff --git a/clients/client-rekognition/package.json b/clients/client-rekognition/package.json index 15d8ee571a6e..c0b39ba057f2 100644 --- a/clients/client-rekognition/package.json +++ b/clients/client-rekognition/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-rekognition/src/pagination/DescribeProjectVersionsPaginator.ts b/clients/client-rekognition/src/pagination/DescribeProjectVersionsPaginator.ts index 248e46da0f25..a05c0fda7f38 100644 --- a/clients/client-rekognition/src/pagination/DescribeProjectVersionsPaginator.ts +++ b/clients/client-rekognition/src/pagination/DescribeProjectVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: DescribeProjectVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeProjectVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeProjectVersions( +export const paginateDescribeProjectVersions: ( config: RekognitionPaginationConfiguration, input: DescribeProjectVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeProjectVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + DescribeProjectVersionsCommandInput, + DescribeProjectVersionsCommandOutput +>(RekognitionClient, DescribeProjectVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/DescribeProjectsPaginator.ts b/clients/client-rekognition/src/pagination/DescribeProjectsPaginator.ts index 72f101454173..7f53009fdd40 100644 --- a/clients/client-rekognition/src/pagination/DescribeProjectsPaginator.ts +++ b/clients/client-rekognition/src/pagination/DescribeProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: DescribeProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeProjects( +export const paginateDescribeProjects: ( config: RekognitionPaginationConfiguration, input: DescribeProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeProjectsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + DescribeProjectsCommandInput, + DescribeProjectsCommandOutput +>(RekognitionClient, DescribeProjectsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/GetCelebrityRecognitionPaginator.ts b/clients/client-rekognition/src/pagination/GetCelebrityRecognitionPaginator.ts index 863fecc7e9de..ff64a4a29362 100644 --- a/clients/client-rekognition/src/pagination/GetCelebrityRecognitionPaginator.ts +++ b/clients/client-rekognition/src/pagination/GetCelebrityRecognitionPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: GetCelebrityRecognitionCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCelebrityRecognitionCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCelebrityRecognition( +export const paginateGetCelebrityRecognition: ( config: RekognitionPaginationConfiguration, input: GetCelebrityRecognitionCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCelebrityRecognitionCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + GetCelebrityRecognitionCommandInput, + GetCelebrityRecognitionCommandOutput +>(RekognitionClient, GetCelebrityRecognitionCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/GetContentModerationPaginator.ts b/clients/client-rekognition/src/pagination/GetContentModerationPaginator.ts index e5ebdf3fb4b3..2ca77527df7f 100644 --- a/clients/client-rekognition/src/pagination/GetContentModerationPaginator.ts +++ b/clients/client-rekognition/src/pagination/GetContentModerationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: GetContentModerationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetContentModerationCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetContentModeration( +export const paginateGetContentModeration: ( config: RekognitionPaginationConfiguration, input: GetContentModerationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetContentModerationCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + GetContentModerationCommandInput, + GetContentModerationCommandOutput +>(RekognitionClient, GetContentModerationCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/GetFaceDetectionPaginator.ts b/clients/client-rekognition/src/pagination/GetFaceDetectionPaginator.ts index 324a0808ec5b..94d77b6cf584 100644 --- a/clients/client-rekognition/src/pagination/GetFaceDetectionPaginator.ts +++ b/clients/client-rekognition/src/pagination/GetFaceDetectionPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: GetFaceDetectionCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetFaceDetectionCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetFaceDetection( +export const paginateGetFaceDetection: ( config: RekognitionPaginationConfiguration, input: GetFaceDetectionCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetFaceDetectionCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + GetFaceDetectionCommandInput, + GetFaceDetectionCommandOutput +>(RekognitionClient, GetFaceDetectionCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/GetFaceSearchPaginator.ts b/clients/client-rekognition/src/pagination/GetFaceSearchPaginator.ts index 2ae0560367b0..8653c2ab5e40 100644 --- a/clients/client-rekognition/src/pagination/GetFaceSearchPaginator.ts +++ b/clients/client-rekognition/src/pagination/GetFaceSearchPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: GetFaceSearchCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetFaceSearchCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetFaceSearch( +export const paginateGetFaceSearch: ( config: RekognitionPaginationConfiguration, input: GetFaceSearchCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetFaceSearchCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + GetFaceSearchCommandInput, + GetFaceSearchCommandOutput +>(RekognitionClient, GetFaceSearchCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/GetLabelDetectionPaginator.ts b/clients/client-rekognition/src/pagination/GetLabelDetectionPaginator.ts index 05c99bed50a1..03b9d3aa5407 100644 --- a/clients/client-rekognition/src/pagination/GetLabelDetectionPaginator.ts +++ b/clients/client-rekognition/src/pagination/GetLabelDetectionPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: GetLabelDetectionCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetLabelDetectionCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetLabelDetection( +export const paginateGetLabelDetection: ( config: RekognitionPaginationConfiguration, input: GetLabelDetectionCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetLabelDetectionCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + GetLabelDetectionCommandInput, + GetLabelDetectionCommandOutput +>(RekognitionClient, GetLabelDetectionCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/GetPersonTrackingPaginator.ts b/clients/client-rekognition/src/pagination/GetPersonTrackingPaginator.ts index 53b7dcfd927e..ce242088abf3 100644 --- a/clients/client-rekognition/src/pagination/GetPersonTrackingPaginator.ts +++ b/clients/client-rekognition/src/pagination/GetPersonTrackingPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: GetPersonTrackingCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetPersonTrackingCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetPersonTracking( +export const paginateGetPersonTracking: ( config: RekognitionPaginationConfiguration, input: GetPersonTrackingCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetPersonTrackingCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + GetPersonTrackingCommandInput, + GetPersonTrackingCommandOutput +>(RekognitionClient, GetPersonTrackingCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/GetSegmentDetectionPaginator.ts b/clients/client-rekognition/src/pagination/GetSegmentDetectionPaginator.ts index d4e5d38429b8..1c9858cacbd9 100644 --- a/clients/client-rekognition/src/pagination/GetSegmentDetectionPaginator.ts +++ b/clients/client-rekognition/src/pagination/GetSegmentDetectionPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: GetSegmentDetectionCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetSegmentDetectionCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetSegmentDetection( +export const paginateGetSegmentDetection: ( config: RekognitionPaginationConfiguration, input: GetSegmentDetectionCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetSegmentDetectionCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + GetSegmentDetectionCommandInput, + GetSegmentDetectionCommandOutput +>(RekognitionClient, GetSegmentDetectionCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/GetTextDetectionPaginator.ts b/clients/client-rekognition/src/pagination/GetTextDetectionPaginator.ts index 72f9991e0d23..af4c7164e426 100644 --- a/clients/client-rekognition/src/pagination/GetTextDetectionPaginator.ts +++ b/clients/client-rekognition/src/pagination/GetTextDetectionPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: GetTextDetectionCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTextDetectionCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTextDetection( +export const paginateGetTextDetection: ( config: RekognitionPaginationConfiguration, input: GetTextDetectionCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTextDetectionCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + GetTextDetectionCommandInput, + GetTextDetectionCommandOutput +>(RekognitionClient, GetTextDetectionCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/ListCollectionsPaginator.ts b/clients/client-rekognition/src/pagination/ListCollectionsPaginator.ts index 8e9ce006a506..abe5299368f9 100644 --- a/clients/client-rekognition/src/pagination/ListCollectionsPaginator.ts +++ b/clients/client-rekognition/src/pagination/ListCollectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: ListCollectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCollectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCollections( +export const paginateListCollections: ( config: RekognitionPaginationConfiguration, input: ListCollectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCollectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + ListCollectionsCommandInput, + ListCollectionsCommandOutput +>(RekognitionClient, ListCollectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/ListDatasetEntriesPaginator.ts b/clients/client-rekognition/src/pagination/ListDatasetEntriesPaginator.ts index d4176d2031c8..daf55b131dcd 100644 --- a/clients/client-rekognition/src/pagination/ListDatasetEntriesPaginator.ts +++ b/clients/client-rekognition/src/pagination/ListDatasetEntriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: ListDatasetEntriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetEntriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasetEntries( +export const paginateListDatasetEntries: ( config: RekognitionPaginationConfiguration, input: ListDatasetEntriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetEntriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + ListDatasetEntriesCommandInput, + ListDatasetEntriesCommandOutput +>(RekognitionClient, ListDatasetEntriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/ListDatasetLabelsPaginator.ts b/clients/client-rekognition/src/pagination/ListDatasetLabelsPaginator.ts index 22205ca3d558..261cd11aa19c 100644 --- a/clients/client-rekognition/src/pagination/ListDatasetLabelsPaginator.ts +++ b/clients/client-rekognition/src/pagination/ListDatasetLabelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: ListDatasetLabelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatasetLabelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatasetLabels( +export const paginateListDatasetLabels: ( config: RekognitionPaginationConfiguration, input: ListDatasetLabelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatasetLabelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + ListDatasetLabelsCommandInput, + ListDatasetLabelsCommandOutput +>(RekognitionClient, ListDatasetLabelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/ListFacesPaginator.ts b/clients/client-rekognition/src/pagination/ListFacesPaginator.ts index 088b8f52f46f..fd2e01c987f8 100644 --- a/clients/client-rekognition/src/pagination/ListFacesPaginator.ts +++ b/clients/client-rekognition/src/pagination/ListFacesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListFacesCommand, ListFacesCommandInput, ListFacesCommandOutput } from "../commands/ListFacesCommand"; import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: ListFacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFaces( +export const paginateListFaces: ( config: RekognitionPaginationConfiguration, input: ListFacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFacesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + ListFacesCommandInput, + ListFacesCommandOutput +>(RekognitionClient, ListFacesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/ListMediaAnalysisJobsPaginator.ts b/clients/client-rekognition/src/pagination/ListMediaAnalysisJobsPaginator.ts index 2400c3d680f8..9a9d5fac0194 100644 --- a/clients/client-rekognition/src/pagination/ListMediaAnalysisJobsPaginator.ts +++ b/clients/client-rekognition/src/pagination/ListMediaAnalysisJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: ListMediaAnalysisJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMediaAnalysisJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMediaAnalysisJobs( +export const paginateListMediaAnalysisJobs: ( config: RekognitionPaginationConfiguration, input: ListMediaAnalysisJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMediaAnalysisJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + ListMediaAnalysisJobsCommandInput, + ListMediaAnalysisJobsCommandOutput +>(RekognitionClient, ListMediaAnalysisJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/ListProjectPoliciesPaginator.ts b/clients/client-rekognition/src/pagination/ListProjectPoliciesPaginator.ts index 98dd0fd55d01..78ca049edeb9 100644 --- a/clients/client-rekognition/src/pagination/ListProjectPoliciesPaginator.ts +++ b/clients/client-rekognition/src/pagination/ListProjectPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: ListProjectPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProjectPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProjectPolicies( +export const paginateListProjectPolicies: ( config: RekognitionPaginationConfiguration, input: ListProjectPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProjectPoliciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + ListProjectPoliciesCommandInput, + ListProjectPoliciesCommandOutput +>(RekognitionClient, ListProjectPoliciesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/ListStreamProcessorsPaginator.ts b/clients/client-rekognition/src/pagination/ListStreamProcessorsPaginator.ts index 89bb44033172..703e049079e7 100644 --- a/clients/client-rekognition/src/pagination/ListStreamProcessorsPaginator.ts +++ b/clients/client-rekognition/src/pagination/ListStreamProcessorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: ListStreamProcessorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStreamProcessorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStreamProcessors( +export const paginateListStreamProcessors: ( config: RekognitionPaginationConfiguration, input: ListStreamProcessorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStreamProcessorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + ListStreamProcessorsCommandInput, + ListStreamProcessorsCommandOutput +>(RekognitionClient, ListStreamProcessorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rekognition/src/pagination/ListUsersPaginator.ts b/clients/client-rekognition/src/pagination/ListUsersPaginator.ts index 5961ccf0fb7e..9102c3eacc6d 100644 --- a/clients/client-rekognition/src/pagination/ListUsersPaginator.ts +++ b/clients/client-rekognition/src/pagination/ListUsersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListUsersCommand, ListUsersCommandInput, ListUsersCommandOutput } from "../commands/ListUsersCommand"; import { RekognitionClient } from "../RekognitionClient"; import { RekognitionPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RekognitionClient, - input: ListUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUsers( +export const paginateListUsers: ( config: RekognitionPaginationConfiguration, input: ListUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUsersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RekognitionClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Rekognition | RekognitionClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RekognitionPaginationConfiguration, + ListUsersCommandInput, + ListUsersCommandOutput +>(RekognitionClient, ListUsersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-repostspace/src/pagination/ListSpacesPaginator.ts b/clients/client-repostspace/src/pagination/ListSpacesPaginator.ts index d8c3b095da34..a6518494b1a7 100644 --- a/clients/client-repostspace/src/pagination/ListSpacesPaginator.ts +++ b/clients/client-repostspace/src/pagination/ListSpacesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListSpacesCommand, ListSpacesCommandInput, ListSpacesCommandOutput } from "../commands/ListSpacesCommand"; import { RepostspaceClient } from "../RepostspaceClient"; import { RepostspacePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RepostspaceClient, - input: ListSpacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSpacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSpaces( +export const paginateListSpaces: ( config: RepostspacePaginationConfiguration, input: ListSpacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSpacesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RepostspaceClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Repostspace | RepostspaceClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RepostspacePaginationConfiguration, + ListSpacesCommandInput, + ListSpacesCommandOutput +>(RepostspaceClient, ListSpacesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListAlarmRecommendationsPaginator.ts b/clients/client-resiliencehub/src/pagination/ListAlarmRecommendationsPaginator.ts index f18208267d41..52fbb5223438 100644 --- a/clients/client-resiliencehub/src/pagination/ListAlarmRecommendationsPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListAlarmRecommendationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListAlarmRecommendationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAlarmRecommendationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAlarmRecommendations( +export const paginateListAlarmRecommendations: ( config: ResiliencehubPaginationConfiguration, input: ListAlarmRecommendationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAlarmRecommendationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListAlarmRecommendationsCommandInput, + ListAlarmRecommendationsCommandOutput +>(ResiliencehubClient, ListAlarmRecommendationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListAppAssessmentComplianceDriftsPaginator.ts b/clients/client-resiliencehub/src/pagination/ListAppAssessmentComplianceDriftsPaginator.ts index 96c8ac3ff763..9ce4af07629f 100644 --- a/clients/client-resiliencehub/src/pagination/ListAppAssessmentComplianceDriftsPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListAppAssessmentComplianceDriftsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListAppAssessmentComplianceDriftsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppAssessmentComplianceDriftsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppAssessmentComplianceDrifts( +export const paginateListAppAssessmentComplianceDrifts: ( config: ResiliencehubPaginationConfiguration, input: ListAppAssessmentComplianceDriftsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppAssessmentComplianceDriftsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListAppAssessmentComplianceDriftsCommandInput, + ListAppAssessmentComplianceDriftsCommandOutput +>(ResiliencehubClient, ListAppAssessmentComplianceDriftsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListAppAssessmentsPaginator.ts b/clients/client-resiliencehub/src/pagination/ListAppAssessmentsPaginator.ts index 9a985b92fdb7..0ccb7374ed37 100644 --- a/clients/client-resiliencehub/src/pagination/ListAppAssessmentsPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListAppAssessmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListAppAssessmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppAssessmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppAssessments( +export const paginateListAppAssessments: ( config: ResiliencehubPaginationConfiguration, input: ListAppAssessmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppAssessmentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListAppAssessmentsCommandInput, + ListAppAssessmentsCommandOutput +>(ResiliencehubClient, ListAppAssessmentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListAppComponentCompliancesPaginator.ts b/clients/client-resiliencehub/src/pagination/ListAppComponentCompliancesPaginator.ts index 4e9d48c1bcb7..8e44b48cf1ac 100644 --- a/clients/client-resiliencehub/src/pagination/ListAppComponentCompliancesPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListAppComponentCompliancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListAppComponentCompliancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppComponentCompliancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppComponentCompliances( +export const paginateListAppComponentCompliances: ( config: ResiliencehubPaginationConfiguration, input: ListAppComponentCompliancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppComponentCompliancesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListAppComponentCompliancesCommandInput, + ListAppComponentCompliancesCommandOutput +>(ResiliencehubClient, ListAppComponentCompliancesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListAppComponentRecommendationsPaginator.ts b/clients/client-resiliencehub/src/pagination/ListAppComponentRecommendationsPaginator.ts index 6cf1f4ab40a1..9de511ec6b5a 100644 --- a/clients/client-resiliencehub/src/pagination/ListAppComponentRecommendationsPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListAppComponentRecommendationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListAppComponentRecommendationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppComponentRecommendationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppComponentRecommendations( +export const paginateListAppComponentRecommendations: ( config: ResiliencehubPaginationConfiguration, input: ListAppComponentRecommendationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppComponentRecommendationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListAppComponentRecommendationsCommandInput, + ListAppComponentRecommendationsCommandOutput +>(ResiliencehubClient, ListAppComponentRecommendationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListAppInputSourcesPaginator.ts b/clients/client-resiliencehub/src/pagination/ListAppInputSourcesPaginator.ts index 562feef19617..4e8af9baa2e0 100644 --- a/clients/client-resiliencehub/src/pagination/ListAppInputSourcesPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListAppInputSourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListAppInputSourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppInputSourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppInputSources( +export const paginateListAppInputSources: ( config: ResiliencehubPaginationConfiguration, input: ListAppInputSourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppInputSourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListAppInputSourcesCommandInput, + ListAppInputSourcesCommandOutput +>(ResiliencehubClient, ListAppInputSourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListAppVersionAppComponentsPaginator.ts b/clients/client-resiliencehub/src/pagination/ListAppVersionAppComponentsPaginator.ts index fcc37cd1289f..d89bda5c355f 100644 --- a/clients/client-resiliencehub/src/pagination/ListAppVersionAppComponentsPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListAppVersionAppComponentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListAppVersionAppComponentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppVersionAppComponentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppVersionAppComponents( +export const paginateListAppVersionAppComponents: ( config: ResiliencehubPaginationConfiguration, input: ListAppVersionAppComponentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppVersionAppComponentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListAppVersionAppComponentsCommandInput, + ListAppVersionAppComponentsCommandOutput +>(ResiliencehubClient, ListAppVersionAppComponentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListAppVersionResourceMappingsPaginator.ts b/clients/client-resiliencehub/src/pagination/ListAppVersionResourceMappingsPaginator.ts index 6676b219a287..87d087521047 100644 --- a/clients/client-resiliencehub/src/pagination/ListAppVersionResourceMappingsPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListAppVersionResourceMappingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListAppVersionResourceMappingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppVersionResourceMappingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppVersionResourceMappings( +export const paginateListAppVersionResourceMappings: ( config: ResiliencehubPaginationConfiguration, input: ListAppVersionResourceMappingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppVersionResourceMappingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListAppVersionResourceMappingsCommandInput, + ListAppVersionResourceMappingsCommandOutput +>(ResiliencehubClient, ListAppVersionResourceMappingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListAppVersionResourcesPaginator.ts b/clients/client-resiliencehub/src/pagination/ListAppVersionResourcesPaginator.ts index ac1ae468ed77..243036305809 100644 --- a/clients/client-resiliencehub/src/pagination/ListAppVersionResourcesPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListAppVersionResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListAppVersionResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppVersionResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppVersionResources( +export const paginateListAppVersionResources: ( config: ResiliencehubPaginationConfiguration, input: ListAppVersionResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppVersionResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListAppVersionResourcesCommandInput, + ListAppVersionResourcesCommandOutput +>(ResiliencehubClient, ListAppVersionResourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListAppVersionsPaginator.ts b/clients/client-resiliencehub/src/pagination/ListAppVersionsPaginator.ts index 48879e21e42e..81f1ba95e23f 100644 --- a/clients/client-resiliencehub/src/pagination/ListAppVersionsPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListAppVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListAppVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppVersions( +export const paginateListAppVersions: ( config: ResiliencehubPaginationConfiguration, input: ListAppVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppVersionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListAppVersionsCommandInput, + ListAppVersionsCommandOutput +>(ResiliencehubClient, ListAppVersionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListAppsPaginator.ts b/clients/client-resiliencehub/src/pagination/ListAppsPaginator.ts index cc6eab584436..b5486dec6515 100644 --- a/clients/client-resiliencehub/src/pagination/ListAppsPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListAppsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAppsCommand, ListAppsCommandInput, ListAppsCommandOutput } from "../commands/ListAppsCommand"; import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListAppsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApps( +export const paginateListApps: ( config: ResiliencehubPaginationConfiguration, input: ListAppsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListAppsCommandInput, + ListAppsCommandOutput +>(ResiliencehubClient, ListAppsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListRecommendationTemplatesPaginator.ts b/clients/client-resiliencehub/src/pagination/ListRecommendationTemplatesPaginator.ts index f2ae97ac6367..927dfa546105 100644 --- a/clients/client-resiliencehub/src/pagination/ListRecommendationTemplatesPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListRecommendationTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListRecommendationTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecommendationTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecommendationTemplates( +export const paginateListRecommendationTemplates: ( config: ResiliencehubPaginationConfiguration, input: ListRecommendationTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecommendationTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListRecommendationTemplatesCommandInput, + ListRecommendationTemplatesCommandOutput +>(ResiliencehubClient, ListRecommendationTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListResiliencyPoliciesPaginator.ts b/clients/client-resiliencehub/src/pagination/ListResiliencyPoliciesPaginator.ts index 214c2e1da7d4..8a63b41a40c5 100644 --- a/clients/client-resiliencehub/src/pagination/ListResiliencyPoliciesPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListResiliencyPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListResiliencyPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResiliencyPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResiliencyPolicies( +export const paginateListResiliencyPolicies: ( config: ResiliencehubPaginationConfiguration, input: ListResiliencyPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResiliencyPoliciesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListResiliencyPoliciesCommandInput, + ListResiliencyPoliciesCommandOutput +>(ResiliencehubClient, ListResiliencyPoliciesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListSopRecommendationsPaginator.ts b/clients/client-resiliencehub/src/pagination/ListSopRecommendationsPaginator.ts index 706f75530940..7f2658a079b1 100644 --- a/clients/client-resiliencehub/src/pagination/ListSopRecommendationsPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListSopRecommendationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListSopRecommendationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSopRecommendationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSopRecommendations( +export const paginateListSopRecommendations: ( config: ResiliencehubPaginationConfiguration, input: ListSopRecommendationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSopRecommendationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListSopRecommendationsCommandInput, + ListSopRecommendationsCommandOutput +>(ResiliencehubClient, ListSopRecommendationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListSuggestedResiliencyPoliciesPaginator.ts b/clients/client-resiliencehub/src/pagination/ListSuggestedResiliencyPoliciesPaginator.ts index d78b6edec1c3..7fc95aef45fe 100644 --- a/clients/client-resiliencehub/src/pagination/ListSuggestedResiliencyPoliciesPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListSuggestedResiliencyPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListSuggestedResiliencyPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSuggestedResiliencyPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSuggestedResiliencyPolicies( +export const paginateListSuggestedResiliencyPolicies: ( config: ResiliencehubPaginationConfiguration, input: ListSuggestedResiliencyPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSuggestedResiliencyPoliciesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListSuggestedResiliencyPoliciesCommandInput, + ListSuggestedResiliencyPoliciesCommandOutput +>(ResiliencehubClient, ListSuggestedResiliencyPoliciesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListTestRecommendationsPaginator.ts b/clients/client-resiliencehub/src/pagination/ListTestRecommendationsPaginator.ts index 0e294c245740..45e4118df12c 100644 --- a/clients/client-resiliencehub/src/pagination/ListTestRecommendationsPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListTestRecommendationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListTestRecommendationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTestRecommendationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTestRecommendations( +export const paginateListTestRecommendations: ( config: ResiliencehubPaginationConfiguration, input: ListTestRecommendationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTestRecommendationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListTestRecommendationsCommandInput, + ListTestRecommendationsCommandOutput +>(ResiliencehubClient, ListTestRecommendationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resiliencehub/src/pagination/ListUnsupportedAppVersionResourcesPaginator.ts b/clients/client-resiliencehub/src/pagination/ListUnsupportedAppVersionResourcesPaginator.ts index 7753fc19d6cb..8728beca1f93 100644 --- a/clients/client-resiliencehub/src/pagination/ListUnsupportedAppVersionResourcesPaginator.ts +++ b/clients/client-resiliencehub/src/pagination/ListUnsupportedAppVersionResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResiliencehubClient } from "../ResiliencehubClient"; import { ResiliencehubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResiliencehubClient, - input: ListUnsupportedAppVersionResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUnsupportedAppVersionResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUnsupportedAppVersionResources( +export const paginateListUnsupportedAppVersionResources: ( config: ResiliencehubPaginationConfiguration, input: ListUnsupportedAppVersionResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUnsupportedAppVersionResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ResiliencehubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Resiliencehub | ResiliencehubClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResiliencehubPaginationConfiguration, + ListUnsupportedAppVersionResourcesCommandInput, + ListUnsupportedAppVersionResourcesCommandOutput +>(ResiliencehubClient, ListUnsupportedAppVersionResourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-resource-explorer-2/src/pagination/ListIndexesForMembersPaginator.ts b/clients/client-resource-explorer-2/src/pagination/ListIndexesForMembersPaginator.ts index 00e43be76257..bb7e834f3c5d 100644 --- a/clients/client-resource-explorer-2/src/pagination/ListIndexesForMembersPaginator.ts +++ b/clients/client-resource-explorer-2/src/pagination/ListIndexesForMembersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResourceExplorer2Client } from "../ResourceExplorer2Client"; import { ResourceExplorer2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResourceExplorer2Client, - input: ListIndexesForMembersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIndexesForMembersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIndexesForMembers( +export const paginateListIndexesForMembers: ( config: ResourceExplorer2PaginationConfiguration, input: ListIndexesForMembersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIndexesForMembersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ResourceExplorer2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ResourceExplorer2 | ResourceExplorer2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResourceExplorer2PaginationConfiguration, + ListIndexesForMembersCommandInput, + ListIndexesForMembersCommandOutput +>(ResourceExplorer2Client, ListIndexesForMembersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-resource-explorer-2/src/pagination/ListIndexesPaginator.ts b/clients/client-resource-explorer-2/src/pagination/ListIndexesPaginator.ts index ca6001a9db65..fe213f9efebf 100644 --- a/clients/client-resource-explorer-2/src/pagination/ListIndexesPaginator.ts +++ b/clients/client-resource-explorer-2/src/pagination/ListIndexesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListIndexesCommand, ListIndexesCommandInput, ListIndexesCommandOutput } from "../commands/ListIndexesCommand"; import { ResourceExplorer2Client } from "../ResourceExplorer2Client"; import { ResourceExplorer2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResourceExplorer2Client, - input: ListIndexesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIndexesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIndexes( +export const paginateListIndexes: ( config: ResourceExplorer2PaginationConfiguration, input: ListIndexesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIndexesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ResourceExplorer2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ResourceExplorer2 | ResourceExplorer2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResourceExplorer2PaginationConfiguration, + ListIndexesCommandInput, + ListIndexesCommandOutput +>(ResourceExplorer2Client, ListIndexesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-resource-explorer-2/src/pagination/ListSupportedResourceTypesPaginator.ts b/clients/client-resource-explorer-2/src/pagination/ListSupportedResourceTypesPaginator.ts index 22befed721af..29a4e1c37ddd 100644 --- a/clients/client-resource-explorer-2/src/pagination/ListSupportedResourceTypesPaginator.ts +++ b/clients/client-resource-explorer-2/src/pagination/ListSupportedResourceTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResourceExplorer2Client } from "../ResourceExplorer2Client"; import { ResourceExplorer2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResourceExplorer2Client, - input: ListSupportedResourceTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSupportedResourceTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSupportedResourceTypes( +export const paginateListSupportedResourceTypes: ( config: ResourceExplorer2PaginationConfiguration, input: ListSupportedResourceTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSupportedResourceTypesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ResourceExplorer2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ResourceExplorer2 | ResourceExplorer2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResourceExplorer2PaginationConfiguration, + ListSupportedResourceTypesCommandInput, + ListSupportedResourceTypesCommandOutput +>(ResourceExplorer2Client, ListSupportedResourceTypesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-resource-explorer-2/src/pagination/ListViewsPaginator.ts b/clients/client-resource-explorer-2/src/pagination/ListViewsPaginator.ts index 27c4cc0d49c3..d94ee38aff66 100644 --- a/clients/client-resource-explorer-2/src/pagination/ListViewsPaginator.ts +++ b/clients/client-resource-explorer-2/src/pagination/ListViewsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListViewsCommand, ListViewsCommandInput, ListViewsCommandOutput } from "../commands/ListViewsCommand"; import { ResourceExplorer2Client } from "../ResourceExplorer2Client"; import { ResourceExplorer2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResourceExplorer2Client, - input: ListViewsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListViewsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListViews( +export const paginateListViews: ( config: ResourceExplorer2PaginationConfiguration, input: ListViewsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListViewsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ResourceExplorer2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ResourceExplorer2 | ResourceExplorer2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResourceExplorer2PaginationConfiguration, + ListViewsCommandInput, + ListViewsCommandOutput +>(ResourceExplorer2Client, ListViewsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-resource-explorer-2/src/pagination/SearchPaginator.ts b/clients/client-resource-explorer-2/src/pagination/SearchPaginator.ts index ba2f66b571aa..5b4599b1e266 100644 --- a/clients/client-resource-explorer-2/src/pagination/SearchPaginator.ts +++ b/clients/client-resource-explorer-2/src/pagination/SearchPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { SearchCommand, SearchCommandInput, SearchCommandOutput } from "../commands/SearchCommand"; import { ResourceExplorer2Client } from "../ResourceExplorer2Client"; import { ResourceExplorer2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResourceExplorer2Client, - input: SearchCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearch( +export const paginateSearch: ( config: ResourceExplorer2PaginationConfiguration, input: SearchCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ResourceExplorer2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ResourceExplorer2 | ResourceExplorer2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResourceExplorer2PaginationConfiguration, + SearchCommandInput, + SearchCommandOutput +>(ResourceExplorer2Client, SearchCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-resource-groups-tagging-api/package.json b/clients/client-resource-groups-tagging-api/package.json index b292a26f04d7..f5f45887b266 100644 --- a/clients/client-resource-groups-tagging-api/package.json +++ b/clients/client-resource-groups-tagging-api/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-resource-groups-tagging-api/src/pagination/GetComplianceSummaryPaginator.ts b/clients/client-resource-groups-tagging-api/src/pagination/GetComplianceSummaryPaginator.ts index 1cfaa4ffa7c8..94dc4ae57bac 100644 --- a/clients/client-resource-groups-tagging-api/src/pagination/GetComplianceSummaryPaginator.ts +++ b/clients/client-resource-groups-tagging-api/src/pagination/GetComplianceSummaryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResourceGroupsTaggingAPIClient } from "../ResourceGroupsTaggingAPIClient"; import { ResourceGroupsTaggingAPIPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResourceGroupsTaggingAPIClient, - input: GetComplianceSummaryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetComplianceSummaryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetComplianceSummary( +export const paginateGetComplianceSummary: ( config: ResourceGroupsTaggingAPIPaginationConfiguration, input: GetComplianceSummaryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PaginationToken - let token: typeof input.PaginationToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetComplianceSummaryCommandOutput; - while (hasNext) { - input.PaginationToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ResourceGroupsTaggingAPIClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ResourceGroupsTaggingAPI | ResourceGroupsTaggingAPIClient"); - } - yield page; - const prevToken = token; - token = page.PaginationToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResourceGroupsTaggingAPIPaginationConfiguration, + GetComplianceSummaryCommandInput, + GetComplianceSummaryCommandOutput +>(ResourceGroupsTaggingAPIClient, GetComplianceSummaryCommand, "PaginationToken", "PaginationToken", "MaxResults"); diff --git a/clients/client-resource-groups-tagging-api/src/pagination/GetResourcesPaginator.ts b/clients/client-resource-groups-tagging-api/src/pagination/GetResourcesPaginator.ts index 13c021b7f90b..34987f164626 100644 --- a/clients/client-resource-groups-tagging-api/src/pagination/GetResourcesPaginator.ts +++ b/clients/client-resource-groups-tagging-api/src/pagination/GetResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResourceGroupsTaggingAPIClient } from "../ResourceGroupsTaggingAPIClient"; import { ResourceGroupsTaggingAPIPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResourceGroupsTaggingAPIClient, - input: GetResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetResources( +export const paginateGetResources: ( config: ResourceGroupsTaggingAPIPaginationConfiguration, input: GetResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PaginationToken - let token: typeof input.PaginationToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetResourcesCommandOutput; - while (hasNext) { - input.PaginationToken = token; - input["ResourcesPerPage"] = config.pageSize; - if (config.client instanceof ResourceGroupsTaggingAPIClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ResourceGroupsTaggingAPI | ResourceGroupsTaggingAPIClient"); - } - yield page; - const prevToken = token; - token = page.PaginationToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResourceGroupsTaggingAPIPaginationConfiguration, + GetResourcesCommandInput, + GetResourcesCommandOutput +>(ResourceGroupsTaggingAPIClient, GetResourcesCommand, "PaginationToken", "PaginationToken", "ResourcesPerPage"); diff --git a/clients/client-resource-groups-tagging-api/src/pagination/GetTagKeysPaginator.ts b/clients/client-resource-groups-tagging-api/src/pagination/GetTagKeysPaginator.ts index d32954af98ce..ef44ca49393a 100644 --- a/clients/client-resource-groups-tagging-api/src/pagination/GetTagKeysPaginator.ts +++ b/clients/client-resource-groups-tagging-api/src/pagination/GetTagKeysPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetTagKeysCommand, GetTagKeysCommandInput, GetTagKeysCommandOutput } from "../commands/GetTagKeysCommand"; import { ResourceGroupsTaggingAPIClient } from "../ResourceGroupsTaggingAPIClient"; import { ResourceGroupsTaggingAPIPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResourceGroupsTaggingAPIClient, - input: GetTagKeysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTagKeysCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTagKeys( +export const paginateGetTagKeys: ( config: ResourceGroupsTaggingAPIPaginationConfiguration, input: GetTagKeysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PaginationToken - let token: typeof input.PaginationToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTagKeysCommandOutput; - while (hasNext) { - input.PaginationToken = token; - if (config.client instanceof ResourceGroupsTaggingAPIClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ResourceGroupsTaggingAPI | ResourceGroupsTaggingAPIClient"); - } - yield page; - const prevToken = token; - token = page.PaginationToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResourceGroupsTaggingAPIPaginationConfiguration, + GetTagKeysCommandInput, + GetTagKeysCommandOutput +>(ResourceGroupsTaggingAPIClient, GetTagKeysCommand, "PaginationToken", "PaginationToken", ""); diff --git a/clients/client-resource-groups-tagging-api/src/pagination/GetTagValuesPaginator.ts b/clients/client-resource-groups-tagging-api/src/pagination/GetTagValuesPaginator.ts index cdce48b94c2c..b5cb1c4dff51 100644 --- a/clients/client-resource-groups-tagging-api/src/pagination/GetTagValuesPaginator.ts +++ b/clients/client-resource-groups-tagging-api/src/pagination/GetTagValuesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { ResourceGroupsTaggingAPIClient } from "../ResourceGroupsTaggingAPIClient"; import { ResourceGroupsTaggingAPIPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResourceGroupsTaggingAPIClient, - input: GetTagValuesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTagValuesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTagValues( +export const paginateGetTagValues: ( config: ResourceGroupsTaggingAPIPaginationConfiguration, input: GetTagValuesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PaginationToken - let token: typeof input.PaginationToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTagValuesCommandOutput; - while (hasNext) { - input.PaginationToken = token; - if (config.client instanceof ResourceGroupsTaggingAPIClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ResourceGroupsTaggingAPI | ResourceGroupsTaggingAPIClient"); - } - yield page; - const prevToken = token; - token = page.PaginationToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResourceGroupsTaggingAPIPaginationConfiguration, + GetTagValuesCommandInput, + GetTagValuesCommandOutput +>(ResourceGroupsTaggingAPIClient, GetTagValuesCommand, "PaginationToken", "PaginationToken", ""); diff --git a/clients/client-resource-groups/src/pagination/ListGroupResourcesPaginator.ts b/clients/client-resource-groups/src/pagination/ListGroupResourcesPaginator.ts index 2ad689370f85..336d0b63df1a 100644 --- a/clients/client-resource-groups/src/pagination/ListGroupResourcesPaginator.ts +++ b/clients/client-resource-groups/src/pagination/ListGroupResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResourceGroupsClient } from "../ResourceGroupsClient"; import { ResourceGroupsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResourceGroupsClient, - input: ListGroupResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroupResources( +export const paginateListGroupResources: ( config: ResourceGroupsPaginationConfiguration, input: ListGroupResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupResourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ResourceGroupsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ResourceGroups | ResourceGroupsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResourceGroupsPaginationConfiguration, + ListGroupResourcesCommandInput, + ListGroupResourcesCommandOutput +>(ResourceGroupsClient, ListGroupResourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-resource-groups/src/pagination/ListGroupsPaginator.ts b/clients/client-resource-groups/src/pagination/ListGroupsPaginator.ts index 17c2bc189327..4d40037db930 100644 --- a/clients/client-resource-groups/src/pagination/ListGroupsPaginator.ts +++ b/clients/client-resource-groups/src/pagination/ListGroupsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListGroupsCommand, ListGroupsCommandInput, ListGroupsCommandOutput } from "../commands/ListGroupsCommand"; import { ResourceGroupsClient } from "../ResourceGroupsClient"; import { ResourceGroupsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResourceGroupsClient, - input: ListGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroups( +export const paginateListGroups: ( config: ResourceGroupsPaginationConfiguration, input: ListGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ResourceGroupsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ResourceGroups | ResourceGroupsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResourceGroupsPaginationConfiguration, + ListGroupsCommandInput, + ListGroupsCommandOutput +>(ResourceGroupsClient, ListGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-resource-groups/src/pagination/SearchResourcesPaginator.ts b/clients/client-resource-groups/src/pagination/SearchResourcesPaginator.ts index d6428a79f241..55e3792b4ba2 100644 --- a/clients/client-resource-groups/src/pagination/SearchResourcesPaginator.ts +++ b/clients/client-resource-groups/src/pagination/SearchResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ResourceGroupsClient } from "../ResourceGroupsClient"; import { ResourceGroupsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ResourceGroupsClient, - input: SearchResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchResources( +export const paginateSearchResources: ( config: ResourceGroupsPaginationConfiguration, input: SearchResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchResourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ResourceGroupsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ResourceGroups | ResourceGroupsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ResourceGroupsPaginationConfiguration, + SearchResourcesCommandInput, + SearchResourcesCommandOutput +>(ResourceGroupsClient, SearchResourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-robomaker/src/pagination/ListDeploymentJobsPaginator.ts b/clients/client-robomaker/src/pagination/ListDeploymentJobsPaginator.ts index a71bd80d2dc2..84a1ca4ce91a 100644 --- a/clients/client-robomaker/src/pagination/ListDeploymentJobsPaginator.ts +++ b/clients/client-robomaker/src/pagination/ListDeploymentJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RoboMakerClient } from "../RoboMakerClient"; import { RoboMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RoboMakerClient, - input: ListDeploymentJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeploymentJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeploymentJobs( +export const paginateListDeploymentJobs: ( config: RoboMakerPaginationConfiguration, input: ListDeploymentJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeploymentJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RoboMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RoboMaker | RoboMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RoboMakerPaginationConfiguration, + ListDeploymentJobsCommandInput, + ListDeploymentJobsCommandOutput +>(RoboMakerClient, ListDeploymentJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-robomaker/src/pagination/ListFleetsPaginator.ts b/clients/client-robomaker/src/pagination/ListFleetsPaginator.ts index 60f4b9a8b882..250178403091 100644 --- a/clients/client-robomaker/src/pagination/ListFleetsPaginator.ts +++ b/clients/client-robomaker/src/pagination/ListFleetsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListFleetsCommand, ListFleetsCommandInput, ListFleetsCommandOutput } from "../commands/ListFleetsCommand"; import { RoboMakerClient } from "../RoboMakerClient"; import { RoboMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RoboMakerClient, - input: ListFleetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFleetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFleets( +export const paginateListFleets: ( config: RoboMakerPaginationConfiguration, input: ListFleetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFleetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RoboMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RoboMaker | RoboMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RoboMakerPaginationConfiguration, + ListFleetsCommandInput, + ListFleetsCommandOutput +>(RoboMakerClient, ListFleetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-robomaker/src/pagination/ListRobotApplicationsPaginator.ts b/clients/client-robomaker/src/pagination/ListRobotApplicationsPaginator.ts index a2b5ebc0d7a6..96d846a5147b 100644 --- a/clients/client-robomaker/src/pagination/ListRobotApplicationsPaginator.ts +++ b/clients/client-robomaker/src/pagination/ListRobotApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RoboMakerClient } from "../RoboMakerClient"; import { RoboMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RoboMakerClient, - input: ListRobotApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRobotApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRobotApplications( +export const paginateListRobotApplications: ( config: RoboMakerPaginationConfiguration, input: ListRobotApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRobotApplicationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RoboMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RoboMaker | RoboMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RoboMakerPaginationConfiguration, + ListRobotApplicationsCommandInput, + ListRobotApplicationsCommandOutput +>(RoboMakerClient, ListRobotApplicationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-robomaker/src/pagination/ListRobotsPaginator.ts b/clients/client-robomaker/src/pagination/ListRobotsPaginator.ts index bb2eea1df2a5..dc3ba8c129d1 100644 --- a/clients/client-robomaker/src/pagination/ListRobotsPaginator.ts +++ b/clients/client-robomaker/src/pagination/ListRobotsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListRobotsCommand, ListRobotsCommandInput, ListRobotsCommandOutput } from "../commands/ListRobotsCommand"; import { RoboMakerClient } from "../RoboMakerClient"; import { RoboMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RoboMakerClient, - input: ListRobotsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRobotsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRobots( +export const paginateListRobots: ( config: RoboMakerPaginationConfiguration, input: ListRobotsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRobotsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RoboMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RoboMaker | RoboMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RoboMakerPaginationConfiguration, + ListRobotsCommandInput, + ListRobotsCommandOutput +>(RoboMakerClient, ListRobotsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-robomaker/src/pagination/ListSimulationApplicationsPaginator.ts b/clients/client-robomaker/src/pagination/ListSimulationApplicationsPaginator.ts index 721bb7492e0b..278b1b66e00e 100644 --- a/clients/client-robomaker/src/pagination/ListSimulationApplicationsPaginator.ts +++ b/clients/client-robomaker/src/pagination/ListSimulationApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RoboMakerClient } from "../RoboMakerClient"; import { RoboMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RoboMakerClient, - input: ListSimulationApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSimulationApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSimulationApplications( +export const paginateListSimulationApplications: ( config: RoboMakerPaginationConfiguration, input: ListSimulationApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSimulationApplicationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RoboMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RoboMaker | RoboMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RoboMakerPaginationConfiguration, + ListSimulationApplicationsCommandInput, + ListSimulationApplicationsCommandOutput +>(RoboMakerClient, ListSimulationApplicationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-robomaker/src/pagination/ListSimulationJobBatchesPaginator.ts b/clients/client-robomaker/src/pagination/ListSimulationJobBatchesPaginator.ts index f9de14482e40..104ae2462440 100644 --- a/clients/client-robomaker/src/pagination/ListSimulationJobBatchesPaginator.ts +++ b/clients/client-robomaker/src/pagination/ListSimulationJobBatchesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RoboMakerClient } from "../RoboMakerClient"; import { RoboMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RoboMakerClient, - input: ListSimulationJobBatchesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSimulationJobBatchesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSimulationJobBatches( +export const paginateListSimulationJobBatches: ( config: RoboMakerPaginationConfiguration, input: ListSimulationJobBatchesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSimulationJobBatchesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RoboMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RoboMaker | RoboMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RoboMakerPaginationConfiguration, + ListSimulationJobBatchesCommandInput, + ListSimulationJobBatchesCommandOutput +>(RoboMakerClient, ListSimulationJobBatchesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-robomaker/src/pagination/ListSimulationJobsPaginator.ts b/clients/client-robomaker/src/pagination/ListSimulationJobsPaginator.ts index d4aaae94089a..0963ef466e0e 100644 --- a/clients/client-robomaker/src/pagination/ListSimulationJobsPaginator.ts +++ b/clients/client-robomaker/src/pagination/ListSimulationJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RoboMakerClient } from "../RoboMakerClient"; import { RoboMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RoboMakerClient, - input: ListSimulationJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSimulationJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSimulationJobs( +export const paginateListSimulationJobs: ( config: RoboMakerPaginationConfiguration, input: ListSimulationJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSimulationJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RoboMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RoboMaker | RoboMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RoboMakerPaginationConfiguration, + ListSimulationJobsCommandInput, + ListSimulationJobsCommandOutput +>(RoboMakerClient, ListSimulationJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-robomaker/src/pagination/ListWorldExportJobsPaginator.ts b/clients/client-robomaker/src/pagination/ListWorldExportJobsPaginator.ts index 7086805e32ca..ddb05416b314 100644 --- a/clients/client-robomaker/src/pagination/ListWorldExportJobsPaginator.ts +++ b/clients/client-robomaker/src/pagination/ListWorldExportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RoboMakerClient } from "../RoboMakerClient"; import { RoboMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RoboMakerClient, - input: ListWorldExportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorldExportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorldExportJobs( +export const paginateListWorldExportJobs: ( config: RoboMakerPaginationConfiguration, input: ListWorldExportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorldExportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RoboMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RoboMaker | RoboMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RoboMakerPaginationConfiguration, + ListWorldExportJobsCommandInput, + ListWorldExportJobsCommandOutput +>(RoboMakerClient, ListWorldExportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-robomaker/src/pagination/ListWorldGenerationJobsPaginator.ts b/clients/client-robomaker/src/pagination/ListWorldGenerationJobsPaginator.ts index 62c915f837ac..78717c0e3279 100644 --- a/clients/client-robomaker/src/pagination/ListWorldGenerationJobsPaginator.ts +++ b/clients/client-robomaker/src/pagination/ListWorldGenerationJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RoboMakerClient } from "../RoboMakerClient"; import { RoboMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RoboMakerClient, - input: ListWorldGenerationJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorldGenerationJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorldGenerationJobs( +export const paginateListWorldGenerationJobs: ( config: RoboMakerPaginationConfiguration, input: ListWorldGenerationJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorldGenerationJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RoboMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RoboMaker | RoboMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RoboMakerPaginationConfiguration, + ListWorldGenerationJobsCommandInput, + ListWorldGenerationJobsCommandOutput +>(RoboMakerClient, ListWorldGenerationJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-robomaker/src/pagination/ListWorldTemplatesPaginator.ts b/clients/client-robomaker/src/pagination/ListWorldTemplatesPaginator.ts index ac0ad5b4f427..d1eef7e2cf24 100644 --- a/clients/client-robomaker/src/pagination/ListWorldTemplatesPaginator.ts +++ b/clients/client-robomaker/src/pagination/ListWorldTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RoboMakerClient } from "../RoboMakerClient"; import { RoboMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RoboMakerClient, - input: ListWorldTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorldTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorldTemplates( +export const paginateListWorldTemplates: ( config: RoboMakerPaginationConfiguration, input: ListWorldTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorldTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RoboMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RoboMaker | RoboMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RoboMakerPaginationConfiguration, + ListWorldTemplatesCommandInput, + ListWorldTemplatesCommandOutput +>(RoboMakerClient, ListWorldTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-robomaker/src/pagination/ListWorldsPaginator.ts b/clients/client-robomaker/src/pagination/ListWorldsPaginator.ts index 645a333a9b8f..364eeaf42b65 100644 --- a/clients/client-robomaker/src/pagination/ListWorldsPaginator.ts +++ b/clients/client-robomaker/src/pagination/ListWorldsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListWorldsCommand, ListWorldsCommandInput, ListWorldsCommandOutput } from "../commands/ListWorldsCommand"; import { RoboMakerClient } from "../RoboMakerClient"; import { RoboMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RoboMakerClient, - input: ListWorldsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorldsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorlds( +export const paginateListWorlds: ( config: RoboMakerPaginationConfiguration, input: ListWorldsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorldsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof RoboMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RoboMaker | RoboMakerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RoboMakerPaginationConfiguration, + ListWorldsCommandInput, + ListWorldsCommandOutput +>(RoboMakerClient, ListWorldsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-rolesanywhere/src/pagination/ListCrlsPaginator.ts b/clients/client-rolesanywhere/src/pagination/ListCrlsPaginator.ts index 49fef9a7d591..f41c0847c658 100644 --- a/clients/client-rolesanywhere/src/pagination/ListCrlsPaginator.ts +++ b/clients/client-rolesanywhere/src/pagination/ListCrlsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListCrlsCommand, ListCrlsCommandInput, ListCrlsCommandOutput } from "../commands/ListCrlsCommand"; import { RolesAnywhereClient } from "../RolesAnywhereClient"; import { RolesAnywherePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RolesAnywhereClient, - input: ListCrlsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCrlsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCrls( +export const paginateListCrls: ( config: RolesAnywherePaginationConfiguration, input: ListCrlsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCrlsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof RolesAnywhereClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RolesAnywhere | RolesAnywhereClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RolesAnywherePaginationConfiguration, + ListCrlsCommandInput, + ListCrlsCommandOutput +>(RolesAnywhereClient, ListCrlsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-rolesanywhere/src/pagination/ListProfilesPaginator.ts b/clients/client-rolesanywhere/src/pagination/ListProfilesPaginator.ts index d2b6cc3917dd..b31194d5d841 100644 --- a/clients/client-rolesanywhere/src/pagination/ListProfilesPaginator.ts +++ b/clients/client-rolesanywhere/src/pagination/ListProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { RolesAnywhereClient } from "../RolesAnywhereClient"; import { RolesAnywherePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RolesAnywhereClient, - input: ListProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProfiles( +export const paginateListProfiles: ( config: RolesAnywherePaginationConfiguration, input: ListProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProfilesCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof RolesAnywhereClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RolesAnywhere | RolesAnywhereClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RolesAnywherePaginationConfiguration, + ListProfilesCommandInput, + ListProfilesCommandOutput +>(RolesAnywhereClient, ListProfilesCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-rolesanywhere/src/pagination/ListSubjectsPaginator.ts b/clients/client-rolesanywhere/src/pagination/ListSubjectsPaginator.ts index bff30544efb0..329ad51527e6 100644 --- a/clients/client-rolesanywhere/src/pagination/ListSubjectsPaginator.ts +++ b/clients/client-rolesanywhere/src/pagination/ListSubjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { RolesAnywhereClient } from "../RolesAnywhereClient"; import { RolesAnywherePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RolesAnywhereClient, - input: ListSubjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSubjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSubjects( +export const paginateListSubjects: ( config: RolesAnywherePaginationConfiguration, input: ListSubjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSubjectsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof RolesAnywhereClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RolesAnywhere | RolesAnywhereClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RolesAnywherePaginationConfiguration, + ListSubjectsCommandInput, + ListSubjectsCommandOutput +>(RolesAnywhereClient, ListSubjectsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-rolesanywhere/src/pagination/ListTrustAnchorsPaginator.ts b/clients/client-rolesanywhere/src/pagination/ListTrustAnchorsPaginator.ts index 15229757727b..03e262b7b83c 100644 --- a/clients/client-rolesanywhere/src/pagination/ListTrustAnchorsPaginator.ts +++ b/clients/client-rolesanywhere/src/pagination/ListTrustAnchorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { RolesAnywhereClient } from "../RolesAnywhereClient"; import { RolesAnywherePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RolesAnywhereClient, - input: ListTrustAnchorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTrustAnchorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTrustAnchors( +export const paginateListTrustAnchors: ( config: RolesAnywherePaginationConfiguration, input: ListTrustAnchorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTrustAnchorsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof RolesAnywhereClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RolesAnywhere | RolesAnywhereClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RolesAnywherePaginationConfiguration, + ListTrustAnchorsCommandInput, + ListTrustAnchorsCommandOutput +>(RolesAnywhereClient, ListTrustAnchorsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-route-53-domains/package.json b/clients/client-route-53-domains/package.json index 42defa54e060..85502e508b0f 100644 --- a/clients/client-route-53-domains/package.json +++ b/clients/client-route-53-domains/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-route-53-domains/src/pagination/ListDomainsPaginator.ts b/clients/client-route-53-domains/src/pagination/ListDomainsPaginator.ts index 632ae1d14ad1..e316793eaf67 100644 --- a/clients/client-route-53-domains/src/pagination/ListDomainsPaginator.ts +++ b/clients/client-route-53-domains/src/pagination/ListDomainsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListDomainsCommand, ListDomainsCommandInput, ListDomainsCommandOutput } from "../commands/ListDomainsCommand"; import { Route53DomainsClient } from "../Route53DomainsClient"; import { Route53DomainsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53DomainsClient, - input: ListDomainsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomains( +export const paginateListDomains: ( config: Route53DomainsPaginationConfiguration, input: ListDomainsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof Route53DomainsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Domains | Route53DomainsClient"); - } - yield page; - const prevToken = token; - token = page.NextPageMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53DomainsPaginationConfiguration, + ListDomainsCommandInput, + ListDomainsCommandOutput +>(Route53DomainsClient, ListDomainsCommand, "Marker", "NextPageMarker", "MaxItems"); diff --git a/clients/client-route-53-domains/src/pagination/ListOperationsPaginator.ts b/clients/client-route-53-domains/src/pagination/ListOperationsPaginator.ts index a270dc744a03..66df2283caed 100644 --- a/clients/client-route-53-domains/src/pagination/ListOperationsPaginator.ts +++ b/clients/client-route-53-domains/src/pagination/ListOperationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53DomainsClient } from "../Route53DomainsClient"; import { Route53DomainsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53DomainsClient, - input: ListOperationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOperationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOperations( +export const paginateListOperations: ( config: Route53DomainsPaginationConfiguration, input: ListOperationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOperationsCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof Route53DomainsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Domains | Route53DomainsClient"); - } - yield page; - const prevToken = token; - token = page.NextPageMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53DomainsPaginationConfiguration, + ListOperationsCommandInput, + ListOperationsCommandOutput +>(Route53DomainsClient, ListOperationsCommand, "Marker", "NextPageMarker", "MaxItems"); diff --git a/clients/client-route-53-domains/src/pagination/ListPricesPaginator.ts b/clients/client-route-53-domains/src/pagination/ListPricesPaginator.ts index 7edf4c1d75e0..3b2b1cec6987 100644 --- a/clients/client-route-53-domains/src/pagination/ListPricesPaginator.ts +++ b/clients/client-route-53-domains/src/pagination/ListPricesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListPricesCommand, ListPricesCommandInput, ListPricesCommandOutput } from "../commands/ListPricesCommand"; import { Route53DomainsClient } from "../Route53DomainsClient"; import { Route53DomainsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53DomainsClient, - input: ListPricesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPricesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPrices( +export const paginateListPrices: ( config: Route53DomainsPaginationConfiguration, input: ListPricesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPricesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof Route53DomainsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Domains | Route53DomainsClient"); - } - yield page; - const prevToken = token; - token = page.NextPageMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53DomainsPaginationConfiguration, + ListPricesCommandInput, + ListPricesCommandOutput +>(Route53DomainsClient, ListPricesCommand, "Marker", "NextPageMarker", "MaxItems"); diff --git a/clients/client-route-53-domains/src/pagination/ViewBillingPaginator.ts b/clients/client-route-53-domains/src/pagination/ViewBillingPaginator.ts index ec0b04b0e45e..a2b527f286a8 100644 --- a/clients/client-route-53-domains/src/pagination/ViewBillingPaginator.ts +++ b/clients/client-route-53-domains/src/pagination/ViewBillingPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ViewBillingCommand, ViewBillingCommandInput, ViewBillingCommandOutput } from "../commands/ViewBillingCommand"; import { Route53DomainsClient } from "../Route53DomainsClient"; import { Route53DomainsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53DomainsClient, - input: ViewBillingCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ViewBillingCommand(input), ...args); -}; /** * @public */ -export async function* paginateViewBilling( +export const paginateViewBilling: ( config: Route53DomainsPaginationConfiguration, input: ViewBillingCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ViewBillingCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof Route53DomainsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Domains | Route53DomainsClient"); - } - yield page; - const prevToken = token; - token = page.NextPageMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53DomainsPaginationConfiguration, + ViewBillingCommandInput, + ViewBillingCommandOutput +>(Route53DomainsClient, ViewBillingCommand, "Marker", "NextPageMarker", "MaxItems"); diff --git a/clients/client-route-53/src/pagination/ListCidrBlocksPaginator.ts b/clients/client-route-53/src/pagination/ListCidrBlocksPaginator.ts index 3ea9015c83ff..e453bf0e6240 100644 --- a/clients/client-route-53/src/pagination/ListCidrBlocksPaginator.ts +++ b/clients/client-route-53/src/pagination/ListCidrBlocksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53Client } from "../Route53Client"; import { Route53PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53Client, - input: ListCidrBlocksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCidrBlocksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCidrBlocks( +export const paginateListCidrBlocks: ( config: Route53PaginationConfiguration, input: ListCidrBlocksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCidrBlocksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53 | Route53Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53PaginationConfiguration, + ListCidrBlocksCommandInput, + ListCidrBlocksCommandOutput +>(Route53Client, ListCidrBlocksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route-53/src/pagination/ListCidrCollectionsPaginator.ts b/clients/client-route-53/src/pagination/ListCidrCollectionsPaginator.ts index 4400cc0ff7cf..b6e49935f888 100644 --- a/clients/client-route-53/src/pagination/ListCidrCollectionsPaginator.ts +++ b/clients/client-route-53/src/pagination/ListCidrCollectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53Client } from "../Route53Client"; import { Route53PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53Client, - input: ListCidrCollectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCidrCollectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCidrCollections( +export const paginateListCidrCollections: ( config: Route53PaginationConfiguration, input: ListCidrCollectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCidrCollectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53 | Route53Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53PaginationConfiguration, + ListCidrCollectionsCommandInput, + ListCidrCollectionsCommandOutput +>(Route53Client, ListCidrCollectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route-53/src/pagination/ListCidrLocationsPaginator.ts b/clients/client-route-53/src/pagination/ListCidrLocationsPaginator.ts index eec64730a3e4..a3feff218ef5 100644 --- a/clients/client-route-53/src/pagination/ListCidrLocationsPaginator.ts +++ b/clients/client-route-53/src/pagination/ListCidrLocationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53Client } from "../Route53Client"; import { Route53PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53Client, - input: ListCidrLocationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCidrLocationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCidrLocations( +export const paginateListCidrLocations: ( config: Route53PaginationConfiguration, input: ListCidrLocationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCidrLocationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53 | Route53Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53PaginationConfiguration, + ListCidrLocationsCommandInput, + ListCidrLocationsCommandOutput +>(Route53Client, ListCidrLocationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route-53/src/pagination/ListHealthChecksPaginator.ts b/clients/client-route-53/src/pagination/ListHealthChecksPaginator.ts index 0ba72dc12fe4..4ffeb0f8413e 100644 --- a/clients/client-route-53/src/pagination/ListHealthChecksPaginator.ts +++ b/clients/client-route-53/src/pagination/ListHealthChecksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53Client } from "../Route53Client"; import { Route53PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53Client, - input: ListHealthChecksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHealthChecksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHealthChecks( +export const paginateListHealthChecks: ( config: Route53PaginationConfiguration, input: ListHealthChecksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHealthChecksCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof Route53Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53 | Route53Client"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53PaginationConfiguration, + ListHealthChecksCommandInput, + ListHealthChecksCommandOutput +>(Route53Client, ListHealthChecksCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-route-53/src/pagination/ListHostedZonesPaginator.ts b/clients/client-route-53/src/pagination/ListHostedZonesPaginator.ts index 3145f58b0cc0..fa75670d0c1b 100644 --- a/clients/client-route-53/src/pagination/ListHostedZonesPaginator.ts +++ b/clients/client-route-53/src/pagination/ListHostedZonesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53Client } from "../Route53Client"; import { Route53PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53Client, - input: ListHostedZonesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHostedZonesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHostedZones( +export const paginateListHostedZones: ( config: Route53PaginationConfiguration, input: ListHostedZonesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHostedZonesCommandOutput; - while (hasNext) { - input.Marker = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof Route53Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53 | Route53Client"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53PaginationConfiguration, + ListHostedZonesCommandInput, + ListHostedZonesCommandOutput +>(Route53Client, ListHostedZonesCommand, "Marker", "NextMarker", "MaxItems"); diff --git a/clients/client-route-53/src/pagination/ListQueryLoggingConfigsPaginator.ts b/clients/client-route-53/src/pagination/ListQueryLoggingConfigsPaginator.ts index 25e33f58996c..80a02b1e41e8 100644 --- a/clients/client-route-53/src/pagination/ListQueryLoggingConfigsPaginator.ts +++ b/clients/client-route-53/src/pagination/ListQueryLoggingConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53Client } from "../Route53Client"; import { Route53PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53Client, - input: ListQueryLoggingConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListQueryLoggingConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListQueryLoggingConfigs( +export const paginateListQueryLoggingConfigs: ( config: Route53PaginationConfiguration, input: ListQueryLoggingConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListQueryLoggingConfigsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53 | Route53Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53PaginationConfiguration, + ListQueryLoggingConfigsCommandInput, + ListQueryLoggingConfigsCommandOutput +>(Route53Client, ListQueryLoggingConfigsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-cluster/package.json b/clients/client-route53-recovery-cluster/package.json index 774372ec858d..114769b44a7f 100644 --- a/clients/client-route53-recovery-cluster/package.json +++ b/clients/client-route53-recovery-cluster/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-route53-recovery-cluster/src/pagination/ListRoutingControlsPaginator.ts b/clients/client-route53-recovery-cluster/src/pagination/ListRoutingControlsPaginator.ts index a60e3b6a40fb..c2e90e64eed3 100644 --- a/clients/client-route53-recovery-cluster/src/pagination/ListRoutingControlsPaginator.ts +++ b/clients/client-route53-recovery-cluster/src/pagination/ListRoutingControlsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53RecoveryClusterClient } from "../Route53RecoveryClusterClient"; import { Route53RecoveryClusterPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryClusterClient, - input: ListRoutingControlsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRoutingControlsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRoutingControls( +export const paginateListRoutingControls: ( config: Route53RecoveryClusterPaginationConfiguration, input: ListRoutingControlsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRoutingControlsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryClusterClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryCluster | Route53RecoveryClusterClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryClusterPaginationConfiguration, + ListRoutingControlsCommandInput, + ListRoutingControlsCommandOutput +>(Route53RecoveryClusterClient, ListRoutingControlsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-control-config/src/pagination/ListAssociatedRoute53HealthChecksPaginator.ts b/clients/client-route53-recovery-control-config/src/pagination/ListAssociatedRoute53HealthChecksPaginator.ts index 185b3eb2e379..39e554b1b875 100644 --- a/clients/client-route53-recovery-control-config/src/pagination/ListAssociatedRoute53HealthChecksPaginator.ts +++ b/clients/client-route53-recovery-control-config/src/pagination/ListAssociatedRoute53HealthChecksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53RecoveryControlConfigClient } from "../Route53RecoveryControlConfigClient"; import { Route53RecoveryControlConfigPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryControlConfigClient, - input: ListAssociatedRoute53HealthChecksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssociatedRoute53HealthChecksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssociatedRoute53HealthChecks( +export const paginateListAssociatedRoute53HealthChecks: ( config: Route53RecoveryControlConfigPaginationConfiguration, input: ListAssociatedRoute53HealthChecksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssociatedRoute53HealthChecksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryControlConfigClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryControlConfig | Route53RecoveryControlConfigClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryControlConfigPaginationConfiguration, + ListAssociatedRoute53HealthChecksCommandInput, + ListAssociatedRoute53HealthChecksCommandOutput +>(Route53RecoveryControlConfigClient, ListAssociatedRoute53HealthChecksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-control-config/src/pagination/ListClustersPaginator.ts b/clients/client-route53-recovery-control-config/src/pagination/ListClustersPaginator.ts index 9e4b1e3086f5..37f30fbfc99b 100644 --- a/clients/client-route53-recovery-control-config/src/pagination/ListClustersPaginator.ts +++ b/clients/client-route53-recovery-control-config/src/pagination/ListClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53RecoveryControlConfigClient } from "../Route53RecoveryControlConfigClient"; import { Route53RecoveryControlConfigPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryControlConfigClient, - input: ListClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClusters( +export const paginateListClusters: ( config: Route53RecoveryControlConfigPaginationConfiguration, input: ListClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClustersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryControlConfigClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryControlConfig | Route53RecoveryControlConfigClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryControlConfigPaginationConfiguration, + ListClustersCommandInput, + ListClustersCommandOutput +>(Route53RecoveryControlConfigClient, ListClustersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-control-config/src/pagination/ListControlPanelsPaginator.ts b/clients/client-route53-recovery-control-config/src/pagination/ListControlPanelsPaginator.ts index b19357f29776..64c926a1404b 100644 --- a/clients/client-route53-recovery-control-config/src/pagination/ListControlPanelsPaginator.ts +++ b/clients/client-route53-recovery-control-config/src/pagination/ListControlPanelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53RecoveryControlConfigClient } from "../Route53RecoveryControlConfigClient"; import { Route53RecoveryControlConfigPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryControlConfigClient, - input: ListControlPanelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListControlPanelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListControlPanels( +export const paginateListControlPanels: ( config: Route53RecoveryControlConfigPaginationConfiguration, input: ListControlPanelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListControlPanelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryControlConfigClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryControlConfig | Route53RecoveryControlConfigClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryControlConfigPaginationConfiguration, + ListControlPanelsCommandInput, + ListControlPanelsCommandOutput +>(Route53RecoveryControlConfigClient, ListControlPanelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-control-config/src/pagination/ListRoutingControlsPaginator.ts b/clients/client-route53-recovery-control-config/src/pagination/ListRoutingControlsPaginator.ts index 2b19a1d7b869..b9ffcb22daaa 100644 --- a/clients/client-route53-recovery-control-config/src/pagination/ListRoutingControlsPaginator.ts +++ b/clients/client-route53-recovery-control-config/src/pagination/ListRoutingControlsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53RecoveryControlConfigClient } from "../Route53RecoveryControlConfigClient"; import { Route53RecoveryControlConfigPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryControlConfigClient, - input: ListRoutingControlsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRoutingControlsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRoutingControls( +export const paginateListRoutingControls: ( config: Route53RecoveryControlConfigPaginationConfiguration, input: ListRoutingControlsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRoutingControlsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryControlConfigClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryControlConfig | Route53RecoveryControlConfigClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryControlConfigPaginationConfiguration, + ListRoutingControlsCommandInput, + ListRoutingControlsCommandOutput +>(Route53RecoveryControlConfigClient, ListRoutingControlsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-control-config/src/pagination/ListSafetyRulesPaginator.ts b/clients/client-route53-recovery-control-config/src/pagination/ListSafetyRulesPaginator.ts index ae8b8cd118e0..3d5f1e92b3a2 100644 --- a/clients/client-route53-recovery-control-config/src/pagination/ListSafetyRulesPaginator.ts +++ b/clients/client-route53-recovery-control-config/src/pagination/ListSafetyRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53RecoveryControlConfigClient } from "../Route53RecoveryControlConfigClient"; import { Route53RecoveryControlConfigPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryControlConfigClient, - input: ListSafetyRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSafetyRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSafetyRules( +export const paginateListSafetyRules: ( config: Route53RecoveryControlConfigPaginationConfiguration, input: ListSafetyRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSafetyRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryControlConfigClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryControlConfig | Route53RecoveryControlConfigClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryControlConfigPaginationConfiguration, + ListSafetyRulesCommandInput, + ListSafetyRulesCommandOutput +>(Route53RecoveryControlConfigClient, ListSafetyRulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-readiness/src/pagination/GetCellReadinessSummaryPaginator.ts b/clients/client-route53-recovery-readiness/src/pagination/GetCellReadinessSummaryPaginator.ts index 3571d008f4cd..be2ef4089e2c 100644 --- a/clients/client-route53-recovery-readiness/src/pagination/GetCellReadinessSummaryPaginator.ts +++ b/clients/client-route53-recovery-readiness/src/pagination/GetCellReadinessSummaryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53RecoveryReadinessClient } from "../Route53RecoveryReadinessClient"; import { Route53RecoveryReadinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryReadinessClient, - input: GetCellReadinessSummaryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCellReadinessSummaryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCellReadinessSummary( +export const paginateGetCellReadinessSummary: ( config: Route53RecoveryReadinessPaginationConfiguration, input: GetCellReadinessSummaryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCellReadinessSummaryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryReadinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryReadiness | Route53RecoveryReadinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryReadinessPaginationConfiguration, + GetCellReadinessSummaryCommandInput, + GetCellReadinessSummaryCommandOutput +>(Route53RecoveryReadinessClient, GetCellReadinessSummaryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-readiness/src/pagination/GetReadinessCheckResourceStatusPaginator.ts b/clients/client-route53-recovery-readiness/src/pagination/GetReadinessCheckResourceStatusPaginator.ts index 0dd455d18465..5a54dbbce857 100644 --- a/clients/client-route53-recovery-readiness/src/pagination/GetReadinessCheckResourceStatusPaginator.ts +++ b/clients/client-route53-recovery-readiness/src/pagination/GetReadinessCheckResourceStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53RecoveryReadinessClient } from "../Route53RecoveryReadinessClient"; import { Route53RecoveryReadinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryReadinessClient, - input: GetReadinessCheckResourceStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetReadinessCheckResourceStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetReadinessCheckResourceStatus( +export const paginateGetReadinessCheckResourceStatus: ( config: Route53RecoveryReadinessPaginationConfiguration, input: GetReadinessCheckResourceStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetReadinessCheckResourceStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryReadinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryReadiness | Route53RecoveryReadinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryReadinessPaginationConfiguration, + GetReadinessCheckResourceStatusCommandInput, + GetReadinessCheckResourceStatusCommandOutput +>(Route53RecoveryReadinessClient, GetReadinessCheckResourceStatusCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-readiness/src/pagination/GetReadinessCheckStatusPaginator.ts b/clients/client-route53-recovery-readiness/src/pagination/GetReadinessCheckStatusPaginator.ts index ac87ceb0b1ee..ef99a094b024 100644 --- a/clients/client-route53-recovery-readiness/src/pagination/GetReadinessCheckStatusPaginator.ts +++ b/clients/client-route53-recovery-readiness/src/pagination/GetReadinessCheckStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53RecoveryReadinessClient } from "../Route53RecoveryReadinessClient"; import { Route53RecoveryReadinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryReadinessClient, - input: GetReadinessCheckStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetReadinessCheckStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetReadinessCheckStatus( +export const paginateGetReadinessCheckStatus: ( config: Route53RecoveryReadinessPaginationConfiguration, input: GetReadinessCheckStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetReadinessCheckStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryReadinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryReadiness | Route53RecoveryReadinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryReadinessPaginationConfiguration, + GetReadinessCheckStatusCommandInput, + GetReadinessCheckStatusCommandOutput +>(Route53RecoveryReadinessClient, GetReadinessCheckStatusCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-readiness/src/pagination/GetRecoveryGroupReadinessSummaryPaginator.ts b/clients/client-route53-recovery-readiness/src/pagination/GetRecoveryGroupReadinessSummaryPaginator.ts index 9061bb7c556e..9828044aa402 100644 --- a/clients/client-route53-recovery-readiness/src/pagination/GetRecoveryGroupReadinessSummaryPaginator.ts +++ b/clients/client-route53-recovery-readiness/src/pagination/GetRecoveryGroupReadinessSummaryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53RecoveryReadinessClient } from "../Route53RecoveryReadinessClient"; import { Route53RecoveryReadinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryReadinessClient, - input: GetRecoveryGroupReadinessSummaryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetRecoveryGroupReadinessSummaryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetRecoveryGroupReadinessSummary( +export const paginateGetRecoveryGroupReadinessSummary: ( config: Route53RecoveryReadinessPaginationConfiguration, input: GetRecoveryGroupReadinessSummaryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetRecoveryGroupReadinessSummaryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryReadinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryReadiness | Route53RecoveryReadinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryReadinessPaginationConfiguration, + GetRecoveryGroupReadinessSummaryCommandInput, + GetRecoveryGroupReadinessSummaryCommandOutput +>(Route53RecoveryReadinessClient, GetRecoveryGroupReadinessSummaryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-readiness/src/pagination/ListCellsPaginator.ts b/clients/client-route53-recovery-readiness/src/pagination/ListCellsPaginator.ts index 3de76afad24d..0e21db816aa7 100644 --- a/clients/client-route53-recovery-readiness/src/pagination/ListCellsPaginator.ts +++ b/clients/client-route53-recovery-readiness/src/pagination/ListCellsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListCellsCommand, ListCellsCommandInput, ListCellsCommandOutput } from "../commands/ListCellsCommand"; import { Route53RecoveryReadinessClient } from "../Route53RecoveryReadinessClient"; import { Route53RecoveryReadinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryReadinessClient, - input: ListCellsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCellsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCells( +export const paginateListCells: ( config: Route53RecoveryReadinessPaginationConfiguration, input: ListCellsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCellsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryReadinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryReadiness | Route53RecoveryReadinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryReadinessPaginationConfiguration, + ListCellsCommandInput, + ListCellsCommandOutput +>(Route53RecoveryReadinessClient, ListCellsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-readiness/src/pagination/ListCrossAccountAuthorizationsPaginator.ts b/clients/client-route53-recovery-readiness/src/pagination/ListCrossAccountAuthorizationsPaginator.ts index aca0207c77a3..c09f913e4751 100644 --- a/clients/client-route53-recovery-readiness/src/pagination/ListCrossAccountAuthorizationsPaginator.ts +++ b/clients/client-route53-recovery-readiness/src/pagination/ListCrossAccountAuthorizationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53RecoveryReadinessClient } from "../Route53RecoveryReadinessClient"; import { Route53RecoveryReadinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryReadinessClient, - input: ListCrossAccountAuthorizationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCrossAccountAuthorizationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCrossAccountAuthorizations( +export const paginateListCrossAccountAuthorizations: ( config: Route53RecoveryReadinessPaginationConfiguration, input: ListCrossAccountAuthorizationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCrossAccountAuthorizationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryReadinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryReadiness | Route53RecoveryReadinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryReadinessPaginationConfiguration, + ListCrossAccountAuthorizationsCommandInput, + ListCrossAccountAuthorizationsCommandOutput +>(Route53RecoveryReadinessClient, ListCrossAccountAuthorizationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-readiness/src/pagination/ListReadinessChecksPaginator.ts b/clients/client-route53-recovery-readiness/src/pagination/ListReadinessChecksPaginator.ts index 3107deb81637..4c1775e6b828 100644 --- a/clients/client-route53-recovery-readiness/src/pagination/ListReadinessChecksPaginator.ts +++ b/clients/client-route53-recovery-readiness/src/pagination/ListReadinessChecksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53RecoveryReadinessClient } from "../Route53RecoveryReadinessClient"; import { Route53RecoveryReadinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryReadinessClient, - input: ListReadinessChecksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReadinessChecksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReadinessChecks( +export const paginateListReadinessChecks: ( config: Route53RecoveryReadinessPaginationConfiguration, input: ListReadinessChecksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReadinessChecksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryReadinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryReadiness | Route53RecoveryReadinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryReadinessPaginationConfiguration, + ListReadinessChecksCommandInput, + ListReadinessChecksCommandOutput +>(Route53RecoveryReadinessClient, ListReadinessChecksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-readiness/src/pagination/ListRecoveryGroupsPaginator.ts b/clients/client-route53-recovery-readiness/src/pagination/ListRecoveryGroupsPaginator.ts index 1c254f1bcdab..346fda50af24 100644 --- a/clients/client-route53-recovery-readiness/src/pagination/ListRecoveryGroupsPaginator.ts +++ b/clients/client-route53-recovery-readiness/src/pagination/ListRecoveryGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53RecoveryReadinessClient } from "../Route53RecoveryReadinessClient"; import { Route53RecoveryReadinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryReadinessClient, - input: ListRecoveryGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecoveryGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecoveryGroups( +export const paginateListRecoveryGroups: ( config: Route53RecoveryReadinessPaginationConfiguration, input: ListRecoveryGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecoveryGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryReadinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryReadiness | Route53RecoveryReadinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryReadinessPaginationConfiguration, + ListRecoveryGroupsCommandInput, + ListRecoveryGroupsCommandOutput +>(Route53RecoveryReadinessClient, ListRecoveryGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-readiness/src/pagination/ListResourceSetsPaginator.ts b/clients/client-route53-recovery-readiness/src/pagination/ListResourceSetsPaginator.ts index 1fdd32399909..bedee5d90f00 100644 --- a/clients/client-route53-recovery-readiness/src/pagination/ListResourceSetsPaginator.ts +++ b/clients/client-route53-recovery-readiness/src/pagination/ListResourceSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53RecoveryReadinessClient } from "../Route53RecoveryReadinessClient"; import { Route53RecoveryReadinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryReadinessClient, - input: ListResourceSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourceSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourceSets( +export const paginateListResourceSets: ( config: Route53RecoveryReadinessPaginationConfiguration, input: ListResourceSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourceSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryReadinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryReadiness | Route53RecoveryReadinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryReadinessPaginationConfiguration, + ListResourceSetsCommandInput, + ListResourceSetsCommandOutput +>(Route53RecoveryReadinessClient, ListResourceSetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53-recovery-readiness/src/pagination/ListRulesPaginator.ts b/clients/client-route53-recovery-readiness/src/pagination/ListRulesPaginator.ts index 4546e2550921..04cc71aff1c8 100644 --- a/clients/client-route53-recovery-readiness/src/pagination/ListRulesPaginator.ts +++ b/clients/client-route53-recovery-readiness/src/pagination/ListRulesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListRulesCommand, ListRulesCommandInput, ListRulesCommandOutput } from "../commands/ListRulesCommand"; import { Route53RecoveryReadinessClient } from "../Route53RecoveryReadinessClient"; import { Route53RecoveryReadinessPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53RecoveryReadinessClient, - input: ListRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRules( +export const paginateListRules: ( config: Route53RecoveryReadinessPaginationConfiguration, input: ListRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53RecoveryReadinessClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53RecoveryReadiness | Route53RecoveryReadinessClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53RecoveryReadinessPaginationConfiguration, + ListRulesCommandInput, + ListRulesCommandOutput +>(Route53RecoveryReadinessClient, ListRulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/package.json b/clients/client-route53resolver/package.json index f5d9f17472bf..c91279fa3871 100644 --- a/clients/client-route53resolver/package.json +++ b/clients/client-route53resolver/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-route53resolver/src/pagination/ListFirewallConfigsPaginator.ts b/clients/client-route53resolver/src/pagination/ListFirewallConfigsPaginator.ts index 917bf059720d..104216d27b2a 100644 --- a/clients/client-route53resolver/src/pagination/ListFirewallConfigsPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListFirewallConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListFirewallConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFirewallConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFirewallConfigs( +export const paginateListFirewallConfigs: ( config: Route53ResolverPaginationConfiguration, input: ListFirewallConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFirewallConfigsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListFirewallConfigsCommandInput, + ListFirewallConfigsCommandOutput +>(Route53ResolverClient, ListFirewallConfigsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListFirewallDomainListsPaginator.ts b/clients/client-route53resolver/src/pagination/ListFirewallDomainListsPaginator.ts index 7cc9b7194952..8dff334fa034 100644 --- a/clients/client-route53resolver/src/pagination/ListFirewallDomainListsPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListFirewallDomainListsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListFirewallDomainListsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFirewallDomainListsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFirewallDomainLists( +export const paginateListFirewallDomainLists: ( config: Route53ResolverPaginationConfiguration, input: ListFirewallDomainListsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFirewallDomainListsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListFirewallDomainListsCommandInput, + ListFirewallDomainListsCommandOutput +>(Route53ResolverClient, ListFirewallDomainListsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListFirewallDomainsPaginator.ts b/clients/client-route53resolver/src/pagination/ListFirewallDomainsPaginator.ts index 264edc34d41f..31708e402289 100644 --- a/clients/client-route53resolver/src/pagination/ListFirewallDomainsPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListFirewallDomainsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListFirewallDomainsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFirewallDomainsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFirewallDomains( +export const paginateListFirewallDomains: ( config: Route53ResolverPaginationConfiguration, input: ListFirewallDomainsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFirewallDomainsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListFirewallDomainsCommandInput, + ListFirewallDomainsCommandOutput +>(Route53ResolverClient, ListFirewallDomainsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListFirewallRuleGroupAssociationsPaginator.ts b/clients/client-route53resolver/src/pagination/ListFirewallRuleGroupAssociationsPaginator.ts index e628e11a7b50..74ed7fd0ffd7 100644 --- a/clients/client-route53resolver/src/pagination/ListFirewallRuleGroupAssociationsPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListFirewallRuleGroupAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListFirewallRuleGroupAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFirewallRuleGroupAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFirewallRuleGroupAssociations( +export const paginateListFirewallRuleGroupAssociations: ( config: Route53ResolverPaginationConfiguration, input: ListFirewallRuleGroupAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFirewallRuleGroupAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListFirewallRuleGroupAssociationsCommandInput, + ListFirewallRuleGroupAssociationsCommandOutput +>(Route53ResolverClient, ListFirewallRuleGroupAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListFirewallRuleGroupsPaginator.ts b/clients/client-route53resolver/src/pagination/ListFirewallRuleGroupsPaginator.ts index 440949cf8d1b..182d29aaa067 100644 --- a/clients/client-route53resolver/src/pagination/ListFirewallRuleGroupsPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListFirewallRuleGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListFirewallRuleGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFirewallRuleGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFirewallRuleGroups( +export const paginateListFirewallRuleGroups: ( config: Route53ResolverPaginationConfiguration, input: ListFirewallRuleGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFirewallRuleGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListFirewallRuleGroupsCommandInput, + ListFirewallRuleGroupsCommandOutput +>(Route53ResolverClient, ListFirewallRuleGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListFirewallRulesPaginator.ts b/clients/client-route53resolver/src/pagination/ListFirewallRulesPaginator.ts index b38ddab3f5a9..348c7c1e378e 100644 --- a/clients/client-route53resolver/src/pagination/ListFirewallRulesPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListFirewallRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListFirewallRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFirewallRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFirewallRules( +export const paginateListFirewallRules: ( config: Route53ResolverPaginationConfiguration, input: ListFirewallRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFirewallRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListFirewallRulesCommandInput, + ListFirewallRulesCommandOutput +>(Route53ResolverClient, ListFirewallRulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListOutpostResolversPaginator.ts b/clients/client-route53resolver/src/pagination/ListOutpostResolversPaginator.ts index 22777c7f5111..48b3738693ca 100644 --- a/clients/client-route53resolver/src/pagination/ListOutpostResolversPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListOutpostResolversPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListOutpostResolversCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOutpostResolversCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOutpostResolvers( +export const paginateListOutpostResolvers: ( config: Route53ResolverPaginationConfiguration, input: ListOutpostResolversCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOutpostResolversCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListOutpostResolversCommandInput, + ListOutpostResolversCommandOutput +>(Route53ResolverClient, ListOutpostResolversCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListResolverConfigsPaginator.ts b/clients/client-route53resolver/src/pagination/ListResolverConfigsPaginator.ts index 04e97615f99c..76d013256c2e 100644 --- a/clients/client-route53resolver/src/pagination/ListResolverConfigsPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListResolverConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListResolverConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResolverConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResolverConfigs( +export const paginateListResolverConfigs: ( config: Route53ResolverPaginationConfiguration, input: ListResolverConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResolverConfigsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListResolverConfigsCommandInput, + ListResolverConfigsCommandOutput +>(Route53ResolverClient, ListResolverConfigsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListResolverDnssecConfigsPaginator.ts b/clients/client-route53resolver/src/pagination/ListResolverDnssecConfigsPaginator.ts index ec48a849f27c..e941db5c6fc8 100644 --- a/clients/client-route53resolver/src/pagination/ListResolverDnssecConfigsPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListResolverDnssecConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListResolverDnssecConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResolverDnssecConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResolverDnssecConfigs( +export const paginateListResolverDnssecConfigs: ( config: Route53ResolverPaginationConfiguration, input: ListResolverDnssecConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResolverDnssecConfigsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListResolverDnssecConfigsCommandInput, + ListResolverDnssecConfigsCommandOutput +>(Route53ResolverClient, ListResolverDnssecConfigsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListResolverEndpointIpAddressesPaginator.ts b/clients/client-route53resolver/src/pagination/ListResolverEndpointIpAddressesPaginator.ts index f2dbc3536415..1cd393452427 100644 --- a/clients/client-route53resolver/src/pagination/ListResolverEndpointIpAddressesPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListResolverEndpointIpAddressesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListResolverEndpointIpAddressesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResolverEndpointIpAddressesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResolverEndpointIpAddresses( +export const paginateListResolverEndpointIpAddresses: ( config: Route53ResolverPaginationConfiguration, input: ListResolverEndpointIpAddressesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResolverEndpointIpAddressesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListResolverEndpointIpAddressesCommandInput, + ListResolverEndpointIpAddressesCommandOutput +>(Route53ResolverClient, ListResolverEndpointIpAddressesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListResolverEndpointsPaginator.ts b/clients/client-route53resolver/src/pagination/ListResolverEndpointsPaginator.ts index 2c7f50121faf..d2eb06cad008 100644 --- a/clients/client-route53resolver/src/pagination/ListResolverEndpointsPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListResolverEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListResolverEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResolverEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResolverEndpoints( +export const paginateListResolverEndpoints: ( config: Route53ResolverPaginationConfiguration, input: ListResolverEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResolverEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListResolverEndpointsCommandInput, + ListResolverEndpointsCommandOutput +>(Route53ResolverClient, ListResolverEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListResolverQueryLogConfigAssociationsPaginator.ts b/clients/client-route53resolver/src/pagination/ListResolverQueryLogConfigAssociationsPaginator.ts index 28a48311dd48..aae0328d7cca 100644 --- a/clients/client-route53resolver/src/pagination/ListResolverQueryLogConfigAssociationsPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListResolverQueryLogConfigAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListResolverQueryLogConfigAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResolverQueryLogConfigAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResolverQueryLogConfigAssociations( +export const paginateListResolverQueryLogConfigAssociations: ( config: Route53ResolverPaginationConfiguration, input: ListResolverQueryLogConfigAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResolverQueryLogConfigAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListResolverQueryLogConfigAssociationsCommandInput, + ListResolverQueryLogConfigAssociationsCommandOutput +>(Route53ResolverClient, ListResolverQueryLogConfigAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListResolverQueryLogConfigsPaginator.ts b/clients/client-route53resolver/src/pagination/ListResolverQueryLogConfigsPaginator.ts index 0b34471e6165..a21812d4af5c 100644 --- a/clients/client-route53resolver/src/pagination/ListResolverQueryLogConfigsPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListResolverQueryLogConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListResolverQueryLogConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResolverQueryLogConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResolverQueryLogConfigs( +export const paginateListResolverQueryLogConfigs: ( config: Route53ResolverPaginationConfiguration, input: ListResolverQueryLogConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResolverQueryLogConfigsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListResolverQueryLogConfigsCommandInput, + ListResolverQueryLogConfigsCommandOutput +>(Route53ResolverClient, ListResolverQueryLogConfigsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListResolverRuleAssociationsPaginator.ts b/clients/client-route53resolver/src/pagination/ListResolverRuleAssociationsPaginator.ts index 45b6800f9547..8678c6b917f9 100644 --- a/clients/client-route53resolver/src/pagination/ListResolverRuleAssociationsPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListResolverRuleAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListResolverRuleAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResolverRuleAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResolverRuleAssociations( +export const paginateListResolverRuleAssociations: ( config: Route53ResolverPaginationConfiguration, input: ListResolverRuleAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResolverRuleAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListResolverRuleAssociationsCommandInput, + ListResolverRuleAssociationsCommandOutput +>(Route53ResolverClient, ListResolverRuleAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListResolverRulesPaginator.ts b/clients/client-route53resolver/src/pagination/ListResolverRulesPaginator.ts index eadddbdfa844..5e17c68bf3e9 100644 --- a/clients/client-route53resolver/src/pagination/ListResolverRulesPaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListResolverRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListResolverRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResolverRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResolverRules( +export const paginateListResolverRules: ( config: Route53ResolverPaginationConfiguration, input: ListResolverRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResolverRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListResolverRulesCommandInput, + ListResolverRulesCommandOutput +>(Route53ResolverClient, ListResolverRulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-route53resolver/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-route53resolver/src/pagination/ListTagsForResourcePaginator.ts index 8f78a0bd4827..afabfc59477f 100644 --- a/clients/client-route53resolver/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-route53resolver/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { Route53ResolverClient } from "../Route53ResolverClient"; import { Route53ResolverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: Route53ResolverClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: Route53ResolverPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof Route53ResolverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Route53Resolver | Route53ResolverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + Route53ResolverPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(Route53ResolverClient, ListTagsForResourceCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rum/src/pagination/BatchGetRumMetricDefinitionsPaginator.ts b/clients/client-rum/src/pagination/BatchGetRumMetricDefinitionsPaginator.ts index a46eb1b069ad..060900debbe8 100644 --- a/clients/client-rum/src/pagination/BatchGetRumMetricDefinitionsPaginator.ts +++ b/clients/client-rum/src/pagination/BatchGetRumMetricDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RUMClient } from "../RUMClient"; import { RUMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RUMClient, - input: BatchGetRumMetricDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new BatchGetRumMetricDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateBatchGetRumMetricDefinitions( +export const paginateBatchGetRumMetricDefinitions: ( config: RUMPaginationConfiguration, input: BatchGetRumMetricDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: BatchGetRumMetricDefinitionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RUMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RUM | RUMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RUMPaginationConfiguration, + BatchGetRumMetricDefinitionsCommandInput, + BatchGetRumMetricDefinitionsCommandOutput +>(RUMClient, BatchGetRumMetricDefinitionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rum/src/pagination/GetAppMonitorDataPaginator.ts b/clients/client-rum/src/pagination/GetAppMonitorDataPaginator.ts index 1ba89cd2bc76..f0f8deda0108 100644 --- a/clients/client-rum/src/pagination/GetAppMonitorDataPaginator.ts +++ b/clients/client-rum/src/pagination/GetAppMonitorDataPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RUMClient } from "../RUMClient"; import { RUMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RUMClient, - input: GetAppMonitorDataCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetAppMonitorDataCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetAppMonitorData( +export const paginateGetAppMonitorData: ( config: RUMPaginationConfiguration, input: GetAppMonitorDataCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetAppMonitorDataCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RUMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RUM | RUMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RUMPaginationConfiguration, + GetAppMonitorDataCommandInput, + GetAppMonitorDataCommandOutput +>(RUMClient, GetAppMonitorDataCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rum/src/pagination/ListAppMonitorsPaginator.ts b/clients/client-rum/src/pagination/ListAppMonitorsPaginator.ts index c136ea88d73a..8d09c983cb76 100644 --- a/clients/client-rum/src/pagination/ListAppMonitorsPaginator.ts +++ b/clients/client-rum/src/pagination/ListAppMonitorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RUMClient } from "../RUMClient"; import { RUMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RUMClient, - input: ListAppMonitorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppMonitorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppMonitors( +export const paginateListAppMonitors: ( config: RUMPaginationConfiguration, input: ListAppMonitorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppMonitorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RUMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RUM | RUMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RUMPaginationConfiguration, + ListAppMonitorsCommandInput, + ListAppMonitorsCommandOutput +>(RUMClient, ListAppMonitorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-rum/src/pagination/ListRumMetricsDestinationsPaginator.ts b/clients/client-rum/src/pagination/ListRumMetricsDestinationsPaginator.ts index 4bd8d64ca1f7..a86dc595b634 100644 --- a/clients/client-rum/src/pagination/ListRumMetricsDestinationsPaginator.ts +++ b/clients/client-rum/src/pagination/ListRumMetricsDestinationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { RUMClient } from "../RUMClient"; import { RUMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: RUMClient, - input: ListRumMetricsDestinationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRumMetricsDestinationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRumMetricsDestinations( +export const paginateListRumMetricsDestinations: ( config: RUMPaginationConfiguration, input: ListRumMetricsDestinationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRumMetricsDestinationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof RUMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected RUM | RUMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + RUMPaginationConfiguration, + ListRumMetricsDestinationsCommandInput, + ListRumMetricsDestinationsCommandOutput +>(RUMClient, ListRumMetricsDestinationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-s3-control/src/pagination/ListAccessGrantsInstancesPaginator.ts b/clients/client-s3-control/src/pagination/ListAccessGrantsInstancesPaginator.ts index 446115581bf4..68d3c01bf0fd 100644 --- a/clients/client-s3-control/src/pagination/ListAccessGrantsInstancesPaginator.ts +++ b/clients/client-s3-control/src/pagination/ListAccessGrantsInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { S3ControlClient } from "../S3ControlClient"; import { S3ControlPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3ControlClient, - input: ListAccessGrantsInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessGrantsInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessGrantsInstances( +export const paginateListAccessGrantsInstances: ( config: S3ControlPaginationConfiguration, input: ListAccessGrantsInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessGrantsInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof S3ControlClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3Control | S3ControlClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3ControlPaginationConfiguration, + ListAccessGrantsInstancesCommandInput, + ListAccessGrantsInstancesCommandOutput +>(S3ControlClient, ListAccessGrantsInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-s3-control/src/pagination/ListAccessGrantsLocationsPaginator.ts b/clients/client-s3-control/src/pagination/ListAccessGrantsLocationsPaginator.ts index d5e151f123ca..276f46a74923 100644 --- a/clients/client-s3-control/src/pagination/ListAccessGrantsLocationsPaginator.ts +++ b/clients/client-s3-control/src/pagination/ListAccessGrantsLocationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { S3ControlClient } from "../S3ControlClient"; import { S3ControlPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3ControlClient, - input: ListAccessGrantsLocationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessGrantsLocationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessGrantsLocations( +export const paginateListAccessGrantsLocations: ( config: S3ControlPaginationConfiguration, input: ListAccessGrantsLocationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessGrantsLocationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof S3ControlClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3Control | S3ControlClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3ControlPaginationConfiguration, + ListAccessGrantsLocationsCommandInput, + ListAccessGrantsLocationsCommandOutput +>(S3ControlClient, ListAccessGrantsLocationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-s3-control/src/pagination/ListAccessGrantsPaginator.ts b/clients/client-s3-control/src/pagination/ListAccessGrantsPaginator.ts index 9846f1cc8961..1eb347058cd0 100644 --- a/clients/client-s3-control/src/pagination/ListAccessGrantsPaginator.ts +++ b/clients/client-s3-control/src/pagination/ListAccessGrantsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { S3ControlClient } from "../S3ControlClient"; import { S3ControlPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3ControlClient, - input: ListAccessGrantsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessGrantsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessGrants( +export const paginateListAccessGrants: ( config: S3ControlPaginationConfiguration, input: ListAccessGrantsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessGrantsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof S3ControlClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3Control | S3ControlClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3ControlPaginationConfiguration, + ListAccessGrantsCommandInput, + ListAccessGrantsCommandOutput +>(S3ControlClient, ListAccessGrantsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-s3-control/src/pagination/ListAccessPointsForObjectLambdaPaginator.ts b/clients/client-s3-control/src/pagination/ListAccessPointsForObjectLambdaPaginator.ts index c9e34cb89b72..b4baf752caec 100644 --- a/clients/client-s3-control/src/pagination/ListAccessPointsForObjectLambdaPaginator.ts +++ b/clients/client-s3-control/src/pagination/ListAccessPointsForObjectLambdaPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { S3ControlClient } from "../S3ControlClient"; import { S3ControlPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3ControlClient, - input: ListAccessPointsForObjectLambdaCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessPointsForObjectLambdaCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessPointsForObjectLambda( +export const paginateListAccessPointsForObjectLambda: ( config: S3ControlPaginationConfiguration, input: ListAccessPointsForObjectLambdaCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessPointsForObjectLambdaCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof S3ControlClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3Control | S3ControlClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3ControlPaginationConfiguration, + ListAccessPointsForObjectLambdaCommandInput, + ListAccessPointsForObjectLambdaCommandOutput +>(S3ControlClient, ListAccessPointsForObjectLambdaCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-s3-control/src/pagination/ListAccessPointsPaginator.ts b/clients/client-s3-control/src/pagination/ListAccessPointsPaginator.ts index dad381bf87d4..b89d6bf48127 100644 --- a/clients/client-s3-control/src/pagination/ListAccessPointsPaginator.ts +++ b/clients/client-s3-control/src/pagination/ListAccessPointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { S3ControlClient } from "../S3ControlClient"; import { S3ControlPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3ControlClient, - input: ListAccessPointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessPointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessPoints( +export const paginateListAccessPoints: ( config: S3ControlPaginationConfiguration, input: ListAccessPointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessPointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof S3ControlClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3Control | S3ControlClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3ControlPaginationConfiguration, + ListAccessPointsCommandInput, + ListAccessPointsCommandOutput +>(S3ControlClient, ListAccessPointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-s3-control/src/pagination/ListJobsPaginator.ts b/clients/client-s3-control/src/pagination/ListJobsPaginator.ts index f5b7d8a62950..7e4f8b699f7a 100644 --- a/clients/client-s3-control/src/pagination/ListJobsPaginator.ts +++ b/clients/client-s3-control/src/pagination/ListJobsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListJobsCommand, ListJobsCommandInput, ListJobsCommandOutput } from "../commands/ListJobsCommand"; import { S3ControlClient } from "../S3ControlClient"; import { S3ControlPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3ControlClient, - input: ListJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobs( +export const paginateListJobs: ( config: S3ControlPaginationConfiguration, input: ListJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof S3ControlClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3Control | S3ControlClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3ControlPaginationConfiguration, + ListJobsCommandInput, + ListJobsCommandOutput +>(S3ControlClient, ListJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-s3-control/src/pagination/ListMultiRegionAccessPointsPaginator.ts b/clients/client-s3-control/src/pagination/ListMultiRegionAccessPointsPaginator.ts index 1d618b548b66..593ac9a06ac4 100644 --- a/clients/client-s3-control/src/pagination/ListMultiRegionAccessPointsPaginator.ts +++ b/clients/client-s3-control/src/pagination/ListMultiRegionAccessPointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { S3ControlClient } from "../S3ControlClient"; import { S3ControlPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3ControlClient, - input: ListMultiRegionAccessPointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMultiRegionAccessPointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMultiRegionAccessPoints( +export const paginateListMultiRegionAccessPoints: ( config: S3ControlPaginationConfiguration, input: ListMultiRegionAccessPointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMultiRegionAccessPointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof S3ControlClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3Control | S3ControlClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3ControlPaginationConfiguration, + ListMultiRegionAccessPointsCommandInput, + ListMultiRegionAccessPointsCommandOutput +>(S3ControlClient, ListMultiRegionAccessPointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-s3-control/src/pagination/ListRegionalBucketsPaginator.ts b/clients/client-s3-control/src/pagination/ListRegionalBucketsPaginator.ts index 73fa2c6f3057..ee6582389389 100644 --- a/clients/client-s3-control/src/pagination/ListRegionalBucketsPaginator.ts +++ b/clients/client-s3-control/src/pagination/ListRegionalBucketsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { S3ControlClient } from "../S3ControlClient"; import { S3ControlPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3ControlClient, - input: ListRegionalBucketsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRegionalBucketsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRegionalBuckets( +export const paginateListRegionalBuckets: ( config: S3ControlPaginationConfiguration, input: ListRegionalBucketsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRegionalBucketsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof S3ControlClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3Control | S3ControlClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3ControlPaginationConfiguration, + ListRegionalBucketsCommandInput, + ListRegionalBucketsCommandOutput +>(S3ControlClient, ListRegionalBucketsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-s3-control/src/pagination/ListStorageLensConfigurationsPaginator.ts b/clients/client-s3-control/src/pagination/ListStorageLensConfigurationsPaginator.ts index da910fbb873c..1909096b83c5 100644 --- a/clients/client-s3-control/src/pagination/ListStorageLensConfigurationsPaginator.ts +++ b/clients/client-s3-control/src/pagination/ListStorageLensConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { S3ControlClient } from "../S3ControlClient"; import { S3ControlPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3ControlClient, - input: ListStorageLensConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStorageLensConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStorageLensConfigurations( +export const paginateListStorageLensConfigurations: ( config: S3ControlPaginationConfiguration, input: ListStorageLensConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStorageLensConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof S3ControlClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3Control | S3ControlClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3ControlPaginationConfiguration, + ListStorageLensConfigurationsCommandInput, + ListStorageLensConfigurationsCommandOutput +>(S3ControlClient, ListStorageLensConfigurationsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-s3-control/src/pagination/ListStorageLensGroupsPaginator.ts b/clients/client-s3-control/src/pagination/ListStorageLensGroupsPaginator.ts index 66866c18106d..c54d88a1e4b2 100644 --- a/clients/client-s3-control/src/pagination/ListStorageLensGroupsPaginator.ts +++ b/clients/client-s3-control/src/pagination/ListStorageLensGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { S3ControlClient } from "../S3ControlClient"; import { S3ControlPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3ControlClient, - input: ListStorageLensGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStorageLensGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStorageLensGroups( +export const paginateListStorageLensGroups: ( config: S3ControlPaginationConfiguration, input: ListStorageLensGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStorageLensGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof S3ControlClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3Control | S3ControlClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3ControlPaginationConfiguration, + ListStorageLensGroupsCommandInput, + ListStorageLensGroupsCommandOutput +>(S3ControlClient, ListStorageLensGroupsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-s3/src/pagination/ListDirectoryBucketsPaginator.ts b/clients/client-s3/src/pagination/ListDirectoryBucketsPaginator.ts index f4342b8c8c7b..2022a85a63a5 100644 --- a/clients/client-s3/src/pagination/ListDirectoryBucketsPaginator.ts +++ b/clients/client-s3/src/pagination/ListDirectoryBucketsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { S3Client } from "../S3Client"; import { S3PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3Client, - input: ListDirectoryBucketsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDirectoryBucketsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDirectoryBuckets( +export const paginateListDirectoryBuckets: ( config: S3PaginationConfiguration, input: ListDirectoryBucketsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.ContinuationToken - let token: typeof input.ContinuationToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDirectoryBucketsCommandOutput; - while (hasNext) { - input.ContinuationToken = token; - input["MaxDirectoryBuckets"] = config.pageSize; - if (config.client instanceof S3Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3 | S3Client"); - } - yield page; - const prevToken = token; - token = page.ContinuationToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3PaginationConfiguration, + ListDirectoryBucketsCommandInput, + ListDirectoryBucketsCommandOutput +>(S3Client, ListDirectoryBucketsCommand, "ContinuationToken", "ContinuationToken", "MaxDirectoryBuckets"); diff --git a/clients/client-s3/src/pagination/ListObjectsV2Paginator.ts b/clients/client-s3/src/pagination/ListObjectsV2Paginator.ts index 9d94a82ba762..75a6827f4f53 100644 --- a/clients/client-s3/src/pagination/ListObjectsV2Paginator.ts +++ b/clients/client-s3/src/pagination/ListObjectsV2Paginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { S3Client } from "../S3Client"; import { S3PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3Client, - input: ListObjectsV2CommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListObjectsV2Command(input), ...args); -}; /** * @public */ -export async function* paginateListObjectsV2( +export const paginateListObjectsV2: ( config: S3PaginationConfiguration, input: ListObjectsV2CommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.ContinuationToken - let token: typeof input.ContinuationToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListObjectsV2CommandOutput; - while (hasNext) { - input.ContinuationToken = token; - input["MaxKeys"] = config.pageSize; - if (config.client instanceof S3Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3 | S3Client"); - } - yield page; - const prevToken = token; - token = page.NextContinuationToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3PaginationConfiguration, + ListObjectsV2CommandInput, + ListObjectsV2CommandOutput +>(S3Client, ListObjectsV2Command, "ContinuationToken", "NextContinuationToken", "MaxKeys"); diff --git a/clients/client-s3/src/pagination/ListPartsPaginator.ts b/clients/client-s3/src/pagination/ListPartsPaginator.ts index 63b036c44e89..83d8be56865e 100644 --- a/clients/client-s3/src/pagination/ListPartsPaginator.ts +++ b/clients/client-s3/src/pagination/ListPartsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListPartsCommand, ListPartsCommandInput, ListPartsCommandOutput } from "../commands/ListPartsCommand"; import { S3Client } from "../S3Client"; import { S3PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3Client, - input: ListPartsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPartsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListParts( +export const paginateListParts: ( config: S3PaginationConfiguration, input: ListPartsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PartNumberMarker - let token: typeof input.PartNumberMarker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPartsCommandOutput; - while (hasNext) { - input.PartNumberMarker = token; - input["MaxParts"] = config.pageSize; - if (config.client instanceof S3Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3 | S3Client"); - } - yield page; - const prevToken = token; - token = page.NextPartNumberMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3PaginationConfiguration, + ListPartsCommandInput, + ListPartsCommandOutput +>(S3Client, ListPartsCommand, "PartNumberMarker", "NextPartNumberMarker", "MaxParts"); diff --git a/clients/client-s3outposts/src/pagination/ListEndpointsPaginator.ts b/clients/client-s3outposts/src/pagination/ListEndpointsPaginator.ts index 58d571eb915a..31a673b4cc32 100644 --- a/clients/client-s3outposts/src/pagination/ListEndpointsPaginator.ts +++ b/clients/client-s3outposts/src/pagination/ListEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { S3OutpostsClient } from "../S3OutpostsClient"; import { S3OutpostsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3OutpostsClient, - input: ListEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEndpoints( +export const paginateListEndpoints: ( config: S3OutpostsPaginationConfiguration, input: ListEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof S3OutpostsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3Outposts | S3OutpostsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3OutpostsPaginationConfiguration, + ListEndpointsCommandInput, + ListEndpointsCommandOutput +>(S3OutpostsClient, ListEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-s3outposts/src/pagination/ListOutpostsWithS3Paginator.ts b/clients/client-s3outposts/src/pagination/ListOutpostsWithS3Paginator.ts index b042ad2606bb..7ac5098c71c2 100644 --- a/clients/client-s3outposts/src/pagination/ListOutpostsWithS3Paginator.ts +++ b/clients/client-s3outposts/src/pagination/ListOutpostsWithS3Paginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { S3OutpostsClient } from "../S3OutpostsClient"; import { S3OutpostsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3OutpostsClient, - input: ListOutpostsWithS3CommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOutpostsWithS3Command(input), ...args); -}; /** * @public */ -export async function* paginateListOutpostsWithS3( +export const paginateListOutpostsWithS3: ( config: S3OutpostsPaginationConfiguration, input: ListOutpostsWithS3CommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOutpostsWithS3CommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof S3OutpostsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3Outposts | S3OutpostsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3OutpostsPaginationConfiguration, + ListOutpostsWithS3CommandInput, + ListOutpostsWithS3CommandOutput +>(S3OutpostsClient, ListOutpostsWithS3Command, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-s3outposts/src/pagination/ListSharedEndpointsPaginator.ts b/clients/client-s3outposts/src/pagination/ListSharedEndpointsPaginator.ts index 7b889773b485..7346186381c1 100644 --- a/clients/client-s3outposts/src/pagination/ListSharedEndpointsPaginator.ts +++ b/clients/client-s3outposts/src/pagination/ListSharedEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { S3OutpostsClient } from "../S3OutpostsClient"; import { S3OutpostsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: S3OutpostsClient, - input: ListSharedEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSharedEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSharedEndpoints( +export const paginateListSharedEndpoints: ( config: S3OutpostsPaginationConfiguration, input: ListSharedEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSharedEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof S3OutpostsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected S3Outposts | S3OutpostsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + S3OutpostsPaginationConfiguration, + ListSharedEndpointsCommandInput, + ListSharedEndpointsCommandOutput +>(S3OutpostsClient, ListSharedEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker-a2i-runtime/src/pagination/ListHumanLoopsPaginator.ts b/clients/client-sagemaker-a2i-runtime/src/pagination/ListHumanLoopsPaginator.ts index 31615ebc7a1a..77c31e5ffa08 100644 --- a/clients/client-sagemaker-a2i-runtime/src/pagination/ListHumanLoopsPaginator.ts +++ b/clients/client-sagemaker-a2i-runtime/src/pagination/ListHumanLoopsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerA2IRuntimeClient } from "../SageMakerA2IRuntimeClient"; import { SageMakerA2IRuntimePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerA2IRuntimeClient, - input: ListHumanLoopsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHumanLoopsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHumanLoops( +export const paginateListHumanLoops: ( config: SageMakerA2IRuntimePaginationConfiguration, input: ListHumanLoopsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHumanLoopsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerA2IRuntimeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMakerA2IRuntime | SageMakerA2IRuntimeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerA2IRuntimePaginationConfiguration, + ListHumanLoopsCommandInput, + ListHumanLoopsCommandOutput +>(SageMakerA2IRuntimeClient, ListHumanLoopsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker-geospatial/src/pagination/ListEarthObservationJobsPaginator.ts b/clients/client-sagemaker-geospatial/src/pagination/ListEarthObservationJobsPaginator.ts index b4bcd20ed280..8fdda1e1ac11 100644 --- a/clients/client-sagemaker-geospatial/src/pagination/ListEarthObservationJobsPaginator.ts +++ b/clients/client-sagemaker-geospatial/src/pagination/ListEarthObservationJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SageMakerGeospatialClient } from "../SageMakerGeospatialClient"; import { SageMakerGeospatialPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerGeospatialClient, - input: ListEarthObservationJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEarthObservationJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEarthObservationJobs( +export const paginateListEarthObservationJobs: ( config: SageMakerGeospatialPaginationConfiguration, input: ListEarthObservationJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEarthObservationJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof SageMakerGeospatialClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMakerGeospatial | SageMakerGeospatialClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerGeospatialPaginationConfiguration, + ListEarthObservationJobsCommandInput, + ListEarthObservationJobsCommandOutput +>(SageMakerGeospatialClient, ListEarthObservationJobsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-sagemaker-geospatial/src/pagination/ListRasterDataCollectionsPaginator.ts b/clients/client-sagemaker-geospatial/src/pagination/ListRasterDataCollectionsPaginator.ts index 8625fc427bf1..b44d9f8bf943 100644 --- a/clients/client-sagemaker-geospatial/src/pagination/ListRasterDataCollectionsPaginator.ts +++ b/clients/client-sagemaker-geospatial/src/pagination/ListRasterDataCollectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SageMakerGeospatialClient } from "../SageMakerGeospatialClient"; import { SageMakerGeospatialPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerGeospatialClient, - input: ListRasterDataCollectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRasterDataCollectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRasterDataCollections( +export const paginateListRasterDataCollections: ( config: SageMakerGeospatialPaginationConfiguration, input: ListRasterDataCollectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRasterDataCollectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof SageMakerGeospatialClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMakerGeospatial | SageMakerGeospatialClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerGeospatialPaginationConfiguration, + ListRasterDataCollectionsCommandInput, + ListRasterDataCollectionsCommandOutput +>(SageMakerGeospatialClient, ListRasterDataCollectionsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-sagemaker-geospatial/src/pagination/ListVectorEnrichmentJobsPaginator.ts b/clients/client-sagemaker-geospatial/src/pagination/ListVectorEnrichmentJobsPaginator.ts index dffc5754ca74..f55630b6b26e 100644 --- a/clients/client-sagemaker-geospatial/src/pagination/ListVectorEnrichmentJobsPaginator.ts +++ b/clients/client-sagemaker-geospatial/src/pagination/ListVectorEnrichmentJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SageMakerGeospatialClient } from "../SageMakerGeospatialClient"; import { SageMakerGeospatialPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerGeospatialClient, - input: ListVectorEnrichmentJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVectorEnrichmentJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVectorEnrichmentJobs( +export const paginateListVectorEnrichmentJobs: ( config: SageMakerGeospatialPaginationConfiguration, input: ListVectorEnrichmentJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVectorEnrichmentJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof SageMakerGeospatialClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMakerGeospatial | SageMakerGeospatialClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerGeospatialPaginationConfiguration, + ListVectorEnrichmentJobsCommandInput, + ListVectorEnrichmentJobsCommandOutput +>(SageMakerGeospatialClient, ListVectorEnrichmentJobsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-sagemaker-geospatial/src/pagination/SearchRasterDataCollectionPaginator.ts b/clients/client-sagemaker-geospatial/src/pagination/SearchRasterDataCollectionPaginator.ts index c4ee030b032a..9482e42cfe7d 100644 --- a/clients/client-sagemaker-geospatial/src/pagination/SearchRasterDataCollectionPaginator.ts +++ b/clients/client-sagemaker-geospatial/src/pagination/SearchRasterDataCollectionPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SageMakerGeospatialClient } from "../SageMakerGeospatialClient"; import { SageMakerGeospatialPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerGeospatialClient, - input: SearchRasterDataCollectionCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchRasterDataCollectionCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchRasterDataCollection( +export const paginateSearchRasterDataCollection: ( config: SageMakerGeospatialPaginationConfiguration, input: SearchRasterDataCollectionCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchRasterDataCollectionCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof SageMakerGeospatialClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMakerGeospatial | SageMakerGeospatialClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerGeospatialPaginationConfiguration, + SearchRasterDataCollectionCommandInput, + SearchRasterDataCollectionCommandOutput +>(SageMakerGeospatialClient, SearchRasterDataCollectionCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-sagemaker/package.json b/clients/client-sagemaker/package.json index c612661fe71b..107ed4b569ad 100644 --- a/clients/client-sagemaker/package.json +++ b/clients/client-sagemaker/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-sagemaker/src/pagination/ListActionsPaginator.ts b/clients/client-sagemaker/src/pagination/ListActionsPaginator.ts index 69ec2d807c84..3a9685ddd8df 100644 --- a/clients/client-sagemaker/src/pagination/ListActionsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListActionsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListActionsCommand, ListActionsCommandInput, ListActionsCommandOutput } from "../commands/ListActionsCommand"; import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListActions( +export const paginateListActions: ( config: SageMakerPaginationConfiguration, input: ListActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListActionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListActionsCommandInput, + ListActionsCommandOutput +>(SageMakerClient, ListActionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListAlgorithmsPaginator.ts b/clients/client-sagemaker/src/pagination/ListAlgorithmsPaginator.ts index c7631a935f33..ec1f4342fbee 100644 --- a/clients/client-sagemaker/src/pagination/ListAlgorithmsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListAlgorithmsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListAlgorithmsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAlgorithmsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAlgorithms( +export const paginateListAlgorithms: ( config: SageMakerPaginationConfiguration, input: ListAlgorithmsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAlgorithmsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListAlgorithmsCommandInput, + ListAlgorithmsCommandOutput +>(SageMakerClient, ListAlgorithmsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListAliasesPaginator.ts b/clients/client-sagemaker/src/pagination/ListAliasesPaginator.ts index d5f8312a7679..9517c62ef2bb 100644 --- a/clients/client-sagemaker/src/pagination/ListAliasesPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListAliasesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAliasesCommand, ListAliasesCommandInput, ListAliasesCommandOutput } from "../commands/ListAliasesCommand"; import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListAliasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAliasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAliases( +export const paginateListAliases: ( config: SageMakerPaginationConfiguration, input: ListAliasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAliasesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListAliasesCommandInput, + ListAliasesCommandOutput +>(SageMakerClient, ListAliasesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListAppImageConfigsPaginator.ts b/clients/client-sagemaker/src/pagination/ListAppImageConfigsPaginator.ts index 73a0dc025517..73a35a926efa 100644 --- a/clients/client-sagemaker/src/pagination/ListAppImageConfigsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListAppImageConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListAppImageConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppImageConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAppImageConfigs( +export const paginateListAppImageConfigs: ( config: SageMakerPaginationConfiguration, input: ListAppImageConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppImageConfigsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListAppImageConfigsCommandInput, + ListAppImageConfigsCommandOutput +>(SageMakerClient, ListAppImageConfigsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListAppsPaginator.ts b/clients/client-sagemaker/src/pagination/ListAppsPaginator.ts index a15b8f7f1340..dcccd708d89e 100644 --- a/clients/client-sagemaker/src/pagination/ListAppsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListAppsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAppsCommand, ListAppsCommandInput, ListAppsCommandOutput } from "../commands/ListAppsCommand"; import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListAppsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApps( +export const paginateListApps: ( config: SageMakerPaginationConfiguration, input: ListAppsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListAppsCommandInput, + ListAppsCommandOutput +>(SageMakerClient, ListAppsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListArtifactsPaginator.ts b/clients/client-sagemaker/src/pagination/ListArtifactsPaginator.ts index c3c5dfeada7e..2ec912aa8559 100644 --- a/clients/client-sagemaker/src/pagination/ListArtifactsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListArtifactsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListArtifactsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListArtifactsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListArtifacts( +export const paginateListArtifacts: ( config: SageMakerPaginationConfiguration, input: ListArtifactsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListArtifactsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListArtifactsCommandInput, + ListArtifactsCommandOutput +>(SageMakerClient, ListArtifactsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListAssociationsPaginator.ts b/clients/client-sagemaker/src/pagination/ListAssociationsPaginator.ts index 61e34e85431d..a0784f2337e3 100644 --- a/clients/client-sagemaker/src/pagination/ListAssociationsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssociations( +export const paginateListAssociations: ( config: SageMakerPaginationConfiguration, input: ListAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListAssociationsCommandInput, + ListAssociationsCommandOutput +>(SageMakerClient, ListAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListAutoMLJobsPaginator.ts b/clients/client-sagemaker/src/pagination/ListAutoMLJobsPaginator.ts index c6c516497f7a..a5cbec6e372d 100644 --- a/clients/client-sagemaker/src/pagination/ListAutoMLJobsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListAutoMLJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListAutoMLJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAutoMLJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAutoMLJobs( +export const paginateListAutoMLJobs: ( config: SageMakerPaginationConfiguration, input: ListAutoMLJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAutoMLJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListAutoMLJobsCommandInput, + ListAutoMLJobsCommandOutput +>(SageMakerClient, ListAutoMLJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListCandidatesForAutoMLJobPaginator.ts b/clients/client-sagemaker/src/pagination/ListCandidatesForAutoMLJobPaginator.ts index 3e760819b830..a311d6b15485 100644 --- a/clients/client-sagemaker/src/pagination/ListCandidatesForAutoMLJobPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListCandidatesForAutoMLJobPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListCandidatesForAutoMLJobCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCandidatesForAutoMLJobCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCandidatesForAutoMLJob( +export const paginateListCandidatesForAutoMLJob: ( config: SageMakerPaginationConfiguration, input: ListCandidatesForAutoMLJobCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCandidatesForAutoMLJobCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListCandidatesForAutoMLJobCommandInput, + ListCandidatesForAutoMLJobCommandOutput +>(SageMakerClient, ListCandidatesForAutoMLJobCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListCodeRepositoriesPaginator.ts b/clients/client-sagemaker/src/pagination/ListCodeRepositoriesPaginator.ts index 648e2dd9afc3..9103480bd26c 100644 --- a/clients/client-sagemaker/src/pagination/ListCodeRepositoriesPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListCodeRepositoriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListCodeRepositoriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCodeRepositoriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCodeRepositories( +export const paginateListCodeRepositories: ( config: SageMakerPaginationConfiguration, input: ListCodeRepositoriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCodeRepositoriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListCodeRepositoriesCommandInput, + ListCodeRepositoriesCommandOutput +>(SageMakerClient, ListCodeRepositoriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListCompilationJobsPaginator.ts b/clients/client-sagemaker/src/pagination/ListCompilationJobsPaginator.ts index b9e4a7001731..635bfe5ca6df 100644 --- a/clients/client-sagemaker/src/pagination/ListCompilationJobsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListCompilationJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListCompilationJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCompilationJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCompilationJobs( +export const paginateListCompilationJobs: ( config: SageMakerPaginationConfiguration, input: ListCompilationJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCompilationJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListCompilationJobsCommandInput, + ListCompilationJobsCommandOutput +>(SageMakerClient, ListCompilationJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListContextsPaginator.ts b/clients/client-sagemaker/src/pagination/ListContextsPaginator.ts index 154b11517007..48d8e5724570 100644 --- a/clients/client-sagemaker/src/pagination/ListContextsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListContextsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListContextsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContextsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContexts( +export const paginateListContexts: ( config: SageMakerPaginationConfiguration, input: ListContextsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContextsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListContextsCommandInput, + ListContextsCommandOutput +>(SageMakerClient, ListContextsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListDataQualityJobDefinitionsPaginator.ts b/clients/client-sagemaker/src/pagination/ListDataQualityJobDefinitionsPaginator.ts index 647536876ed4..17bb94c92157 100644 --- a/clients/client-sagemaker/src/pagination/ListDataQualityJobDefinitionsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListDataQualityJobDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListDataQualityJobDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataQualityJobDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataQualityJobDefinitions( +export const paginateListDataQualityJobDefinitions: ( config: SageMakerPaginationConfiguration, input: ListDataQualityJobDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataQualityJobDefinitionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListDataQualityJobDefinitionsCommandInput, + ListDataQualityJobDefinitionsCommandOutput +>(SageMakerClient, ListDataQualityJobDefinitionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListDeviceFleetsPaginator.ts b/clients/client-sagemaker/src/pagination/ListDeviceFleetsPaginator.ts index f058ec0591bb..306353e3e765 100644 --- a/clients/client-sagemaker/src/pagination/ListDeviceFleetsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListDeviceFleetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListDeviceFleetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeviceFleetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeviceFleets( +export const paginateListDeviceFleets: ( config: SageMakerPaginationConfiguration, input: ListDeviceFleetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeviceFleetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListDeviceFleetsCommandInput, + ListDeviceFleetsCommandOutput +>(SageMakerClient, ListDeviceFleetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListDevicesPaginator.ts b/clients/client-sagemaker/src/pagination/ListDevicesPaginator.ts index 26e4af6e6aef..16c947704b7f 100644 --- a/clients/client-sagemaker/src/pagination/ListDevicesPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListDevicesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListDevicesCommand, ListDevicesCommandInput, ListDevicesCommandOutput } from "../commands/ListDevicesCommand"; import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListDevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDevices( +export const paginateListDevices: ( config: SageMakerPaginationConfiguration, input: ListDevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDevicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListDevicesCommandInput, + ListDevicesCommandOutput +>(SageMakerClient, ListDevicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListDomainsPaginator.ts b/clients/client-sagemaker/src/pagination/ListDomainsPaginator.ts index 2025febe87cd..64b1ef761637 100644 --- a/clients/client-sagemaker/src/pagination/ListDomainsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListDomainsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListDomainsCommand, ListDomainsCommandInput, ListDomainsCommandOutput } from "../commands/ListDomainsCommand"; import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListDomainsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomains( +export const paginateListDomains: ( config: SageMakerPaginationConfiguration, input: ListDomainsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListDomainsCommandInput, + ListDomainsCommandOutput +>(SageMakerClient, ListDomainsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListEdgeDeploymentPlansPaginator.ts b/clients/client-sagemaker/src/pagination/ListEdgeDeploymentPlansPaginator.ts index a61c957cd327..40ef42e050bc 100644 --- a/clients/client-sagemaker/src/pagination/ListEdgeDeploymentPlansPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListEdgeDeploymentPlansPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListEdgeDeploymentPlansCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEdgeDeploymentPlansCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEdgeDeploymentPlans( +export const paginateListEdgeDeploymentPlans: ( config: SageMakerPaginationConfiguration, input: ListEdgeDeploymentPlansCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEdgeDeploymentPlansCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListEdgeDeploymentPlansCommandInput, + ListEdgeDeploymentPlansCommandOutput +>(SageMakerClient, ListEdgeDeploymentPlansCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListEdgePackagingJobsPaginator.ts b/clients/client-sagemaker/src/pagination/ListEdgePackagingJobsPaginator.ts index 6f86bba5db28..2305f21cdd11 100644 --- a/clients/client-sagemaker/src/pagination/ListEdgePackagingJobsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListEdgePackagingJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListEdgePackagingJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEdgePackagingJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEdgePackagingJobs( +export const paginateListEdgePackagingJobs: ( config: SageMakerPaginationConfiguration, input: ListEdgePackagingJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEdgePackagingJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListEdgePackagingJobsCommandInput, + ListEdgePackagingJobsCommandOutput +>(SageMakerClient, ListEdgePackagingJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListEndpointConfigsPaginator.ts b/clients/client-sagemaker/src/pagination/ListEndpointConfigsPaginator.ts index 3d5e5463ef85..a7b75cca1c71 100644 --- a/clients/client-sagemaker/src/pagination/ListEndpointConfigsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListEndpointConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListEndpointConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEndpointConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEndpointConfigs( +export const paginateListEndpointConfigs: ( config: SageMakerPaginationConfiguration, input: ListEndpointConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEndpointConfigsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListEndpointConfigsCommandInput, + ListEndpointConfigsCommandOutput +>(SageMakerClient, ListEndpointConfigsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListEndpointsPaginator.ts b/clients/client-sagemaker/src/pagination/ListEndpointsPaginator.ts index 17b9f3cac738..9f9b06a666af 100644 --- a/clients/client-sagemaker/src/pagination/ListEndpointsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListEndpointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListEndpointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEndpointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEndpoints( +export const paginateListEndpoints: ( config: SageMakerPaginationConfiguration, input: ListEndpointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEndpointsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListEndpointsCommandInput, + ListEndpointsCommandOutput +>(SageMakerClient, ListEndpointsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListExperimentsPaginator.ts b/clients/client-sagemaker/src/pagination/ListExperimentsPaginator.ts index 1d7b9f59e75d..016bb20e6cbb 100644 --- a/clients/client-sagemaker/src/pagination/ListExperimentsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListExperimentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListExperimentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExperimentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExperiments( +export const paginateListExperiments: ( config: SageMakerPaginationConfiguration, input: ListExperimentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExperimentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListExperimentsCommandInput, + ListExperimentsCommandOutput +>(SageMakerClient, ListExperimentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListFeatureGroupsPaginator.ts b/clients/client-sagemaker/src/pagination/ListFeatureGroupsPaginator.ts index 1f1144568b98..844b070c0d49 100644 --- a/clients/client-sagemaker/src/pagination/ListFeatureGroupsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListFeatureGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListFeatureGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFeatureGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFeatureGroups( +export const paginateListFeatureGroups: ( config: SageMakerPaginationConfiguration, input: ListFeatureGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFeatureGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListFeatureGroupsCommandInput, + ListFeatureGroupsCommandOutput +>(SageMakerClient, ListFeatureGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListFlowDefinitionsPaginator.ts b/clients/client-sagemaker/src/pagination/ListFlowDefinitionsPaginator.ts index df84c6759f70..22bfe792e04b 100644 --- a/clients/client-sagemaker/src/pagination/ListFlowDefinitionsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListFlowDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListFlowDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFlowDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFlowDefinitions( +export const paginateListFlowDefinitions: ( config: SageMakerPaginationConfiguration, input: ListFlowDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFlowDefinitionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListFlowDefinitionsCommandInput, + ListFlowDefinitionsCommandOutput +>(SageMakerClient, ListFlowDefinitionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListHumanTaskUisPaginator.ts b/clients/client-sagemaker/src/pagination/ListHumanTaskUisPaginator.ts index 7948bfadece6..c0b7fcae3218 100644 --- a/clients/client-sagemaker/src/pagination/ListHumanTaskUisPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListHumanTaskUisPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListHumanTaskUisCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHumanTaskUisCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHumanTaskUis( +export const paginateListHumanTaskUis: ( config: SageMakerPaginationConfiguration, input: ListHumanTaskUisCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHumanTaskUisCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListHumanTaskUisCommandInput, + ListHumanTaskUisCommandOutput +>(SageMakerClient, ListHumanTaskUisCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListHyperParameterTuningJobsPaginator.ts b/clients/client-sagemaker/src/pagination/ListHyperParameterTuningJobsPaginator.ts index 0a1534bd3791..a4c8ac2df32a 100644 --- a/clients/client-sagemaker/src/pagination/ListHyperParameterTuningJobsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListHyperParameterTuningJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListHyperParameterTuningJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListHyperParameterTuningJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListHyperParameterTuningJobs( +export const paginateListHyperParameterTuningJobs: ( config: SageMakerPaginationConfiguration, input: ListHyperParameterTuningJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListHyperParameterTuningJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListHyperParameterTuningJobsCommandInput, + ListHyperParameterTuningJobsCommandOutput +>(SageMakerClient, ListHyperParameterTuningJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListImageVersionsPaginator.ts b/clients/client-sagemaker/src/pagination/ListImageVersionsPaginator.ts index 1d0b8762404e..28078de83a24 100644 --- a/clients/client-sagemaker/src/pagination/ListImageVersionsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListImageVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListImageVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImageVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImageVersions( +export const paginateListImageVersions: ( config: SageMakerPaginationConfiguration, input: ListImageVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImageVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListImageVersionsCommandInput, + ListImageVersionsCommandOutput +>(SageMakerClient, ListImageVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListImagesPaginator.ts b/clients/client-sagemaker/src/pagination/ListImagesPaginator.ts index a105840e3d0a..a090fdeb995c 100644 --- a/clients/client-sagemaker/src/pagination/ListImagesPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListImagesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListImagesCommand, ListImagesCommandInput, ListImagesCommandOutput } from "../commands/ListImagesCommand"; import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListImagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImages( +export const paginateListImages: ( config: SageMakerPaginationConfiguration, input: ListImagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListImagesCommandInput, + ListImagesCommandOutput +>(SageMakerClient, ListImagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListInferenceComponentsPaginator.ts b/clients/client-sagemaker/src/pagination/ListInferenceComponentsPaginator.ts index 2c42ddac42e6..d464f114545a 100644 --- a/clients/client-sagemaker/src/pagination/ListInferenceComponentsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListInferenceComponentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListInferenceComponentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInferenceComponentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInferenceComponents( +export const paginateListInferenceComponents: ( config: SageMakerPaginationConfiguration, input: ListInferenceComponentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInferenceComponentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListInferenceComponentsCommandInput, + ListInferenceComponentsCommandOutput +>(SageMakerClient, ListInferenceComponentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListInferenceExperimentsPaginator.ts b/clients/client-sagemaker/src/pagination/ListInferenceExperimentsPaginator.ts index 11890289d9f8..461dcc09e8aa 100644 --- a/clients/client-sagemaker/src/pagination/ListInferenceExperimentsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListInferenceExperimentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListInferenceExperimentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInferenceExperimentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInferenceExperiments( +export const paginateListInferenceExperiments: ( config: SageMakerPaginationConfiguration, input: ListInferenceExperimentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInferenceExperimentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListInferenceExperimentsCommandInput, + ListInferenceExperimentsCommandOutput +>(SageMakerClient, ListInferenceExperimentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListInferenceRecommendationsJobStepsPaginator.ts b/clients/client-sagemaker/src/pagination/ListInferenceRecommendationsJobStepsPaginator.ts index 0839fbee22a9..406ec6ec569a 100644 --- a/clients/client-sagemaker/src/pagination/ListInferenceRecommendationsJobStepsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListInferenceRecommendationsJobStepsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListInferenceRecommendationsJobStepsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInferenceRecommendationsJobStepsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInferenceRecommendationsJobSteps( +export const paginateListInferenceRecommendationsJobSteps: ( config: SageMakerPaginationConfiguration, input: ListInferenceRecommendationsJobStepsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInferenceRecommendationsJobStepsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListInferenceRecommendationsJobStepsCommandInput, + ListInferenceRecommendationsJobStepsCommandOutput +>(SageMakerClient, ListInferenceRecommendationsJobStepsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListInferenceRecommendationsJobsPaginator.ts b/clients/client-sagemaker/src/pagination/ListInferenceRecommendationsJobsPaginator.ts index 1e89cee673f0..90cb70c51016 100644 --- a/clients/client-sagemaker/src/pagination/ListInferenceRecommendationsJobsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListInferenceRecommendationsJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListInferenceRecommendationsJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInferenceRecommendationsJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInferenceRecommendationsJobs( +export const paginateListInferenceRecommendationsJobs: ( config: SageMakerPaginationConfiguration, input: ListInferenceRecommendationsJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInferenceRecommendationsJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListInferenceRecommendationsJobsCommandInput, + ListInferenceRecommendationsJobsCommandOutput +>(SageMakerClient, ListInferenceRecommendationsJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListLabelingJobsForWorkteamPaginator.ts b/clients/client-sagemaker/src/pagination/ListLabelingJobsForWorkteamPaginator.ts index 1550a7962191..294b2095b80b 100644 --- a/clients/client-sagemaker/src/pagination/ListLabelingJobsForWorkteamPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListLabelingJobsForWorkteamPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListLabelingJobsForWorkteamCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLabelingJobsForWorkteamCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLabelingJobsForWorkteam( +export const paginateListLabelingJobsForWorkteam: ( config: SageMakerPaginationConfiguration, input: ListLabelingJobsForWorkteamCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLabelingJobsForWorkteamCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListLabelingJobsForWorkteamCommandInput, + ListLabelingJobsForWorkteamCommandOutput +>(SageMakerClient, ListLabelingJobsForWorkteamCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListLabelingJobsPaginator.ts b/clients/client-sagemaker/src/pagination/ListLabelingJobsPaginator.ts index 1acedbd14393..c24afcbdca44 100644 --- a/clients/client-sagemaker/src/pagination/ListLabelingJobsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListLabelingJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListLabelingJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLabelingJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLabelingJobs( +export const paginateListLabelingJobs: ( config: SageMakerPaginationConfiguration, input: ListLabelingJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLabelingJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListLabelingJobsCommandInput, + ListLabelingJobsCommandOutput +>(SageMakerClient, ListLabelingJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListLineageGroupsPaginator.ts b/clients/client-sagemaker/src/pagination/ListLineageGroupsPaginator.ts index 71dd6d654eae..610e2158ecb3 100644 --- a/clients/client-sagemaker/src/pagination/ListLineageGroupsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListLineageGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListLineageGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLineageGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLineageGroups( +export const paginateListLineageGroups: ( config: SageMakerPaginationConfiguration, input: ListLineageGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLineageGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListLineageGroupsCommandInput, + ListLineageGroupsCommandOutput +>(SageMakerClient, ListLineageGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListModelBiasJobDefinitionsPaginator.ts b/clients/client-sagemaker/src/pagination/ListModelBiasJobDefinitionsPaginator.ts index 4cc0be22b720..df76cd662bf9 100644 --- a/clients/client-sagemaker/src/pagination/ListModelBiasJobDefinitionsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListModelBiasJobDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListModelBiasJobDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelBiasJobDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModelBiasJobDefinitions( +export const paginateListModelBiasJobDefinitions: ( config: SageMakerPaginationConfiguration, input: ListModelBiasJobDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelBiasJobDefinitionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListModelBiasJobDefinitionsCommandInput, + ListModelBiasJobDefinitionsCommandOutput +>(SageMakerClient, ListModelBiasJobDefinitionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListModelCardExportJobsPaginator.ts b/clients/client-sagemaker/src/pagination/ListModelCardExportJobsPaginator.ts index b27cd649eb2f..5678676e831a 100644 --- a/clients/client-sagemaker/src/pagination/ListModelCardExportJobsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListModelCardExportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListModelCardExportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelCardExportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModelCardExportJobs( +export const paginateListModelCardExportJobs: ( config: SageMakerPaginationConfiguration, input: ListModelCardExportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelCardExportJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListModelCardExportJobsCommandInput, + ListModelCardExportJobsCommandOutput +>(SageMakerClient, ListModelCardExportJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListModelCardVersionsPaginator.ts b/clients/client-sagemaker/src/pagination/ListModelCardVersionsPaginator.ts index 63e6b0ba7e0e..261c4456c231 100644 --- a/clients/client-sagemaker/src/pagination/ListModelCardVersionsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListModelCardVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListModelCardVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelCardVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModelCardVersions( +export const paginateListModelCardVersions: ( config: SageMakerPaginationConfiguration, input: ListModelCardVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelCardVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListModelCardVersionsCommandInput, + ListModelCardVersionsCommandOutput +>(SageMakerClient, ListModelCardVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListModelCardsPaginator.ts b/clients/client-sagemaker/src/pagination/ListModelCardsPaginator.ts index fa78336ac40a..90ea771eaf18 100644 --- a/clients/client-sagemaker/src/pagination/ListModelCardsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListModelCardsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListModelCardsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelCardsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModelCards( +export const paginateListModelCards: ( config: SageMakerPaginationConfiguration, input: ListModelCardsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelCardsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListModelCardsCommandInput, + ListModelCardsCommandOutput +>(SageMakerClient, ListModelCardsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListModelExplainabilityJobDefinitionsPaginator.ts b/clients/client-sagemaker/src/pagination/ListModelExplainabilityJobDefinitionsPaginator.ts index 89654a297e0d..b0b5a056bd5d 100644 --- a/clients/client-sagemaker/src/pagination/ListModelExplainabilityJobDefinitionsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListModelExplainabilityJobDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListModelExplainabilityJobDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelExplainabilityJobDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModelExplainabilityJobDefinitions( +export const paginateListModelExplainabilityJobDefinitions: ( config: SageMakerPaginationConfiguration, input: ListModelExplainabilityJobDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelExplainabilityJobDefinitionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListModelExplainabilityJobDefinitionsCommandInput, + ListModelExplainabilityJobDefinitionsCommandOutput +>(SageMakerClient, ListModelExplainabilityJobDefinitionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListModelMetadataPaginator.ts b/clients/client-sagemaker/src/pagination/ListModelMetadataPaginator.ts index f9fd3dbad14f..4f8682ed3a29 100644 --- a/clients/client-sagemaker/src/pagination/ListModelMetadataPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListModelMetadataPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListModelMetadataCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelMetadataCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModelMetadata( +export const paginateListModelMetadata: ( config: SageMakerPaginationConfiguration, input: ListModelMetadataCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelMetadataCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListModelMetadataCommandInput, + ListModelMetadataCommandOutput +>(SageMakerClient, ListModelMetadataCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListModelPackageGroupsPaginator.ts b/clients/client-sagemaker/src/pagination/ListModelPackageGroupsPaginator.ts index 1dd32b4dddab..52c309f0e187 100644 --- a/clients/client-sagemaker/src/pagination/ListModelPackageGroupsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListModelPackageGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListModelPackageGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelPackageGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModelPackageGroups( +export const paginateListModelPackageGroups: ( config: SageMakerPaginationConfiguration, input: ListModelPackageGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelPackageGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListModelPackageGroupsCommandInput, + ListModelPackageGroupsCommandOutput +>(SageMakerClient, ListModelPackageGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListModelPackagesPaginator.ts b/clients/client-sagemaker/src/pagination/ListModelPackagesPaginator.ts index 3fa0bbb60e8b..51c39a61d723 100644 --- a/clients/client-sagemaker/src/pagination/ListModelPackagesPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListModelPackagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListModelPackagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelPackagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModelPackages( +export const paginateListModelPackages: ( config: SageMakerPaginationConfiguration, input: ListModelPackagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelPackagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListModelPackagesCommandInput, + ListModelPackagesCommandOutput +>(SageMakerClient, ListModelPackagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListModelQualityJobDefinitionsPaginator.ts b/clients/client-sagemaker/src/pagination/ListModelQualityJobDefinitionsPaginator.ts index bfca4acd6740..cbf7ad580d1d 100644 --- a/clients/client-sagemaker/src/pagination/ListModelQualityJobDefinitionsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListModelQualityJobDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListModelQualityJobDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelQualityJobDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModelQualityJobDefinitions( +export const paginateListModelQualityJobDefinitions: ( config: SageMakerPaginationConfiguration, input: ListModelQualityJobDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelQualityJobDefinitionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListModelQualityJobDefinitionsCommandInput, + ListModelQualityJobDefinitionsCommandOutput +>(SageMakerClient, ListModelQualityJobDefinitionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListModelsPaginator.ts b/clients/client-sagemaker/src/pagination/ListModelsPaginator.ts index e49065ebc608..5abf65557321 100644 --- a/clients/client-sagemaker/src/pagination/ListModelsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListModelsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListModelsCommand, ListModelsCommandInput, ListModelsCommandOutput } from "../commands/ListModelsCommand"; import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListModelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListModelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListModels( +export const paginateListModels: ( config: SageMakerPaginationConfiguration, input: ListModelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListModelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListModelsCommandInput, + ListModelsCommandOutput +>(SageMakerClient, ListModelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListMonitoringAlertHistoryPaginator.ts b/clients/client-sagemaker/src/pagination/ListMonitoringAlertHistoryPaginator.ts index f55b4c22a66f..c8e7d18d535f 100644 --- a/clients/client-sagemaker/src/pagination/ListMonitoringAlertHistoryPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListMonitoringAlertHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListMonitoringAlertHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMonitoringAlertHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMonitoringAlertHistory( +export const paginateListMonitoringAlertHistory: ( config: SageMakerPaginationConfiguration, input: ListMonitoringAlertHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMonitoringAlertHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListMonitoringAlertHistoryCommandInput, + ListMonitoringAlertHistoryCommandOutput +>(SageMakerClient, ListMonitoringAlertHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListMonitoringAlertsPaginator.ts b/clients/client-sagemaker/src/pagination/ListMonitoringAlertsPaginator.ts index c2427be8059a..7b8b8e254b2b 100644 --- a/clients/client-sagemaker/src/pagination/ListMonitoringAlertsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListMonitoringAlertsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListMonitoringAlertsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMonitoringAlertsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMonitoringAlerts( +export const paginateListMonitoringAlerts: ( config: SageMakerPaginationConfiguration, input: ListMonitoringAlertsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMonitoringAlertsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListMonitoringAlertsCommandInput, + ListMonitoringAlertsCommandOutput +>(SageMakerClient, ListMonitoringAlertsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListMonitoringExecutionsPaginator.ts b/clients/client-sagemaker/src/pagination/ListMonitoringExecutionsPaginator.ts index 0aca3de1464d..8219fa85daf9 100644 --- a/clients/client-sagemaker/src/pagination/ListMonitoringExecutionsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListMonitoringExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListMonitoringExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMonitoringExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMonitoringExecutions( +export const paginateListMonitoringExecutions: ( config: SageMakerPaginationConfiguration, input: ListMonitoringExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMonitoringExecutionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListMonitoringExecutionsCommandInput, + ListMonitoringExecutionsCommandOutput +>(SageMakerClient, ListMonitoringExecutionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListMonitoringSchedulesPaginator.ts b/clients/client-sagemaker/src/pagination/ListMonitoringSchedulesPaginator.ts index b741a03b3f61..1d59885a256f 100644 --- a/clients/client-sagemaker/src/pagination/ListMonitoringSchedulesPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListMonitoringSchedulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListMonitoringSchedulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMonitoringSchedulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMonitoringSchedules( +export const paginateListMonitoringSchedules: ( config: SageMakerPaginationConfiguration, input: ListMonitoringSchedulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMonitoringSchedulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListMonitoringSchedulesCommandInput, + ListMonitoringSchedulesCommandOutput +>(SageMakerClient, ListMonitoringSchedulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListNotebookInstanceLifecycleConfigsPaginator.ts b/clients/client-sagemaker/src/pagination/ListNotebookInstanceLifecycleConfigsPaginator.ts index 5b010ad14db3..ca0ef48ce7bb 100644 --- a/clients/client-sagemaker/src/pagination/ListNotebookInstanceLifecycleConfigsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListNotebookInstanceLifecycleConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListNotebookInstanceLifecycleConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNotebookInstanceLifecycleConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNotebookInstanceLifecycleConfigs( +export const paginateListNotebookInstanceLifecycleConfigs: ( config: SageMakerPaginationConfiguration, input: ListNotebookInstanceLifecycleConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNotebookInstanceLifecycleConfigsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListNotebookInstanceLifecycleConfigsCommandInput, + ListNotebookInstanceLifecycleConfigsCommandOutput +>(SageMakerClient, ListNotebookInstanceLifecycleConfigsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListNotebookInstancesPaginator.ts b/clients/client-sagemaker/src/pagination/ListNotebookInstancesPaginator.ts index 28bafa47d0e3..cc46ef697372 100644 --- a/clients/client-sagemaker/src/pagination/ListNotebookInstancesPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListNotebookInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListNotebookInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNotebookInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNotebookInstances( +export const paginateListNotebookInstances: ( config: SageMakerPaginationConfiguration, input: ListNotebookInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNotebookInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListNotebookInstancesCommandInput, + ListNotebookInstancesCommandOutput +>(SageMakerClient, ListNotebookInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListPipelineExecutionStepsPaginator.ts b/clients/client-sagemaker/src/pagination/ListPipelineExecutionStepsPaginator.ts index ae7b8a570bd5..4a81591e6f5e 100644 --- a/clients/client-sagemaker/src/pagination/ListPipelineExecutionStepsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListPipelineExecutionStepsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListPipelineExecutionStepsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPipelineExecutionStepsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPipelineExecutionSteps( +export const paginateListPipelineExecutionSteps: ( config: SageMakerPaginationConfiguration, input: ListPipelineExecutionStepsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPipelineExecutionStepsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListPipelineExecutionStepsCommandInput, + ListPipelineExecutionStepsCommandOutput +>(SageMakerClient, ListPipelineExecutionStepsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListPipelineExecutionsPaginator.ts b/clients/client-sagemaker/src/pagination/ListPipelineExecutionsPaginator.ts index 285b54e8fe3a..748ac2d0a562 100644 --- a/clients/client-sagemaker/src/pagination/ListPipelineExecutionsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListPipelineExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListPipelineExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPipelineExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPipelineExecutions( +export const paginateListPipelineExecutions: ( config: SageMakerPaginationConfiguration, input: ListPipelineExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPipelineExecutionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListPipelineExecutionsCommandInput, + ListPipelineExecutionsCommandOutput +>(SageMakerClient, ListPipelineExecutionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListPipelineParametersForExecutionPaginator.ts b/clients/client-sagemaker/src/pagination/ListPipelineParametersForExecutionPaginator.ts index 46206a67f5fd..28fa496523a4 100644 --- a/clients/client-sagemaker/src/pagination/ListPipelineParametersForExecutionPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListPipelineParametersForExecutionPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListPipelineParametersForExecutionCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPipelineParametersForExecutionCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPipelineParametersForExecution( +export const paginateListPipelineParametersForExecution: ( config: SageMakerPaginationConfiguration, input: ListPipelineParametersForExecutionCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPipelineParametersForExecutionCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListPipelineParametersForExecutionCommandInput, + ListPipelineParametersForExecutionCommandOutput +>(SageMakerClient, ListPipelineParametersForExecutionCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListPipelinesPaginator.ts b/clients/client-sagemaker/src/pagination/ListPipelinesPaginator.ts index 04ef843aa03b..abd577300ace 100644 --- a/clients/client-sagemaker/src/pagination/ListPipelinesPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListPipelinesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListPipelinesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPipelinesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPipelines( +export const paginateListPipelines: ( config: SageMakerPaginationConfiguration, input: ListPipelinesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPipelinesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListPipelinesCommandInput, + ListPipelinesCommandOutput +>(SageMakerClient, ListPipelinesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListProcessingJobsPaginator.ts b/clients/client-sagemaker/src/pagination/ListProcessingJobsPaginator.ts index 72a84994b9be..e2e4e34b2249 100644 --- a/clients/client-sagemaker/src/pagination/ListProcessingJobsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListProcessingJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListProcessingJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProcessingJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProcessingJobs( +export const paginateListProcessingJobs: ( config: SageMakerPaginationConfiguration, input: ListProcessingJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProcessingJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListProcessingJobsCommandInput, + ListProcessingJobsCommandOutput +>(SageMakerClient, ListProcessingJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListProjectsPaginator.ts b/clients/client-sagemaker/src/pagination/ListProjectsPaginator.ts index ef887dbbaf54..dd889fa68a03 100644 --- a/clients/client-sagemaker/src/pagination/ListProjectsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListProjectsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListProjectsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProjectsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProjects( +export const paginateListProjects: ( config: SageMakerPaginationConfiguration, input: ListProjectsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProjectsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListProjectsCommandInput, + ListProjectsCommandOutput +>(SageMakerClient, ListProjectsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListResourceCatalogsPaginator.ts b/clients/client-sagemaker/src/pagination/ListResourceCatalogsPaginator.ts index f539e49477ca..78ddbc29f0d1 100644 --- a/clients/client-sagemaker/src/pagination/ListResourceCatalogsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListResourceCatalogsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListResourceCatalogsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourceCatalogsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourceCatalogs( +export const paginateListResourceCatalogs: ( config: SageMakerPaginationConfiguration, input: ListResourceCatalogsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourceCatalogsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListResourceCatalogsCommandInput, + ListResourceCatalogsCommandOutput +>(SageMakerClient, ListResourceCatalogsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListSpacesPaginator.ts b/clients/client-sagemaker/src/pagination/ListSpacesPaginator.ts index 558eb27c2791..40c02e890e41 100644 --- a/clients/client-sagemaker/src/pagination/ListSpacesPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListSpacesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListSpacesCommand, ListSpacesCommandInput, ListSpacesCommandOutput } from "../commands/ListSpacesCommand"; import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListSpacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSpacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSpaces( +export const paginateListSpaces: ( config: SageMakerPaginationConfiguration, input: ListSpacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSpacesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListSpacesCommandInput, + ListSpacesCommandOutput +>(SageMakerClient, ListSpacesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListStageDevicesPaginator.ts b/clients/client-sagemaker/src/pagination/ListStageDevicesPaginator.ts index df1694024f63..676f50cb9ca3 100644 --- a/clients/client-sagemaker/src/pagination/ListStageDevicesPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListStageDevicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListStageDevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStageDevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStageDevices( +export const paginateListStageDevices: ( config: SageMakerPaginationConfiguration, input: ListStageDevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStageDevicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListStageDevicesCommandInput, + ListStageDevicesCommandOutput +>(SageMakerClient, ListStageDevicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListStudioLifecycleConfigsPaginator.ts b/clients/client-sagemaker/src/pagination/ListStudioLifecycleConfigsPaginator.ts index 8d8956231aa7..390673c08ecf 100644 --- a/clients/client-sagemaker/src/pagination/ListStudioLifecycleConfigsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListStudioLifecycleConfigsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListStudioLifecycleConfigsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStudioLifecycleConfigsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStudioLifecycleConfigs( +export const paginateListStudioLifecycleConfigs: ( config: SageMakerPaginationConfiguration, input: ListStudioLifecycleConfigsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStudioLifecycleConfigsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListStudioLifecycleConfigsCommandInput, + ListStudioLifecycleConfigsCommandOutput +>(SageMakerClient, ListStudioLifecycleConfigsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListSubscribedWorkteamsPaginator.ts b/clients/client-sagemaker/src/pagination/ListSubscribedWorkteamsPaginator.ts index 39090c89b8d0..e4fbea5b44a2 100644 --- a/clients/client-sagemaker/src/pagination/ListSubscribedWorkteamsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListSubscribedWorkteamsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListSubscribedWorkteamsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSubscribedWorkteamsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSubscribedWorkteams( +export const paginateListSubscribedWorkteams: ( config: SageMakerPaginationConfiguration, input: ListSubscribedWorkteamsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSubscribedWorkteamsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListSubscribedWorkteamsCommandInput, + ListSubscribedWorkteamsCommandOutput +>(SageMakerClient, ListSubscribedWorkteamsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListTagsPaginator.ts b/clients/client-sagemaker/src/pagination/ListTagsPaginator.ts index 04fd0742ecd0..912f82809a1a 100644 --- a/clients/client-sagemaker/src/pagination/ListTagsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListTagsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTagsCommand, ListTagsCommandInput, ListTagsCommandOutput } from "../commands/ListTagsCommand"; import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListTagsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTags( +export const paginateListTags: ( config: SageMakerPaginationConfiguration, input: ListTagsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListTagsCommandInput, + ListTagsCommandOutput +>(SageMakerClient, ListTagsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListTrainingJobsForHyperParameterTuningJobPaginator.ts b/clients/client-sagemaker/src/pagination/ListTrainingJobsForHyperParameterTuningJobPaginator.ts index 0e3a7d4d1c6c..60aa82075daf 100644 --- a/clients/client-sagemaker/src/pagination/ListTrainingJobsForHyperParameterTuningJobPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListTrainingJobsForHyperParameterTuningJobPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListTrainingJobsForHyperParameterTuningJobCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTrainingJobsForHyperParameterTuningJobCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTrainingJobsForHyperParameterTuningJob( +export const paginateListTrainingJobsForHyperParameterTuningJob: ( config: SageMakerPaginationConfiguration, input: ListTrainingJobsForHyperParameterTuningJobCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTrainingJobsForHyperParameterTuningJobCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListTrainingJobsForHyperParameterTuningJobCommandInput, + ListTrainingJobsForHyperParameterTuningJobCommandOutput +>(SageMakerClient, ListTrainingJobsForHyperParameterTuningJobCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListTrainingJobsPaginator.ts b/clients/client-sagemaker/src/pagination/ListTrainingJobsPaginator.ts index 93bb88769b03..5ca646ab7729 100644 --- a/clients/client-sagemaker/src/pagination/ListTrainingJobsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListTrainingJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListTrainingJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTrainingJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTrainingJobs( +export const paginateListTrainingJobs: ( config: SageMakerPaginationConfiguration, input: ListTrainingJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTrainingJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListTrainingJobsCommandInput, + ListTrainingJobsCommandOutput +>(SageMakerClient, ListTrainingJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListTransformJobsPaginator.ts b/clients/client-sagemaker/src/pagination/ListTransformJobsPaginator.ts index 884ac865cd97..80912339ea16 100644 --- a/clients/client-sagemaker/src/pagination/ListTransformJobsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListTransformJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListTransformJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTransformJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTransformJobs( +export const paginateListTransformJobs: ( config: SageMakerPaginationConfiguration, input: ListTransformJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTransformJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListTransformJobsCommandInput, + ListTransformJobsCommandOutput +>(SageMakerClient, ListTransformJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListTrialComponentsPaginator.ts b/clients/client-sagemaker/src/pagination/ListTrialComponentsPaginator.ts index 4e967ac3ed01..4a55bbb60c23 100644 --- a/clients/client-sagemaker/src/pagination/ListTrialComponentsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListTrialComponentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListTrialComponentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTrialComponentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTrialComponents( +export const paginateListTrialComponents: ( config: SageMakerPaginationConfiguration, input: ListTrialComponentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTrialComponentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListTrialComponentsCommandInput, + ListTrialComponentsCommandOutput +>(SageMakerClient, ListTrialComponentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListTrialsPaginator.ts b/clients/client-sagemaker/src/pagination/ListTrialsPaginator.ts index 986761ab7941..82b99079b745 100644 --- a/clients/client-sagemaker/src/pagination/ListTrialsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListTrialsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTrialsCommand, ListTrialsCommandInput, ListTrialsCommandOutput } from "../commands/ListTrialsCommand"; import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListTrialsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTrialsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTrials( +export const paginateListTrials: ( config: SageMakerPaginationConfiguration, input: ListTrialsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTrialsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListTrialsCommandInput, + ListTrialsCommandOutput +>(SageMakerClient, ListTrialsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListUserProfilesPaginator.ts b/clients/client-sagemaker/src/pagination/ListUserProfilesPaginator.ts index 35a9d117f93b..3528d916e04d 100644 --- a/clients/client-sagemaker/src/pagination/ListUserProfilesPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListUserProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListUserProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUserProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUserProfiles( +export const paginateListUserProfiles: ( config: SageMakerPaginationConfiguration, input: ListUserProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUserProfilesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListUserProfilesCommandInput, + ListUserProfilesCommandOutput +>(SageMakerClient, ListUserProfilesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListWorkforcesPaginator.ts b/clients/client-sagemaker/src/pagination/ListWorkforcesPaginator.ts index 548a1faecdb8..6a594af4736d 100644 --- a/clients/client-sagemaker/src/pagination/ListWorkforcesPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListWorkforcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListWorkforcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkforcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkforces( +export const paginateListWorkforces: ( config: SageMakerPaginationConfiguration, input: ListWorkforcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkforcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListWorkforcesCommandInput, + ListWorkforcesCommandOutput +>(SageMakerClient, ListWorkforcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/ListWorkteamsPaginator.ts b/clients/client-sagemaker/src/pagination/ListWorkteamsPaginator.ts index d7863e9e98d5..851aec027d47 100644 --- a/clients/client-sagemaker/src/pagination/ListWorkteamsPaginator.ts +++ b/clients/client-sagemaker/src/pagination/ListWorkteamsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: ListWorkteamsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkteamsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkteams( +export const paginateListWorkteams: ( config: SageMakerPaginationConfiguration, input: ListWorkteamsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkteamsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + ListWorkteamsCommandInput, + ListWorkteamsCommandOutput +>(SageMakerClient, ListWorkteamsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/QueryLineagePaginator.ts b/clients/client-sagemaker/src/pagination/QueryLineagePaginator.ts index 3ab1af57dd49..0c849a590844 100644 --- a/clients/client-sagemaker/src/pagination/QueryLineagePaginator.ts +++ b/clients/client-sagemaker/src/pagination/QueryLineagePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: QueryLineageCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new QueryLineageCommand(input), ...args); -}; /** * @public */ -export async function* paginateQueryLineage( +export const paginateQueryLineage: ( config: SageMakerPaginationConfiguration, input: QueryLineageCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: QueryLineageCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + QueryLineageCommandInput, + QueryLineageCommandOutput +>(SageMakerClient, QueryLineageCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sagemaker/src/pagination/SearchPaginator.ts b/clients/client-sagemaker/src/pagination/SearchPaginator.ts index 13a2a42a2f39..8a613f16f8d2 100644 --- a/clients/client-sagemaker/src/pagination/SearchPaginator.ts +++ b/clients/client-sagemaker/src/pagination/SearchPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { SearchCommand, SearchCommandInput, SearchCommandOutput } from "../commands/SearchCommand"; import { SageMakerClient } from "../SageMakerClient"; import { SageMakerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SageMakerClient, - input: SearchCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearch( +export const paginateSearch: ( config: SageMakerPaginationConfiguration, input: SearchCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SageMakerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SageMaker | SageMakerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SageMakerPaginationConfiguration, + SearchCommandInput, + SearchCommandOutput +>(SageMakerClient, SearchCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-scheduler/src/pagination/ListScheduleGroupsPaginator.ts b/clients/client-scheduler/src/pagination/ListScheduleGroupsPaginator.ts index 963be385aeff..823eb3200e97 100644 --- a/clients/client-scheduler/src/pagination/ListScheduleGroupsPaginator.ts +++ b/clients/client-scheduler/src/pagination/ListScheduleGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SchedulerClient } from "../SchedulerClient"; import { SchedulerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SchedulerClient, - input: ListScheduleGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListScheduleGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListScheduleGroups( +export const paginateListScheduleGroups: ( config: SchedulerPaginationConfiguration, input: ListScheduleGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListScheduleGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SchedulerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Scheduler | SchedulerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SchedulerPaginationConfiguration, + ListScheduleGroupsCommandInput, + ListScheduleGroupsCommandOutput +>(SchedulerClient, ListScheduleGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-scheduler/src/pagination/ListSchedulesPaginator.ts b/clients/client-scheduler/src/pagination/ListSchedulesPaginator.ts index d632bac084ac..72091329a474 100644 --- a/clients/client-scheduler/src/pagination/ListSchedulesPaginator.ts +++ b/clients/client-scheduler/src/pagination/ListSchedulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SchedulerClient } from "../SchedulerClient"; import { SchedulerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SchedulerClient, - input: ListSchedulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSchedulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSchedules( +export const paginateListSchedules: ( config: SchedulerPaginationConfiguration, input: ListSchedulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSchedulesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SchedulerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Scheduler | SchedulerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SchedulerPaginationConfiguration, + ListSchedulesCommandInput, + ListSchedulesCommandOutput +>(SchedulerClient, ListSchedulesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-schemas/src/pagination/ListDiscoverersPaginator.ts b/clients/client-schemas/src/pagination/ListDiscoverersPaginator.ts index 11703b586bee..3a4154795b88 100644 --- a/clients/client-schemas/src/pagination/ListDiscoverersPaginator.ts +++ b/clients/client-schemas/src/pagination/ListDiscoverersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SchemasClient } from "../SchemasClient"; import { SchemasPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SchemasClient, - input: ListDiscoverersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDiscoverersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDiscoverers( +export const paginateListDiscoverers: ( config: SchemasPaginationConfiguration, input: ListDiscoverersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDiscoverersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof SchemasClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Schemas | SchemasClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SchemasPaginationConfiguration, + ListDiscoverersCommandInput, + ListDiscoverersCommandOutput +>(SchemasClient, ListDiscoverersCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-schemas/src/pagination/ListRegistriesPaginator.ts b/clients/client-schemas/src/pagination/ListRegistriesPaginator.ts index 45e1226994c1..6f0a8e05822a 100644 --- a/clients/client-schemas/src/pagination/ListRegistriesPaginator.ts +++ b/clients/client-schemas/src/pagination/ListRegistriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SchemasClient } from "../SchemasClient"; import { SchemasPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SchemasClient, - input: ListRegistriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRegistriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRegistries( +export const paginateListRegistries: ( config: SchemasPaginationConfiguration, input: ListRegistriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRegistriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof SchemasClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Schemas | SchemasClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SchemasPaginationConfiguration, + ListRegistriesCommandInput, + ListRegistriesCommandOutput +>(SchemasClient, ListRegistriesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-schemas/src/pagination/ListSchemaVersionsPaginator.ts b/clients/client-schemas/src/pagination/ListSchemaVersionsPaginator.ts index 06cbdb24cd91..78096a265f8b 100644 --- a/clients/client-schemas/src/pagination/ListSchemaVersionsPaginator.ts +++ b/clients/client-schemas/src/pagination/ListSchemaVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SchemasClient } from "../SchemasClient"; import { SchemasPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SchemasClient, - input: ListSchemaVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSchemaVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSchemaVersions( +export const paginateListSchemaVersions: ( config: SchemasPaginationConfiguration, input: ListSchemaVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSchemaVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof SchemasClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Schemas | SchemasClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SchemasPaginationConfiguration, + ListSchemaVersionsCommandInput, + ListSchemaVersionsCommandOutput +>(SchemasClient, ListSchemaVersionsCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-schemas/src/pagination/ListSchemasPaginator.ts b/clients/client-schemas/src/pagination/ListSchemasPaginator.ts index 98bb234cab36..f0ecb7ba7448 100644 --- a/clients/client-schemas/src/pagination/ListSchemasPaginator.ts +++ b/clients/client-schemas/src/pagination/ListSchemasPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListSchemasCommand, ListSchemasCommandInput, ListSchemasCommandOutput } from "../commands/ListSchemasCommand"; import { SchemasClient } from "../SchemasClient"; import { SchemasPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SchemasClient, - input: ListSchemasCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSchemasCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSchemas( +export const paginateListSchemas: ( config: SchemasPaginationConfiguration, input: ListSchemasCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSchemasCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof SchemasClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Schemas | SchemasClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SchemasPaginationConfiguration, + ListSchemasCommandInput, + ListSchemasCommandOutput +>(SchemasClient, ListSchemasCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-schemas/src/pagination/SearchSchemasPaginator.ts b/clients/client-schemas/src/pagination/SearchSchemasPaginator.ts index fde32693a48e..4a8ccb1867d1 100644 --- a/clients/client-schemas/src/pagination/SearchSchemasPaginator.ts +++ b/clients/client-schemas/src/pagination/SearchSchemasPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SchemasClient } from "../SchemasClient"; import { SchemasPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SchemasClient, - input: SearchSchemasCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchSchemasCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchSchemas( +export const paginateSearchSchemas: ( config: SchemasPaginationConfiguration, input: SearchSchemasCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchSchemasCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof SchemasClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Schemas | SchemasClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SchemasPaginationConfiguration, + SearchSchemasCommandInput, + SearchSchemasCommandOutput +>(SchemasClient, SearchSchemasCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-secrets-manager/package.json b/clients/client-secrets-manager/package.json index c947d3a1428c..1c8f2351b2e1 100644 --- a/clients/client-secrets-manager/package.json +++ b/clients/client-secrets-manager/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-secrets-manager/src/pagination/BatchGetSecretValuePaginator.ts b/clients/client-secrets-manager/src/pagination/BatchGetSecretValuePaginator.ts index c3e184918a8e..0c9cd82bcbd1 100644 --- a/clients/client-secrets-manager/src/pagination/BatchGetSecretValuePaginator.ts +++ b/clients/client-secrets-manager/src/pagination/BatchGetSecretValuePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecretsManagerClient } from "../SecretsManagerClient"; import { SecretsManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecretsManagerClient, - input: BatchGetSecretValueCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new BatchGetSecretValueCommand(input), ...args); -}; /** * @public */ -export async function* paginateBatchGetSecretValue( +export const paginateBatchGetSecretValue: ( config: SecretsManagerPaginationConfiguration, input: BatchGetSecretValueCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: BatchGetSecretValueCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecretsManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecretsManager | SecretsManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecretsManagerPaginationConfiguration, + BatchGetSecretValueCommandInput, + BatchGetSecretValueCommandOutput +>(SecretsManagerClient, BatchGetSecretValueCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-secrets-manager/src/pagination/ListSecretVersionIdsPaginator.ts b/clients/client-secrets-manager/src/pagination/ListSecretVersionIdsPaginator.ts index 77769f62e276..23aa5d2dbbe3 100644 --- a/clients/client-secrets-manager/src/pagination/ListSecretVersionIdsPaginator.ts +++ b/clients/client-secrets-manager/src/pagination/ListSecretVersionIdsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecretsManagerClient } from "../SecretsManagerClient"; import { SecretsManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecretsManagerClient, - input: ListSecretVersionIdsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSecretVersionIdsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSecretVersionIds( +export const paginateListSecretVersionIds: ( config: SecretsManagerPaginationConfiguration, input: ListSecretVersionIdsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSecretVersionIdsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecretsManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecretsManager | SecretsManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecretsManagerPaginationConfiguration, + ListSecretVersionIdsCommandInput, + ListSecretVersionIdsCommandOutput +>(SecretsManagerClient, ListSecretVersionIdsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-secrets-manager/src/pagination/ListSecretsPaginator.ts b/clients/client-secrets-manager/src/pagination/ListSecretsPaginator.ts index 6e7004e12d59..863e9b19b002 100644 --- a/clients/client-secrets-manager/src/pagination/ListSecretsPaginator.ts +++ b/clients/client-secrets-manager/src/pagination/ListSecretsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListSecretsCommand, ListSecretsCommandInput, ListSecretsCommandOutput } from "../commands/ListSecretsCommand"; import { SecretsManagerClient } from "../SecretsManagerClient"; import { SecretsManagerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecretsManagerClient, - input: ListSecretsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSecretsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSecrets( +export const paginateListSecrets: ( config: SecretsManagerPaginationConfiguration, input: ListSecretsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSecretsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecretsManagerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecretsManager | SecretsManagerClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecretsManagerPaginationConfiguration, + ListSecretsCommandInput, + ListSecretsCommandOutput +>(SecretsManagerClient, ListSecretsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/DescribeActionTargetsPaginator.ts b/clients/client-securityhub/src/pagination/DescribeActionTargetsPaginator.ts index 93ff26f6bd2b..84810d8e6b7f 100644 --- a/clients/client-securityhub/src/pagination/DescribeActionTargetsPaginator.ts +++ b/clients/client-securityhub/src/pagination/DescribeActionTargetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: DescribeActionTargetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeActionTargetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeActionTargets( +export const paginateDescribeActionTargets: ( config: SecurityHubPaginationConfiguration, input: DescribeActionTargetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeActionTargetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + DescribeActionTargetsCommandInput, + DescribeActionTargetsCommandOutput +>(SecurityHubClient, DescribeActionTargetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/DescribeProductsPaginator.ts b/clients/client-securityhub/src/pagination/DescribeProductsPaginator.ts index 12d93e7de733..9439715b4633 100644 --- a/clients/client-securityhub/src/pagination/DescribeProductsPaginator.ts +++ b/clients/client-securityhub/src/pagination/DescribeProductsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: DescribeProductsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeProductsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeProducts( +export const paginateDescribeProducts: ( config: SecurityHubPaginationConfiguration, input: DescribeProductsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeProductsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + DescribeProductsCommandInput, + DescribeProductsCommandOutput +>(SecurityHubClient, DescribeProductsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/DescribeStandardsControlsPaginator.ts b/clients/client-securityhub/src/pagination/DescribeStandardsControlsPaginator.ts index fd2a0d860120..a4d476301078 100644 --- a/clients/client-securityhub/src/pagination/DescribeStandardsControlsPaginator.ts +++ b/clients/client-securityhub/src/pagination/DescribeStandardsControlsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: DescribeStandardsControlsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeStandardsControlsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeStandardsControls( +export const paginateDescribeStandardsControls: ( config: SecurityHubPaginationConfiguration, input: DescribeStandardsControlsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeStandardsControlsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + DescribeStandardsControlsCommandInput, + DescribeStandardsControlsCommandOutput +>(SecurityHubClient, DescribeStandardsControlsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/DescribeStandardsPaginator.ts b/clients/client-securityhub/src/pagination/DescribeStandardsPaginator.ts index 3e966da2d030..2a92d9496a1d 100644 --- a/clients/client-securityhub/src/pagination/DescribeStandardsPaginator.ts +++ b/clients/client-securityhub/src/pagination/DescribeStandardsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: DescribeStandardsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeStandardsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeStandards( +export const paginateDescribeStandards: ( config: SecurityHubPaginationConfiguration, input: DescribeStandardsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeStandardsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + DescribeStandardsCommandInput, + DescribeStandardsCommandOutput +>(SecurityHubClient, DescribeStandardsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/GetEnabledStandardsPaginator.ts b/clients/client-securityhub/src/pagination/GetEnabledStandardsPaginator.ts index b4c494fcd791..92b948af8d44 100644 --- a/clients/client-securityhub/src/pagination/GetEnabledStandardsPaginator.ts +++ b/clients/client-securityhub/src/pagination/GetEnabledStandardsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: GetEnabledStandardsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetEnabledStandardsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetEnabledStandards( +export const paginateGetEnabledStandards: ( config: SecurityHubPaginationConfiguration, input: GetEnabledStandardsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetEnabledStandardsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + GetEnabledStandardsCommandInput, + GetEnabledStandardsCommandOutput +>(SecurityHubClient, GetEnabledStandardsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/GetFindingHistoryPaginator.ts b/clients/client-securityhub/src/pagination/GetFindingHistoryPaginator.ts index 0f516390acd6..f8d80f6c4ec4 100644 --- a/clients/client-securityhub/src/pagination/GetFindingHistoryPaginator.ts +++ b/clients/client-securityhub/src/pagination/GetFindingHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: GetFindingHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetFindingHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetFindingHistory( +export const paginateGetFindingHistory: ( config: SecurityHubPaginationConfiguration, input: GetFindingHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetFindingHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + GetFindingHistoryCommandInput, + GetFindingHistoryCommandOutput +>(SecurityHubClient, GetFindingHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/GetFindingsPaginator.ts b/clients/client-securityhub/src/pagination/GetFindingsPaginator.ts index ca6e51d52510..d20e77459382 100644 --- a/clients/client-securityhub/src/pagination/GetFindingsPaginator.ts +++ b/clients/client-securityhub/src/pagination/GetFindingsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetFindingsCommand, GetFindingsCommandInput, GetFindingsCommandOutput } from "../commands/GetFindingsCommand"; import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: GetFindingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetFindingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetFindings( +export const paginateGetFindings: ( config: SecurityHubPaginationConfiguration, input: GetFindingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetFindingsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + GetFindingsCommandInput, + GetFindingsCommandOutput +>(SecurityHubClient, GetFindingsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/GetInsightsPaginator.ts b/clients/client-securityhub/src/pagination/GetInsightsPaginator.ts index 13aaef3bad55..42837fe4ae11 100644 --- a/clients/client-securityhub/src/pagination/GetInsightsPaginator.ts +++ b/clients/client-securityhub/src/pagination/GetInsightsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetInsightsCommand, GetInsightsCommandInput, GetInsightsCommandOutput } from "../commands/GetInsightsCommand"; import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: GetInsightsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetInsightsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetInsights( +export const paginateGetInsights: ( config: SecurityHubPaginationConfiguration, input: GetInsightsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetInsightsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + GetInsightsCommandInput, + GetInsightsCommandOutput +>(SecurityHubClient, GetInsightsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/ListConfigurationPoliciesPaginator.ts b/clients/client-securityhub/src/pagination/ListConfigurationPoliciesPaginator.ts index 11df139b6f1f..419214fdff7a 100644 --- a/clients/client-securityhub/src/pagination/ListConfigurationPoliciesPaginator.ts +++ b/clients/client-securityhub/src/pagination/ListConfigurationPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: ListConfigurationPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConfigurationPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConfigurationPolicies( +export const paginateListConfigurationPolicies: ( config: SecurityHubPaginationConfiguration, input: ListConfigurationPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConfigurationPoliciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + ListConfigurationPoliciesCommandInput, + ListConfigurationPoliciesCommandOutput +>(SecurityHubClient, ListConfigurationPoliciesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/ListConfigurationPolicyAssociationsPaginator.ts b/clients/client-securityhub/src/pagination/ListConfigurationPolicyAssociationsPaginator.ts index 4dd18f27cffd..ae3b64e6210f 100644 --- a/clients/client-securityhub/src/pagination/ListConfigurationPolicyAssociationsPaginator.ts +++ b/clients/client-securityhub/src/pagination/ListConfigurationPolicyAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: ListConfigurationPolicyAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConfigurationPolicyAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConfigurationPolicyAssociations( +export const paginateListConfigurationPolicyAssociations: ( config: SecurityHubPaginationConfiguration, input: ListConfigurationPolicyAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConfigurationPolicyAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + ListConfigurationPolicyAssociationsCommandInput, + ListConfigurationPolicyAssociationsCommandOutput +>(SecurityHubClient, ListConfigurationPolicyAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/ListEnabledProductsForImportPaginator.ts b/clients/client-securityhub/src/pagination/ListEnabledProductsForImportPaginator.ts index 91979bc606cd..9eefa08b4e6f 100644 --- a/clients/client-securityhub/src/pagination/ListEnabledProductsForImportPaginator.ts +++ b/clients/client-securityhub/src/pagination/ListEnabledProductsForImportPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: ListEnabledProductsForImportCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnabledProductsForImportCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnabledProductsForImport( +export const paginateListEnabledProductsForImport: ( config: SecurityHubPaginationConfiguration, input: ListEnabledProductsForImportCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnabledProductsForImportCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + ListEnabledProductsForImportCommandInput, + ListEnabledProductsForImportCommandOutput +>(SecurityHubClient, ListEnabledProductsForImportCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/ListFindingAggregatorsPaginator.ts b/clients/client-securityhub/src/pagination/ListFindingAggregatorsPaginator.ts index 424a0646bbb4..0f2bf9585ee3 100644 --- a/clients/client-securityhub/src/pagination/ListFindingAggregatorsPaginator.ts +++ b/clients/client-securityhub/src/pagination/ListFindingAggregatorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: ListFindingAggregatorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFindingAggregatorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFindingAggregators( +export const paginateListFindingAggregators: ( config: SecurityHubPaginationConfiguration, input: ListFindingAggregatorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFindingAggregatorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + ListFindingAggregatorsCommandInput, + ListFindingAggregatorsCommandOutput +>(SecurityHubClient, ListFindingAggregatorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/ListInvitationsPaginator.ts b/clients/client-securityhub/src/pagination/ListInvitationsPaginator.ts index fc3b0d9d941c..8cf8afff0c2d 100644 --- a/clients/client-securityhub/src/pagination/ListInvitationsPaginator.ts +++ b/clients/client-securityhub/src/pagination/ListInvitationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: ListInvitationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInvitationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInvitations( +export const paginateListInvitations: ( config: SecurityHubPaginationConfiguration, input: ListInvitationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInvitationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + ListInvitationsCommandInput, + ListInvitationsCommandOutput +>(SecurityHubClient, ListInvitationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/ListMembersPaginator.ts b/clients/client-securityhub/src/pagination/ListMembersPaginator.ts index 174ab3c3a4d8..d15fd4918a7b 100644 --- a/clients/client-securityhub/src/pagination/ListMembersPaginator.ts +++ b/clients/client-securityhub/src/pagination/ListMembersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListMembersCommand, ListMembersCommandInput, ListMembersCommandOutput } from "../commands/ListMembersCommand"; import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: ListMembersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMembersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMembers( +export const paginateListMembers: ( config: SecurityHubPaginationConfiguration, input: ListMembersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMembersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + ListMembersCommandInput, + ListMembersCommandOutput +>(SecurityHubClient, ListMembersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/ListOrganizationAdminAccountsPaginator.ts b/clients/client-securityhub/src/pagination/ListOrganizationAdminAccountsPaginator.ts index 358164be51a0..3e10519b24ca 100644 --- a/clients/client-securityhub/src/pagination/ListOrganizationAdminAccountsPaginator.ts +++ b/clients/client-securityhub/src/pagination/ListOrganizationAdminAccountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: ListOrganizationAdminAccountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOrganizationAdminAccountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOrganizationAdminAccounts( +export const paginateListOrganizationAdminAccounts: ( config: SecurityHubPaginationConfiguration, input: ListOrganizationAdminAccountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOrganizationAdminAccountsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + ListOrganizationAdminAccountsCommandInput, + ListOrganizationAdminAccountsCommandOutput +>(SecurityHubClient, ListOrganizationAdminAccountsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/ListSecurityControlDefinitionsPaginator.ts b/clients/client-securityhub/src/pagination/ListSecurityControlDefinitionsPaginator.ts index 69cd82c3350c..91341abc9c5b 100644 --- a/clients/client-securityhub/src/pagination/ListSecurityControlDefinitionsPaginator.ts +++ b/clients/client-securityhub/src/pagination/ListSecurityControlDefinitionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: ListSecurityControlDefinitionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSecurityControlDefinitionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSecurityControlDefinitions( +export const paginateListSecurityControlDefinitions: ( config: SecurityHubPaginationConfiguration, input: ListSecurityControlDefinitionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSecurityControlDefinitionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + ListSecurityControlDefinitionsCommandInput, + ListSecurityControlDefinitionsCommandOutput +>(SecurityHubClient, ListSecurityControlDefinitionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securityhub/src/pagination/ListStandardsControlAssociationsPaginator.ts b/clients/client-securityhub/src/pagination/ListStandardsControlAssociationsPaginator.ts index bf9a9ef0935a..6d7bd8897192 100644 --- a/clients/client-securityhub/src/pagination/ListStandardsControlAssociationsPaginator.ts +++ b/clients/client-securityhub/src/pagination/ListStandardsControlAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityHubClient } from "../SecurityHubClient"; import { SecurityHubPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityHubClient, - input: ListStandardsControlAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStandardsControlAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStandardsControlAssociations( +export const paginateListStandardsControlAssociations: ( config: SecurityHubPaginationConfiguration, input: ListStandardsControlAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStandardsControlAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SecurityHubClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityHub | SecurityHubClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityHubPaginationConfiguration, + ListStandardsControlAssociationsCommandInput, + ListStandardsControlAssociationsCommandOutput +>(SecurityHubClient, ListStandardsControlAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-securitylake/src/pagination/GetDataLakeSourcesPaginator.ts b/clients/client-securitylake/src/pagination/GetDataLakeSourcesPaginator.ts index ae2c2ae89db7..77153f5009dd 100644 --- a/clients/client-securitylake/src/pagination/GetDataLakeSourcesPaginator.ts +++ b/clients/client-securitylake/src/pagination/GetDataLakeSourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityLakeClient } from "../SecurityLakeClient"; import { SecurityLakePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityLakeClient, - input: GetDataLakeSourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetDataLakeSourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetDataLakeSources( +export const paginateGetDataLakeSources: ( config: SecurityLakePaginationConfiguration, input: GetDataLakeSourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetDataLakeSourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SecurityLakeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityLake | SecurityLakeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityLakePaginationConfiguration, + GetDataLakeSourcesCommandInput, + GetDataLakeSourcesCommandOutput +>(SecurityLakeClient, GetDataLakeSourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-securitylake/src/pagination/ListDataLakeExceptionsPaginator.ts b/clients/client-securitylake/src/pagination/ListDataLakeExceptionsPaginator.ts index e72e504e6fc6..bb2014974cc6 100644 --- a/clients/client-securitylake/src/pagination/ListDataLakeExceptionsPaginator.ts +++ b/clients/client-securitylake/src/pagination/ListDataLakeExceptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityLakeClient } from "../SecurityLakeClient"; import { SecurityLakePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityLakeClient, - input: ListDataLakeExceptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDataLakeExceptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDataLakeExceptions( +export const paginateListDataLakeExceptions: ( config: SecurityLakePaginationConfiguration, input: ListDataLakeExceptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDataLakeExceptionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SecurityLakeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityLake | SecurityLakeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityLakePaginationConfiguration, + ListDataLakeExceptionsCommandInput, + ListDataLakeExceptionsCommandOutput +>(SecurityLakeClient, ListDataLakeExceptionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-securitylake/src/pagination/ListLogSourcesPaginator.ts b/clients/client-securitylake/src/pagination/ListLogSourcesPaginator.ts index 13aeabcda125..fdd36cffbe43 100644 --- a/clients/client-securitylake/src/pagination/ListLogSourcesPaginator.ts +++ b/clients/client-securitylake/src/pagination/ListLogSourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityLakeClient } from "../SecurityLakeClient"; import { SecurityLakePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityLakeClient, - input: ListLogSourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLogSourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLogSources( +export const paginateListLogSources: ( config: SecurityLakePaginationConfiguration, input: ListLogSourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLogSourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SecurityLakeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityLake | SecurityLakeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityLakePaginationConfiguration, + ListLogSourcesCommandInput, + ListLogSourcesCommandOutput +>(SecurityLakeClient, ListLogSourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-securitylake/src/pagination/ListSubscribersPaginator.ts b/clients/client-securitylake/src/pagination/ListSubscribersPaginator.ts index 17abf6bbc00d..473e48933586 100644 --- a/clients/client-securitylake/src/pagination/ListSubscribersPaginator.ts +++ b/clients/client-securitylake/src/pagination/ListSubscribersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SecurityLakeClient } from "../SecurityLakeClient"; import { SecurityLakePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SecurityLakeClient, - input: ListSubscribersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSubscribersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSubscribers( +export const paginateListSubscribers: ( config: SecurityLakePaginationConfiguration, input: ListSubscribersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSubscribersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SecurityLakeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SecurityLake | SecurityLakeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SecurityLakePaginationConfiguration, + ListSubscribersCommandInput, + ListSubscribersCommandOutput +>(SecurityLakeClient, ListSubscribersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-serverlessapplicationrepository/src/pagination/ListApplicationDependenciesPaginator.ts b/clients/client-serverlessapplicationrepository/src/pagination/ListApplicationDependenciesPaginator.ts index 16ff60f18b43..b14e8bb039ac 100644 --- a/clients/client-serverlessapplicationrepository/src/pagination/ListApplicationDependenciesPaginator.ts +++ b/clients/client-serverlessapplicationrepository/src/pagination/ListApplicationDependenciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,44 +10,15 @@ import { import { ServerlessApplicationRepositoryClient } from "../ServerlessApplicationRepositoryClient"; import { ServerlessApplicationRepositoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServerlessApplicationRepositoryClient, - input: ListApplicationDependenciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationDependenciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationDependencies( +export const paginateListApplicationDependencies: ( config: ServerlessApplicationRepositoryPaginationConfiguration, input: ListApplicationDependenciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationDependenciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof ServerlessApplicationRepositoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error( - "Invalid client, expected ServerlessApplicationRepository | ServerlessApplicationRepositoryClient" - ); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServerlessApplicationRepositoryPaginationConfiguration, + ListApplicationDependenciesCommandInput, + ListApplicationDependenciesCommandOutput +>(ServerlessApplicationRepositoryClient, ListApplicationDependenciesCommand, "NextToken", "NextToken", "MaxItems"); diff --git a/clients/client-serverlessapplicationrepository/src/pagination/ListApplicationVersionsPaginator.ts b/clients/client-serverlessapplicationrepository/src/pagination/ListApplicationVersionsPaginator.ts index 620121e6254e..56343942f8d7 100644 --- a/clients/client-serverlessapplicationrepository/src/pagination/ListApplicationVersionsPaginator.ts +++ b/clients/client-serverlessapplicationrepository/src/pagination/ListApplicationVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,44 +10,15 @@ import { import { ServerlessApplicationRepositoryClient } from "../ServerlessApplicationRepositoryClient"; import { ServerlessApplicationRepositoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServerlessApplicationRepositoryClient, - input: ListApplicationVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationVersions( +export const paginateListApplicationVersions: ( config: ServerlessApplicationRepositoryPaginationConfiguration, input: ListApplicationVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof ServerlessApplicationRepositoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error( - "Invalid client, expected ServerlessApplicationRepository | ServerlessApplicationRepositoryClient" - ); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServerlessApplicationRepositoryPaginationConfiguration, + ListApplicationVersionsCommandInput, + ListApplicationVersionsCommandOutput +>(ServerlessApplicationRepositoryClient, ListApplicationVersionsCommand, "NextToken", "NextToken", "MaxItems"); diff --git a/clients/client-serverlessapplicationrepository/src/pagination/ListApplicationsPaginator.ts b/clients/client-serverlessapplicationrepository/src/pagination/ListApplicationsPaginator.ts index f618505b6bbe..7e72dc452e44 100644 --- a/clients/client-serverlessapplicationrepository/src/pagination/ListApplicationsPaginator.ts +++ b/clients/client-serverlessapplicationrepository/src/pagination/ListApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,44 +10,15 @@ import { import { ServerlessApplicationRepositoryClient } from "../ServerlessApplicationRepositoryClient"; import { ServerlessApplicationRepositoryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServerlessApplicationRepositoryClient, - input: ListApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplications( +export const paginateListApplications: ( config: ServerlessApplicationRepositoryPaginationConfiguration, input: ListApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof ServerlessApplicationRepositoryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error( - "Invalid client, expected ServerlessApplicationRepository | ServerlessApplicationRepositoryClient" - ); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServerlessApplicationRepositoryPaginationConfiguration, + ListApplicationsCommandInput, + ListApplicationsCommandOutput +>(ServerlessApplicationRepositoryClient, ListApplicationsCommand, "NextToken", "NextToken", "MaxItems"); diff --git a/clients/client-service-catalog-appregistry/src/pagination/ListApplicationsPaginator.ts b/clients/client-service-catalog-appregistry/src/pagination/ListApplicationsPaginator.ts index aa5f9bda5711..5308f66a82bf 100644 --- a/clients/client-service-catalog-appregistry/src/pagination/ListApplicationsPaginator.ts +++ b/clients/client-service-catalog-appregistry/src/pagination/ListApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogAppRegistryClient } from "../ServiceCatalogAppRegistryClient"; import { ServiceCatalogAppRegistryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogAppRegistryClient, - input: ListApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplications( +export const paginateListApplications: ( config: ServiceCatalogAppRegistryPaginationConfiguration, input: ListApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ServiceCatalogAppRegistryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalogAppRegistry | ServiceCatalogAppRegistryClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogAppRegistryPaginationConfiguration, + ListApplicationsCommandInput, + ListApplicationsCommandOutput +>(ServiceCatalogAppRegistryClient, ListApplicationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-service-catalog-appregistry/src/pagination/ListAssociatedAttributeGroupsPaginator.ts b/clients/client-service-catalog-appregistry/src/pagination/ListAssociatedAttributeGroupsPaginator.ts index 24f9aeb7867f..acb17436c5e8 100644 --- a/clients/client-service-catalog-appregistry/src/pagination/ListAssociatedAttributeGroupsPaginator.ts +++ b/clients/client-service-catalog-appregistry/src/pagination/ListAssociatedAttributeGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogAppRegistryClient } from "../ServiceCatalogAppRegistryClient"; import { ServiceCatalogAppRegistryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogAppRegistryClient, - input: ListAssociatedAttributeGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssociatedAttributeGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssociatedAttributeGroups( +export const paginateListAssociatedAttributeGroups: ( config: ServiceCatalogAppRegistryPaginationConfiguration, input: ListAssociatedAttributeGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssociatedAttributeGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ServiceCatalogAppRegistryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalogAppRegistry | ServiceCatalogAppRegistryClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogAppRegistryPaginationConfiguration, + ListAssociatedAttributeGroupsCommandInput, + ListAssociatedAttributeGroupsCommandOutput +>(ServiceCatalogAppRegistryClient, ListAssociatedAttributeGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-service-catalog-appregistry/src/pagination/ListAssociatedResourcesPaginator.ts b/clients/client-service-catalog-appregistry/src/pagination/ListAssociatedResourcesPaginator.ts index f8c28f085f3a..f38dbdbe2768 100644 --- a/clients/client-service-catalog-appregistry/src/pagination/ListAssociatedResourcesPaginator.ts +++ b/clients/client-service-catalog-appregistry/src/pagination/ListAssociatedResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogAppRegistryClient } from "../ServiceCatalogAppRegistryClient"; import { ServiceCatalogAppRegistryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogAppRegistryClient, - input: ListAssociatedResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssociatedResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssociatedResources( +export const paginateListAssociatedResources: ( config: ServiceCatalogAppRegistryPaginationConfiguration, input: ListAssociatedResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssociatedResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ServiceCatalogAppRegistryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalogAppRegistry | ServiceCatalogAppRegistryClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogAppRegistryPaginationConfiguration, + ListAssociatedResourcesCommandInput, + ListAssociatedResourcesCommandOutput +>(ServiceCatalogAppRegistryClient, ListAssociatedResourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-service-catalog-appregistry/src/pagination/ListAttributeGroupsForApplicationPaginator.ts b/clients/client-service-catalog-appregistry/src/pagination/ListAttributeGroupsForApplicationPaginator.ts index 24ea8fd4abc0..9a08f274f285 100644 --- a/clients/client-service-catalog-appregistry/src/pagination/ListAttributeGroupsForApplicationPaginator.ts +++ b/clients/client-service-catalog-appregistry/src/pagination/ListAttributeGroupsForApplicationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogAppRegistryClient } from "../ServiceCatalogAppRegistryClient"; import { ServiceCatalogAppRegistryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogAppRegistryClient, - input: ListAttributeGroupsForApplicationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAttributeGroupsForApplicationCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAttributeGroupsForApplication( +export const paginateListAttributeGroupsForApplication: ( config: ServiceCatalogAppRegistryPaginationConfiguration, input: ListAttributeGroupsForApplicationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAttributeGroupsForApplicationCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ServiceCatalogAppRegistryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalogAppRegistry | ServiceCatalogAppRegistryClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogAppRegistryPaginationConfiguration, + ListAttributeGroupsForApplicationCommandInput, + ListAttributeGroupsForApplicationCommandOutput +>(ServiceCatalogAppRegistryClient, ListAttributeGroupsForApplicationCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-service-catalog-appregistry/src/pagination/ListAttributeGroupsPaginator.ts b/clients/client-service-catalog-appregistry/src/pagination/ListAttributeGroupsPaginator.ts index 1b16d6e87028..8a7c62f1eb2b 100644 --- a/clients/client-service-catalog-appregistry/src/pagination/ListAttributeGroupsPaginator.ts +++ b/clients/client-service-catalog-appregistry/src/pagination/ListAttributeGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogAppRegistryClient } from "../ServiceCatalogAppRegistryClient"; import { ServiceCatalogAppRegistryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogAppRegistryClient, - input: ListAttributeGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAttributeGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAttributeGroups( +export const paginateListAttributeGroups: ( config: ServiceCatalogAppRegistryPaginationConfiguration, input: ListAttributeGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAttributeGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof ServiceCatalogAppRegistryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalogAppRegistry | ServiceCatalogAppRegistryClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogAppRegistryPaginationConfiguration, + ListAttributeGroupsCommandInput, + ListAttributeGroupsCommandOutput +>(ServiceCatalogAppRegistryClient, ListAttributeGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-service-catalog/package.json b/clients/client-service-catalog/package.json index e4beadd92f47..b358d99db4f2 100644 --- a/clients/client-service-catalog/package.json +++ b/clients/client-service-catalog/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-service-catalog/src/pagination/DescribePortfolioSharesPaginator.ts b/clients/client-service-catalog/src/pagination/DescribePortfolioSharesPaginator.ts index 85955672c941..fbc209c8fbae 100644 --- a/clients/client-service-catalog/src/pagination/DescribePortfolioSharesPaginator.ts +++ b/clients/client-service-catalog/src/pagination/DescribePortfolioSharesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: DescribePortfolioSharesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePortfolioSharesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePortfolioShares( +export const paginateDescribePortfolioShares: ( config: ServiceCatalogPaginationConfiguration, input: DescribePortfolioSharesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePortfolioSharesCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + DescribePortfolioSharesCommandInput, + DescribePortfolioSharesCommandOutput +>(ServiceCatalogClient, DescribePortfolioSharesCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/GetProvisionedProductOutputsPaginator.ts b/clients/client-service-catalog/src/pagination/GetProvisionedProductOutputsPaginator.ts index b650e58709ae..34a69eda7031 100644 --- a/clients/client-service-catalog/src/pagination/GetProvisionedProductOutputsPaginator.ts +++ b/clients/client-service-catalog/src/pagination/GetProvisionedProductOutputsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: GetProvisionedProductOutputsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetProvisionedProductOutputsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetProvisionedProductOutputs( +export const paginateGetProvisionedProductOutputs: ( config: ServiceCatalogPaginationConfiguration, input: GetProvisionedProductOutputsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetProvisionedProductOutputsCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + GetProvisionedProductOutputsCommandInput, + GetProvisionedProductOutputsCommandOutput +>(ServiceCatalogClient, GetProvisionedProductOutputsCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/ListAcceptedPortfolioSharesPaginator.ts b/clients/client-service-catalog/src/pagination/ListAcceptedPortfolioSharesPaginator.ts index 959b2c9ac02f..848c56599f33 100644 --- a/clients/client-service-catalog/src/pagination/ListAcceptedPortfolioSharesPaginator.ts +++ b/clients/client-service-catalog/src/pagination/ListAcceptedPortfolioSharesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: ListAcceptedPortfolioSharesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAcceptedPortfolioSharesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAcceptedPortfolioShares( +export const paginateListAcceptedPortfolioShares: ( config: ServiceCatalogPaginationConfiguration, input: ListAcceptedPortfolioSharesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAcceptedPortfolioSharesCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + ListAcceptedPortfolioSharesCommandInput, + ListAcceptedPortfolioSharesCommandOutput +>(ServiceCatalogClient, ListAcceptedPortfolioSharesCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/ListBudgetsForResourcePaginator.ts b/clients/client-service-catalog/src/pagination/ListBudgetsForResourcePaginator.ts index 80b548570824..d6d8461dea04 100644 --- a/clients/client-service-catalog/src/pagination/ListBudgetsForResourcePaginator.ts +++ b/clients/client-service-catalog/src/pagination/ListBudgetsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: ListBudgetsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBudgetsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBudgetsForResource( +export const paginateListBudgetsForResource: ( config: ServiceCatalogPaginationConfiguration, input: ListBudgetsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBudgetsForResourceCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + ListBudgetsForResourceCommandInput, + ListBudgetsForResourceCommandOutput +>(ServiceCatalogClient, ListBudgetsForResourceCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/ListConstraintsForPortfolioPaginator.ts b/clients/client-service-catalog/src/pagination/ListConstraintsForPortfolioPaginator.ts index 7c957554fc62..893ac679b71f 100644 --- a/clients/client-service-catalog/src/pagination/ListConstraintsForPortfolioPaginator.ts +++ b/clients/client-service-catalog/src/pagination/ListConstraintsForPortfolioPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: ListConstraintsForPortfolioCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConstraintsForPortfolioCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConstraintsForPortfolio( +export const paginateListConstraintsForPortfolio: ( config: ServiceCatalogPaginationConfiguration, input: ListConstraintsForPortfolioCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConstraintsForPortfolioCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + ListConstraintsForPortfolioCommandInput, + ListConstraintsForPortfolioCommandOutput +>(ServiceCatalogClient, ListConstraintsForPortfolioCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/ListLaunchPathsPaginator.ts b/clients/client-service-catalog/src/pagination/ListLaunchPathsPaginator.ts index b7cc6d8f9e08..ec057b297d38 100644 --- a/clients/client-service-catalog/src/pagination/ListLaunchPathsPaginator.ts +++ b/clients/client-service-catalog/src/pagination/ListLaunchPathsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: ListLaunchPathsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLaunchPathsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLaunchPaths( +export const paginateListLaunchPaths: ( config: ServiceCatalogPaginationConfiguration, input: ListLaunchPathsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLaunchPathsCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + ListLaunchPathsCommandInput, + ListLaunchPathsCommandOutput +>(ServiceCatalogClient, ListLaunchPathsCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/ListOrganizationPortfolioAccessPaginator.ts b/clients/client-service-catalog/src/pagination/ListOrganizationPortfolioAccessPaginator.ts index 4b7e31b973c5..3c76b63b98bf 100644 --- a/clients/client-service-catalog/src/pagination/ListOrganizationPortfolioAccessPaginator.ts +++ b/clients/client-service-catalog/src/pagination/ListOrganizationPortfolioAccessPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: ListOrganizationPortfolioAccessCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOrganizationPortfolioAccessCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOrganizationPortfolioAccess( +export const paginateListOrganizationPortfolioAccess: ( config: ServiceCatalogPaginationConfiguration, input: ListOrganizationPortfolioAccessCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOrganizationPortfolioAccessCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + ListOrganizationPortfolioAccessCommandInput, + ListOrganizationPortfolioAccessCommandOutput +>(ServiceCatalogClient, ListOrganizationPortfolioAccessCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/ListPortfolioAccessPaginator.ts b/clients/client-service-catalog/src/pagination/ListPortfolioAccessPaginator.ts index cc52024e639c..b845b06f3575 100644 --- a/clients/client-service-catalog/src/pagination/ListPortfolioAccessPaginator.ts +++ b/clients/client-service-catalog/src/pagination/ListPortfolioAccessPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: ListPortfolioAccessCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPortfolioAccessCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPortfolioAccess( +export const paginateListPortfolioAccess: ( config: ServiceCatalogPaginationConfiguration, input: ListPortfolioAccessCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPortfolioAccessCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + ListPortfolioAccessCommandInput, + ListPortfolioAccessCommandOutput +>(ServiceCatalogClient, ListPortfolioAccessCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/ListPortfoliosForProductPaginator.ts b/clients/client-service-catalog/src/pagination/ListPortfoliosForProductPaginator.ts index e3f62018fe90..43ce1c78f1ef 100644 --- a/clients/client-service-catalog/src/pagination/ListPortfoliosForProductPaginator.ts +++ b/clients/client-service-catalog/src/pagination/ListPortfoliosForProductPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: ListPortfoliosForProductCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPortfoliosForProductCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPortfoliosForProduct( +export const paginateListPortfoliosForProduct: ( config: ServiceCatalogPaginationConfiguration, input: ListPortfoliosForProductCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPortfoliosForProductCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + ListPortfoliosForProductCommandInput, + ListPortfoliosForProductCommandOutput +>(ServiceCatalogClient, ListPortfoliosForProductCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/ListPortfoliosPaginator.ts b/clients/client-service-catalog/src/pagination/ListPortfoliosPaginator.ts index 7447f0807835..de8e926cd371 100644 --- a/clients/client-service-catalog/src/pagination/ListPortfoliosPaginator.ts +++ b/clients/client-service-catalog/src/pagination/ListPortfoliosPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: ListPortfoliosCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPortfoliosCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPortfolios( +export const paginateListPortfolios: ( config: ServiceCatalogPaginationConfiguration, input: ListPortfoliosCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPortfoliosCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + ListPortfoliosCommandInput, + ListPortfoliosCommandOutput +>(ServiceCatalogClient, ListPortfoliosCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/ListPrincipalsForPortfolioPaginator.ts b/clients/client-service-catalog/src/pagination/ListPrincipalsForPortfolioPaginator.ts index d91ced735aa8..2a4631d207f7 100644 --- a/clients/client-service-catalog/src/pagination/ListPrincipalsForPortfolioPaginator.ts +++ b/clients/client-service-catalog/src/pagination/ListPrincipalsForPortfolioPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: ListPrincipalsForPortfolioCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPrincipalsForPortfolioCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPrincipalsForPortfolio( +export const paginateListPrincipalsForPortfolio: ( config: ServiceCatalogPaginationConfiguration, input: ListPrincipalsForPortfolioCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPrincipalsForPortfolioCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + ListPrincipalsForPortfolioCommandInput, + ListPrincipalsForPortfolioCommandOutput +>(ServiceCatalogClient, ListPrincipalsForPortfolioCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/ListProvisioningArtifactsForServiceActionPaginator.ts b/clients/client-service-catalog/src/pagination/ListProvisioningArtifactsForServiceActionPaginator.ts index 9ef7787c681f..1d8449d6fea1 100644 --- a/clients/client-service-catalog/src/pagination/ListProvisioningArtifactsForServiceActionPaginator.ts +++ b/clients/client-service-catalog/src/pagination/ListProvisioningArtifactsForServiceActionPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: ListProvisioningArtifactsForServiceActionCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProvisioningArtifactsForServiceActionCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProvisioningArtifactsForServiceAction( +export const paginateListProvisioningArtifactsForServiceAction: ( config: ServiceCatalogPaginationConfiguration, input: ListProvisioningArtifactsForServiceActionCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProvisioningArtifactsForServiceActionCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + ListProvisioningArtifactsForServiceActionCommandInput, + ListProvisioningArtifactsForServiceActionCommandOutput +>(ServiceCatalogClient, ListProvisioningArtifactsForServiceActionCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/ListResourcesForTagOptionPaginator.ts b/clients/client-service-catalog/src/pagination/ListResourcesForTagOptionPaginator.ts index 0f0fa69c6a2d..1057ad266588 100644 --- a/clients/client-service-catalog/src/pagination/ListResourcesForTagOptionPaginator.ts +++ b/clients/client-service-catalog/src/pagination/ListResourcesForTagOptionPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: ListResourcesForTagOptionCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourcesForTagOptionCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourcesForTagOption( +export const paginateListResourcesForTagOption: ( config: ServiceCatalogPaginationConfiguration, input: ListResourcesForTagOptionCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourcesForTagOptionCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.PageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + ListResourcesForTagOptionCommandInput, + ListResourcesForTagOptionCommandOutput +>(ServiceCatalogClient, ListResourcesForTagOptionCommand, "PageToken", "PageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/ListServiceActionsForProvisioningArtifactPaginator.ts b/clients/client-service-catalog/src/pagination/ListServiceActionsForProvisioningArtifactPaginator.ts index f7a38c21dafc..e5eb446f079d 100644 --- a/clients/client-service-catalog/src/pagination/ListServiceActionsForProvisioningArtifactPaginator.ts +++ b/clients/client-service-catalog/src/pagination/ListServiceActionsForProvisioningArtifactPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: ListServiceActionsForProvisioningArtifactCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServiceActionsForProvisioningArtifactCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServiceActionsForProvisioningArtifact( +export const paginateListServiceActionsForProvisioningArtifact: ( config: ServiceCatalogPaginationConfiguration, input: ListServiceActionsForProvisioningArtifactCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServiceActionsForProvisioningArtifactCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + ListServiceActionsForProvisioningArtifactCommandInput, + ListServiceActionsForProvisioningArtifactCommandOutput +>(ServiceCatalogClient, ListServiceActionsForProvisioningArtifactCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/ListServiceActionsPaginator.ts b/clients/client-service-catalog/src/pagination/ListServiceActionsPaginator.ts index ca4056bac8df..b6dbda186951 100644 --- a/clients/client-service-catalog/src/pagination/ListServiceActionsPaginator.ts +++ b/clients/client-service-catalog/src/pagination/ListServiceActionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: ListServiceActionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServiceActionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServiceActions( +export const paginateListServiceActions: ( config: ServiceCatalogPaginationConfiguration, input: ListServiceActionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServiceActionsCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + ListServiceActionsCommandInput, + ListServiceActionsCommandOutput +>(ServiceCatalogClient, ListServiceActionsCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/ListTagOptionsPaginator.ts b/clients/client-service-catalog/src/pagination/ListTagOptionsPaginator.ts index c17c806e1c54..f738ee1b05e4 100644 --- a/clients/client-service-catalog/src/pagination/ListTagOptionsPaginator.ts +++ b/clients/client-service-catalog/src/pagination/ListTagOptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: ListTagOptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagOptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagOptions( +export const paginateListTagOptions: ( config: ServiceCatalogPaginationConfiguration, input: ListTagOptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagOptionsCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.PageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + ListTagOptionsCommandInput, + ListTagOptionsCommandOutput +>(ServiceCatalogClient, ListTagOptionsCommand, "PageToken", "PageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/SearchProductsAsAdminPaginator.ts b/clients/client-service-catalog/src/pagination/SearchProductsAsAdminPaginator.ts index f3dcabc1ddf7..b0444b18a446 100644 --- a/clients/client-service-catalog/src/pagination/SearchProductsAsAdminPaginator.ts +++ b/clients/client-service-catalog/src/pagination/SearchProductsAsAdminPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: SearchProductsAsAdminCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchProductsAsAdminCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchProductsAsAdmin( +export const paginateSearchProductsAsAdmin: ( config: ServiceCatalogPaginationConfiguration, input: SearchProductsAsAdminCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchProductsAsAdminCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + SearchProductsAsAdminCommandInput, + SearchProductsAsAdminCommandOutput +>(ServiceCatalogClient, SearchProductsAsAdminCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/SearchProductsPaginator.ts b/clients/client-service-catalog/src/pagination/SearchProductsPaginator.ts index 5b55240a9758..e7a9de495df6 100644 --- a/clients/client-service-catalog/src/pagination/SearchProductsPaginator.ts +++ b/clients/client-service-catalog/src/pagination/SearchProductsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: SearchProductsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchProductsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchProducts( +export const paginateSearchProducts: ( config: ServiceCatalogPaginationConfiguration, input: SearchProductsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchProductsCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + SearchProductsCommandInput, + SearchProductsCommandOutput +>(ServiceCatalogClient, SearchProductsCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-catalog/src/pagination/SearchProvisionedProductsPaginator.ts b/clients/client-service-catalog/src/pagination/SearchProvisionedProductsPaginator.ts index 00ff2d5512c9..3a57aa016915 100644 --- a/clients/client-service-catalog/src/pagination/SearchProvisionedProductsPaginator.ts +++ b/clients/client-service-catalog/src/pagination/SearchProvisionedProductsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceCatalogClient } from "../ServiceCatalogClient"; import { ServiceCatalogPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceCatalogClient, - input: SearchProvisionedProductsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchProvisionedProductsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchProvisionedProducts( +export const paginateSearchProvisionedProducts: ( config: ServiceCatalogPaginationConfiguration, input: SearchProvisionedProductsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.PageToken - let token: typeof input.PageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchProvisionedProductsCommandOutput; - while (hasNext) { - input.PageToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof ServiceCatalogClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceCatalog | ServiceCatalogClient"); - } - yield page; - const prevToken = token; - token = page.NextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceCatalogPaginationConfiguration, + SearchProvisionedProductsCommandInput, + SearchProvisionedProductsCommandOutput +>(ServiceCatalogClient, SearchProvisionedProductsCommand, "PageToken", "NextPageToken", "PageSize"); diff --git a/clients/client-service-quotas/package.json b/clients/client-service-quotas/package.json index 925ed9ac93f5..d6f3fd2a56df 100644 --- a/clients/client-service-quotas/package.json +++ b/clients/client-service-quotas/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-service-quotas/src/pagination/ListAWSDefaultServiceQuotasPaginator.ts b/clients/client-service-quotas/src/pagination/ListAWSDefaultServiceQuotasPaginator.ts index c345985d8f1b..d4bed0a35b26 100644 --- a/clients/client-service-quotas/src/pagination/ListAWSDefaultServiceQuotasPaginator.ts +++ b/clients/client-service-quotas/src/pagination/ListAWSDefaultServiceQuotasPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceQuotasClient } from "../ServiceQuotasClient"; import { ServiceQuotasPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceQuotasClient, - input: ListAWSDefaultServiceQuotasCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAWSDefaultServiceQuotasCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAWSDefaultServiceQuotas( +export const paginateListAWSDefaultServiceQuotas: ( config: ServiceQuotasPaginationConfiguration, input: ListAWSDefaultServiceQuotasCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAWSDefaultServiceQuotasCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ServiceQuotasClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceQuotas | ServiceQuotasClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceQuotasPaginationConfiguration, + ListAWSDefaultServiceQuotasCommandInput, + ListAWSDefaultServiceQuotasCommandOutput +>(ServiceQuotasClient, ListAWSDefaultServiceQuotasCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-service-quotas/src/pagination/ListRequestedServiceQuotaChangeHistoryByQuotaPaginator.ts b/clients/client-service-quotas/src/pagination/ListRequestedServiceQuotaChangeHistoryByQuotaPaginator.ts index a31f25080976..f2725660a5c3 100644 --- a/clients/client-service-quotas/src/pagination/ListRequestedServiceQuotaChangeHistoryByQuotaPaginator.ts +++ b/clients/client-service-quotas/src/pagination/ListRequestedServiceQuotaChangeHistoryByQuotaPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceQuotasClient } from "../ServiceQuotasClient"; import { ServiceQuotasPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceQuotasClient, - input: ListRequestedServiceQuotaChangeHistoryByQuotaCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRequestedServiceQuotaChangeHistoryByQuotaCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRequestedServiceQuotaChangeHistoryByQuota( +export const paginateListRequestedServiceQuotaChangeHistoryByQuota: ( config: ServiceQuotasPaginationConfiguration, input: ListRequestedServiceQuotaChangeHistoryByQuotaCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRequestedServiceQuotaChangeHistoryByQuotaCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ServiceQuotasClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceQuotas | ServiceQuotasClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceQuotasPaginationConfiguration, + ListRequestedServiceQuotaChangeHistoryByQuotaCommandInput, + ListRequestedServiceQuotaChangeHistoryByQuotaCommandOutput +>(ServiceQuotasClient, ListRequestedServiceQuotaChangeHistoryByQuotaCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-service-quotas/src/pagination/ListRequestedServiceQuotaChangeHistoryPaginator.ts b/clients/client-service-quotas/src/pagination/ListRequestedServiceQuotaChangeHistoryPaginator.ts index 954aafd8b1a6..44d77145c098 100644 --- a/clients/client-service-quotas/src/pagination/ListRequestedServiceQuotaChangeHistoryPaginator.ts +++ b/clients/client-service-quotas/src/pagination/ListRequestedServiceQuotaChangeHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceQuotasClient } from "../ServiceQuotasClient"; import { ServiceQuotasPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceQuotasClient, - input: ListRequestedServiceQuotaChangeHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRequestedServiceQuotaChangeHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRequestedServiceQuotaChangeHistory( +export const paginateListRequestedServiceQuotaChangeHistory: ( config: ServiceQuotasPaginationConfiguration, input: ListRequestedServiceQuotaChangeHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRequestedServiceQuotaChangeHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ServiceQuotasClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceQuotas | ServiceQuotasClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceQuotasPaginationConfiguration, + ListRequestedServiceQuotaChangeHistoryCommandInput, + ListRequestedServiceQuotaChangeHistoryCommandOutput +>(ServiceQuotasClient, ListRequestedServiceQuotaChangeHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-service-quotas/src/pagination/ListServiceQuotaIncreaseRequestsInTemplatePaginator.ts b/clients/client-service-quotas/src/pagination/ListServiceQuotaIncreaseRequestsInTemplatePaginator.ts index 2f83bb388c30..75c010f1037e 100644 --- a/clients/client-service-quotas/src/pagination/ListServiceQuotaIncreaseRequestsInTemplatePaginator.ts +++ b/clients/client-service-quotas/src/pagination/ListServiceQuotaIncreaseRequestsInTemplatePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceQuotasClient } from "../ServiceQuotasClient"; import { ServiceQuotasPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceQuotasClient, - input: ListServiceQuotaIncreaseRequestsInTemplateCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServiceQuotaIncreaseRequestsInTemplateCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServiceQuotaIncreaseRequestsInTemplate( +export const paginateListServiceQuotaIncreaseRequestsInTemplate: ( config: ServiceQuotasPaginationConfiguration, input: ListServiceQuotaIncreaseRequestsInTemplateCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServiceQuotaIncreaseRequestsInTemplateCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ServiceQuotasClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceQuotas | ServiceQuotasClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceQuotasPaginationConfiguration, + ListServiceQuotaIncreaseRequestsInTemplateCommandInput, + ListServiceQuotaIncreaseRequestsInTemplateCommandOutput +>(ServiceQuotasClient, ListServiceQuotaIncreaseRequestsInTemplateCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-service-quotas/src/pagination/ListServiceQuotasPaginator.ts b/clients/client-service-quotas/src/pagination/ListServiceQuotasPaginator.ts index de79dd477835..670f4e98a4f5 100644 --- a/clients/client-service-quotas/src/pagination/ListServiceQuotasPaginator.ts +++ b/clients/client-service-quotas/src/pagination/ListServiceQuotasPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceQuotasClient } from "../ServiceQuotasClient"; import { ServiceQuotasPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceQuotasClient, - input: ListServiceQuotasCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServiceQuotasCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServiceQuotas( +export const paginateListServiceQuotas: ( config: ServiceQuotasPaginationConfiguration, input: ListServiceQuotasCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServiceQuotasCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ServiceQuotasClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceQuotas | ServiceQuotasClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceQuotasPaginationConfiguration, + ListServiceQuotasCommandInput, + ListServiceQuotasCommandOutput +>(ServiceQuotasClient, ListServiceQuotasCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-service-quotas/src/pagination/ListServicesPaginator.ts b/clients/client-service-quotas/src/pagination/ListServicesPaginator.ts index 1df5f3bff0d4..84b5ae0ed736 100644 --- a/clients/client-service-quotas/src/pagination/ListServicesPaginator.ts +++ b/clients/client-service-quotas/src/pagination/ListServicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceQuotasClient } from "../ServiceQuotasClient"; import { ServiceQuotasPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceQuotasClient, - input: ListServicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServices( +export const paginateListServices: ( config: ServiceQuotasPaginationConfiguration, input: ListServicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ServiceQuotasClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceQuotas | ServiceQuotasClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceQuotasPaginationConfiguration, + ListServicesCommandInput, + ListServicesCommandOutput +>(ServiceQuotasClient, ListServicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-servicediscovery/package.json b/clients/client-servicediscovery/package.json index 712d45464c45..fbf942f4d3b5 100644 --- a/clients/client-servicediscovery/package.json +++ b/clients/client-servicediscovery/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-servicediscovery/src/pagination/GetInstancesHealthStatusPaginator.ts b/clients/client-servicediscovery/src/pagination/GetInstancesHealthStatusPaginator.ts index a16cdad24af5..459037d76d75 100644 --- a/clients/client-servicediscovery/src/pagination/GetInstancesHealthStatusPaginator.ts +++ b/clients/client-servicediscovery/src/pagination/GetInstancesHealthStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceDiscoveryClient } from "../ServiceDiscoveryClient"; import { ServiceDiscoveryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceDiscoveryClient, - input: GetInstancesHealthStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetInstancesHealthStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetInstancesHealthStatus( +export const paginateGetInstancesHealthStatus: ( config: ServiceDiscoveryPaginationConfiguration, input: GetInstancesHealthStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetInstancesHealthStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ServiceDiscoveryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceDiscovery | ServiceDiscoveryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceDiscoveryPaginationConfiguration, + GetInstancesHealthStatusCommandInput, + GetInstancesHealthStatusCommandOutput +>(ServiceDiscoveryClient, GetInstancesHealthStatusCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-servicediscovery/src/pagination/ListInstancesPaginator.ts b/clients/client-servicediscovery/src/pagination/ListInstancesPaginator.ts index 5d6f3b9bb485..43e6a97dbc31 100644 --- a/clients/client-servicediscovery/src/pagination/ListInstancesPaginator.ts +++ b/clients/client-servicediscovery/src/pagination/ListInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceDiscoveryClient } from "../ServiceDiscoveryClient"; import { ServiceDiscoveryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceDiscoveryClient, - input: ListInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInstances( +export const paginateListInstances: ( config: ServiceDiscoveryPaginationConfiguration, input: ListInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ServiceDiscoveryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceDiscovery | ServiceDiscoveryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceDiscoveryPaginationConfiguration, + ListInstancesCommandInput, + ListInstancesCommandOutput +>(ServiceDiscoveryClient, ListInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-servicediscovery/src/pagination/ListNamespacesPaginator.ts b/clients/client-servicediscovery/src/pagination/ListNamespacesPaginator.ts index d8da6ab15311..3ab588b2cf8e 100644 --- a/clients/client-servicediscovery/src/pagination/ListNamespacesPaginator.ts +++ b/clients/client-servicediscovery/src/pagination/ListNamespacesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceDiscoveryClient } from "../ServiceDiscoveryClient"; import { ServiceDiscoveryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceDiscoveryClient, - input: ListNamespacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNamespacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNamespaces( +export const paginateListNamespaces: ( config: ServiceDiscoveryPaginationConfiguration, input: ListNamespacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNamespacesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ServiceDiscoveryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceDiscovery | ServiceDiscoveryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceDiscoveryPaginationConfiguration, + ListNamespacesCommandInput, + ListNamespacesCommandOutput +>(ServiceDiscoveryClient, ListNamespacesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-servicediscovery/src/pagination/ListOperationsPaginator.ts b/clients/client-servicediscovery/src/pagination/ListOperationsPaginator.ts index 81a89a0e26c4..849698ae2020 100644 --- a/clients/client-servicediscovery/src/pagination/ListOperationsPaginator.ts +++ b/clients/client-servicediscovery/src/pagination/ListOperationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceDiscoveryClient } from "../ServiceDiscoveryClient"; import { ServiceDiscoveryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceDiscoveryClient, - input: ListOperationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOperationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOperations( +export const paginateListOperations: ( config: ServiceDiscoveryPaginationConfiguration, input: ListOperationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOperationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ServiceDiscoveryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceDiscovery | ServiceDiscoveryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceDiscoveryPaginationConfiguration, + ListOperationsCommandInput, + ListOperationsCommandOutput +>(ServiceDiscoveryClient, ListOperationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-servicediscovery/src/pagination/ListServicesPaginator.ts b/clients/client-servicediscovery/src/pagination/ListServicesPaginator.ts index d62f60e10b8c..104e5df8bc17 100644 --- a/clients/client-servicediscovery/src/pagination/ListServicesPaginator.ts +++ b/clients/client-servicediscovery/src/pagination/ListServicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ServiceDiscoveryClient } from "../ServiceDiscoveryClient"; import { ServiceDiscoveryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ServiceDiscoveryClient, - input: ListServicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServices( +export const paginateListServices: ( config: ServiceDiscoveryPaginationConfiguration, input: ListServicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ServiceDiscoveryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected ServiceDiscovery | ServiceDiscoveryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ServiceDiscoveryPaginationConfiguration, + ListServicesCommandInput, + ListServicesCommandOutput +>(ServiceDiscoveryClient, ListServicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ses/package.json b/clients/client-ses/package.json index f219903436c6..24079a39e824 100644 --- a/clients/client-ses/package.json +++ b/clients/client-ses/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-ses/src/pagination/ListCustomVerificationEmailTemplatesPaginator.ts b/clients/client-ses/src/pagination/ListCustomVerificationEmailTemplatesPaginator.ts index 6d4868cdcaf3..100b5fb90730 100644 --- a/clients/client-ses/src/pagination/ListCustomVerificationEmailTemplatesPaginator.ts +++ b/clients/client-ses/src/pagination/ListCustomVerificationEmailTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESClient } from "../SESClient"; import { SESPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESClient, - input: ListCustomVerificationEmailTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomVerificationEmailTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomVerificationEmailTemplates( +export const paginateListCustomVerificationEmailTemplates: ( config: SESPaginationConfiguration, input: ListCustomVerificationEmailTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomVerificationEmailTemplatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SESClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SES | SESClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESPaginationConfiguration, + ListCustomVerificationEmailTemplatesCommandInput, + ListCustomVerificationEmailTemplatesCommandOutput +>(SESClient, ListCustomVerificationEmailTemplatesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ses/src/pagination/ListIdentitiesPaginator.ts b/clients/client-ses/src/pagination/ListIdentitiesPaginator.ts index a9edb2f076e9..958f8a7003b0 100644 --- a/clients/client-ses/src/pagination/ListIdentitiesPaginator.ts +++ b/clients/client-ses/src/pagination/ListIdentitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESClient } from "../SESClient"; import { SESPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESClient, - input: ListIdentitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIdentitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIdentities( +export const paginateListIdentities: ( config: SESPaginationConfiguration, input: ListIdentitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIdentitiesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxItems"] = config.pageSize; - if (config.client instanceof SESClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SES | SESClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESPaginationConfiguration, + ListIdentitiesCommandInput, + ListIdentitiesCommandOutput +>(SESClient, ListIdentitiesCommand, "NextToken", "NextToken", "MaxItems"); diff --git a/clients/client-sesv2/src/pagination/GetDedicatedIpsPaginator.ts b/clients/client-sesv2/src/pagination/GetDedicatedIpsPaginator.ts index 2e25b15ccf18..2d86383993eb 100644 --- a/clients/client-sesv2/src/pagination/GetDedicatedIpsPaginator.ts +++ b/clients/client-sesv2/src/pagination/GetDedicatedIpsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESv2Client } from "../SESv2Client"; import { SESv2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESv2Client, - input: GetDedicatedIpsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetDedicatedIpsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetDedicatedIps( +export const paginateGetDedicatedIps: ( config: SESv2PaginationConfiguration, input: GetDedicatedIpsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetDedicatedIpsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof SESv2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SESv2 | SESv2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESv2PaginationConfiguration, + GetDedicatedIpsCommandInput, + GetDedicatedIpsCommandOutput +>(SESv2Client, GetDedicatedIpsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-sesv2/src/pagination/ListConfigurationSetsPaginator.ts b/clients/client-sesv2/src/pagination/ListConfigurationSetsPaginator.ts index d40309c65a17..d85a8711b24b 100644 --- a/clients/client-sesv2/src/pagination/ListConfigurationSetsPaginator.ts +++ b/clients/client-sesv2/src/pagination/ListConfigurationSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESv2Client } from "../SESv2Client"; import { SESv2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESv2Client, - input: ListConfigurationSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConfigurationSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConfigurationSets( +export const paginateListConfigurationSets: ( config: SESv2PaginationConfiguration, input: ListConfigurationSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConfigurationSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof SESv2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SESv2 | SESv2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESv2PaginationConfiguration, + ListConfigurationSetsCommandInput, + ListConfigurationSetsCommandOutput +>(SESv2Client, ListConfigurationSetsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-sesv2/src/pagination/ListContactListsPaginator.ts b/clients/client-sesv2/src/pagination/ListContactListsPaginator.ts index 7a0d38dcaf8c..1270d480ae1f 100644 --- a/clients/client-sesv2/src/pagination/ListContactListsPaginator.ts +++ b/clients/client-sesv2/src/pagination/ListContactListsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESv2Client } from "../SESv2Client"; import { SESv2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESv2Client, - input: ListContactListsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContactListsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContactLists( +export const paginateListContactLists: ( config: SESv2PaginationConfiguration, input: ListContactListsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContactListsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof SESv2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SESv2 | SESv2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESv2PaginationConfiguration, + ListContactListsCommandInput, + ListContactListsCommandOutput +>(SESv2Client, ListContactListsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-sesv2/src/pagination/ListContactsPaginator.ts b/clients/client-sesv2/src/pagination/ListContactsPaginator.ts index 0b367015b28c..b14ffd6b88f2 100644 --- a/clients/client-sesv2/src/pagination/ListContactsPaginator.ts +++ b/clients/client-sesv2/src/pagination/ListContactsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESv2Client } from "../SESv2Client"; import { SESv2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESv2Client, - input: ListContactsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContactsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContacts( +export const paginateListContacts: ( config: SESv2PaginationConfiguration, input: ListContactsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContactsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof SESv2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SESv2 | SESv2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESv2PaginationConfiguration, + ListContactsCommandInput, + ListContactsCommandOutput +>(SESv2Client, ListContactsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-sesv2/src/pagination/ListCustomVerificationEmailTemplatesPaginator.ts b/clients/client-sesv2/src/pagination/ListCustomVerificationEmailTemplatesPaginator.ts index 8ec5e5731050..3778da9a4633 100644 --- a/clients/client-sesv2/src/pagination/ListCustomVerificationEmailTemplatesPaginator.ts +++ b/clients/client-sesv2/src/pagination/ListCustomVerificationEmailTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESv2Client } from "../SESv2Client"; import { SESv2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESv2Client, - input: ListCustomVerificationEmailTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomVerificationEmailTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomVerificationEmailTemplates( +export const paginateListCustomVerificationEmailTemplates: ( config: SESv2PaginationConfiguration, input: ListCustomVerificationEmailTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomVerificationEmailTemplatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof SESv2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SESv2 | SESv2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESv2PaginationConfiguration, + ListCustomVerificationEmailTemplatesCommandInput, + ListCustomVerificationEmailTemplatesCommandOutput +>(SESv2Client, ListCustomVerificationEmailTemplatesCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-sesv2/src/pagination/ListDedicatedIpPoolsPaginator.ts b/clients/client-sesv2/src/pagination/ListDedicatedIpPoolsPaginator.ts index 1aa04df48834..6cdf8af687cd 100644 --- a/clients/client-sesv2/src/pagination/ListDedicatedIpPoolsPaginator.ts +++ b/clients/client-sesv2/src/pagination/ListDedicatedIpPoolsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESv2Client } from "../SESv2Client"; import { SESv2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESv2Client, - input: ListDedicatedIpPoolsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDedicatedIpPoolsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDedicatedIpPools( +export const paginateListDedicatedIpPools: ( config: SESv2PaginationConfiguration, input: ListDedicatedIpPoolsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDedicatedIpPoolsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof SESv2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SESv2 | SESv2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESv2PaginationConfiguration, + ListDedicatedIpPoolsCommandInput, + ListDedicatedIpPoolsCommandOutput +>(SESv2Client, ListDedicatedIpPoolsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-sesv2/src/pagination/ListDeliverabilityTestReportsPaginator.ts b/clients/client-sesv2/src/pagination/ListDeliverabilityTestReportsPaginator.ts index 94083a636f78..00f592301005 100644 --- a/clients/client-sesv2/src/pagination/ListDeliverabilityTestReportsPaginator.ts +++ b/clients/client-sesv2/src/pagination/ListDeliverabilityTestReportsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESv2Client } from "../SESv2Client"; import { SESv2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESv2Client, - input: ListDeliverabilityTestReportsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeliverabilityTestReportsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeliverabilityTestReports( +export const paginateListDeliverabilityTestReports: ( config: SESv2PaginationConfiguration, input: ListDeliverabilityTestReportsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeliverabilityTestReportsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof SESv2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SESv2 | SESv2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESv2PaginationConfiguration, + ListDeliverabilityTestReportsCommandInput, + ListDeliverabilityTestReportsCommandOutput +>(SESv2Client, ListDeliverabilityTestReportsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-sesv2/src/pagination/ListDomainDeliverabilityCampaignsPaginator.ts b/clients/client-sesv2/src/pagination/ListDomainDeliverabilityCampaignsPaginator.ts index 8b689a80db63..52dfd6ef33b6 100644 --- a/clients/client-sesv2/src/pagination/ListDomainDeliverabilityCampaignsPaginator.ts +++ b/clients/client-sesv2/src/pagination/ListDomainDeliverabilityCampaignsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESv2Client } from "../SESv2Client"; import { SESv2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESv2Client, - input: ListDomainDeliverabilityCampaignsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainDeliverabilityCampaignsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomainDeliverabilityCampaigns( +export const paginateListDomainDeliverabilityCampaigns: ( config: SESv2PaginationConfiguration, input: ListDomainDeliverabilityCampaignsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainDeliverabilityCampaignsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof SESv2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SESv2 | SESv2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESv2PaginationConfiguration, + ListDomainDeliverabilityCampaignsCommandInput, + ListDomainDeliverabilityCampaignsCommandOutput +>(SESv2Client, ListDomainDeliverabilityCampaignsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-sesv2/src/pagination/ListEmailIdentitiesPaginator.ts b/clients/client-sesv2/src/pagination/ListEmailIdentitiesPaginator.ts index e78a5e62a2d2..66f4c2b14510 100644 --- a/clients/client-sesv2/src/pagination/ListEmailIdentitiesPaginator.ts +++ b/clients/client-sesv2/src/pagination/ListEmailIdentitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESv2Client } from "../SESv2Client"; import { SESv2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESv2Client, - input: ListEmailIdentitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEmailIdentitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEmailIdentities( +export const paginateListEmailIdentities: ( config: SESv2PaginationConfiguration, input: ListEmailIdentitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEmailIdentitiesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof SESv2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SESv2 | SESv2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESv2PaginationConfiguration, + ListEmailIdentitiesCommandInput, + ListEmailIdentitiesCommandOutput +>(SESv2Client, ListEmailIdentitiesCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-sesv2/src/pagination/ListEmailTemplatesPaginator.ts b/clients/client-sesv2/src/pagination/ListEmailTemplatesPaginator.ts index e90739855b3b..82f3a668bc69 100644 --- a/clients/client-sesv2/src/pagination/ListEmailTemplatesPaginator.ts +++ b/clients/client-sesv2/src/pagination/ListEmailTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESv2Client } from "../SESv2Client"; import { SESv2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESv2Client, - input: ListEmailTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEmailTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEmailTemplates( +export const paginateListEmailTemplates: ( config: SESv2PaginationConfiguration, input: ListEmailTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEmailTemplatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof SESv2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SESv2 | SESv2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESv2PaginationConfiguration, + ListEmailTemplatesCommandInput, + ListEmailTemplatesCommandOutput +>(SESv2Client, ListEmailTemplatesCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-sesv2/src/pagination/ListExportJobsPaginator.ts b/clients/client-sesv2/src/pagination/ListExportJobsPaginator.ts index bff345db75b6..9c27d765f64b 100644 --- a/clients/client-sesv2/src/pagination/ListExportJobsPaginator.ts +++ b/clients/client-sesv2/src/pagination/ListExportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESv2Client } from "../SESv2Client"; import { SESv2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESv2Client, - input: ListExportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExportJobs( +export const paginateListExportJobs: ( config: SESv2PaginationConfiguration, input: ListExportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExportJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof SESv2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SESv2 | SESv2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESv2PaginationConfiguration, + ListExportJobsCommandInput, + ListExportJobsCommandOutput +>(SESv2Client, ListExportJobsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-sesv2/src/pagination/ListImportJobsPaginator.ts b/clients/client-sesv2/src/pagination/ListImportJobsPaginator.ts index 894b312e9b36..6c506f911d37 100644 --- a/clients/client-sesv2/src/pagination/ListImportJobsPaginator.ts +++ b/clients/client-sesv2/src/pagination/ListImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESv2Client } from "../SESv2Client"; import { SESv2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESv2Client, - input: ListImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImportJobs( +export const paginateListImportJobs: ( config: SESv2PaginationConfiguration, input: ListImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImportJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof SESv2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SESv2 | SESv2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESv2PaginationConfiguration, + ListImportJobsCommandInput, + ListImportJobsCommandOutput +>(SESv2Client, ListImportJobsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-sesv2/src/pagination/ListRecommendationsPaginator.ts b/clients/client-sesv2/src/pagination/ListRecommendationsPaginator.ts index fbabcd6d4005..82514b0f811f 100644 --- a/clients/client-sesv2/src/pagination/ListRecommendationsPaginator.ts +++ b/clients/client-sesv2/src/pagination/ListRecommendationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESv2Client } from "../SESv2Client"; import { SESv2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESv2Client, - input: ListRecommendationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecommendationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecommendations( +export const paginateListRecommendations: ( config: SESv2PaginationConfiguration, input: ListRecommendationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecommendationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof SESv2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SESv2 | SESv2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESv2PaginationConfiguration, + ListRecommendationsCommandInput, + ListRecommendationsCommandOutput +>(SESv2Client, ListRecommendationsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-sesv2/src/pagination/ListSuppressedDestinationsPaginator.ts b/clients/client-sesv2/src/pagination/ListSuppressedDestinationsPaginator.ts index bf7214761676..4be112b89ca5 100644 --- a/clients/client-sesv2/src/pagination/ListSuppressedDestinationsPaginator.ts +++ b/clients/client-sesv2/src/pagination/ListSuppressedDestinationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SESv2Client } from "../SESv2Client"; import { SESv2PaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SESv2Client, - input: ListSuppressedDestinationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSuppressedDestinationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSuppressedDestinations( +export const paginateListSuppressedDestinations: ( config: SESv2PaginationConfiguration, input: ListSuppressedDestinationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSuppressedDestinationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["PageSize"] = config.pageSize; - if (config.client instanceof SESv2Client) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SESv2 | SESv2Client"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SESv2PaginationConfiguration, + ListSuppressedDestinationsCommandInput, + ListSuppressedDestinationsCommandOutput +>(SESv2Client, ListSuppressedDestinationsCommand, "NextToken", "NextToken", "PageSize"); diff --git a/clients/client-sfn/package.json b/clients/client-sfn/package.json index e546eef5d7e6..b93b59227df0 100644 --- a/clients/client-sfn/package.json +++ b/clients/client-sfn/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-sfn/src/pagination/GetExecutionHistoryPaginator.ts b/clients/client-sfn/src/pagination/GetExecutionHistoryPaginator.ts index 35fcc0212e8b..71fb816dfd10 100644 --- a/clients/client-sfn/src/pagination/GetExecutionHistoryPaginator.ts +++ b/clients/client-sfn/src/pagination/GetExecutionHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SFNClient } from "../SFNClient"; import { SFNPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SFNClient, - input: GetExecutionHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetExecutionHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetExecutionHistory( +export const paginateGetExecutionHistory: ( config: SFNPaginationConfiguration, input: GetExecutionHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetExecutionHistoryCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SFNPaginationConfiguration, + GetExecutionHistoryCommandInput, + GetExecutionHistoryCommandOutput +>(SFNClient, GetExecutionHistoryCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-sfn/src/pagination/ListActivitiesPaginator.ts b/clients/client-sfn/src/pagination/ListActivitiesPaginator.ts index cc1b9b6315fc..6a83ef938d12 100644 --- a/clients/client-sfn/src/pagination/ListActivitiesPaginator.ts +++ b/clients/client-sfn/src/pagination/ListActivitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SFNClient } from "../SFNClient"; import { SFNPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SFNClient, - input: ListActivitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListActivitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListActivities( +export const paginateListActivities: ( config: SFNPaginationConfiguration, input: ListActivitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListActivitiesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SFNPaginationConfiguration, + ListActivitiesCommandInput, + ListActivitiesCommandOutput +>(SFNClient, ListActivitiesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-sfn/src/pagination/ListExecutionsPaginator.ts b/clients/client-sfn/src/pagination/ListExecutionsPaginator.ts index f63b920e935d..96a948a480ce 100644 --- a/clients/client-sfn/src/pagination/ListExecutionsPaginator.ts +++ b/clients/client-sfn/src/pagination/ListExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SFNClient } from "../SFNClient"; import { SFNPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SFNClient, - input: ListExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExecutions( +export const paginateListExecutions: ( config: SFNPaginationConfiguration, input: ListExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExecutionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SFNPaginationConfiguration, + ListExecutionsCommandInput, + ListExecutionsCommandOutput +>(SFNClient, ListExecutionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-sfn/src/pagination/ListMapRunsPaginator.ts b/clients/client-sfn/src/pagination/ListMapRunsPaginator.ts index ab7f830ace13..fdc24dd53544 100644 --- a/clients/client-sfn/src/pagination/ListMapRunsPaginator.ts +++ b/clients/client-sfn/src/pagination/ListMapRunsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListMapRunsCommand, ListMapRunsCommandInput, ListMapRunsCommandOutput } from "../commands/ListMapRunsCommand"; import { SFNClient } from "../SFNClient"; import { SFNPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SFNClient, - input: ListMapRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMapRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMapRuns( +export const paginateListMapRuns: ( config: SFNPaginationConfiguration, input: ListMapRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMapRunsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SFNPaginationConfiguration, + ListMapRunsCommandInput, + ListMapRunsCommandOutput +>(SFNClient, ListMapRunsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-sfn/src/pagination/ListStateMachinesPaginator.ts b/clients/client-sfn/src/pagination/ListStateMachinesPaginator.ts index f8df7f2be675..1d16250ee361 100644 --- a/clients/client-sfn/src/pagination/ListStateMachinesPaginator.ts +++ b/clients/client-sfn/src/pagination/ListStateMachinesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SFNClient } from "../SFNClient"; import { SFNPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SFNClient, - input: ListStateMachinesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListStateMachinesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListStateMachines( +export const paginateListStateMachines: ( config: SFNPaginationConfiguration, input: ListStateMachinesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListStateMachinesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SFNClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SFN | SFNClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SFNPaginationConfiguration, + ListStateMachinesCommandInput, + ListStateMachinesCommandOutput +>(SFNClient, ListStateMachinesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-shield/package.json b/clients/client-shield/package.json index 64076a3241a1..ce36970b0765 100644 --- a/clients/client-shield/package.json +++ b/clients/client-shield/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-shield/src/pagination/ListAttacksPaginator.ts b/clients/client-shield/src/pagination/ListAttacksPaginator.ts index cf0cb135a86d..1d3f44c597b7 100644 --- a/clients/client-shield/src/pagination/ListAttacksPaginator.ts +++ b/clients/client-shield/src/pagination/ListAttacksPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAttacksCommand, ListAttacksCommandInput, ListAttacksCommandOutput } from "../commands/ListAttacksCommand"; import { ShieldClient } from "../ShieldClient"; import { ShieldPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ShieldClient, - input: ListAttacksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAttacksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAttacks( +export const paginateListAttacks: ( config: ShieldPaginationConfiguration, input: ListAttacksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAttacksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ShieldClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Shield | ShieldClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ShieldPaginationConfiguration, + ListAttacksCommandInput, + ListAttacksCommandOutput +>(ShieldClient, ListAttacksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-shield/src/pagination/ListProtectionGroupsPaginator.ts b/clients/client-shield/src/pagination/ListProtectionGroupsPaginator.ts index 6c1d526d3a3e..4b77ba2287e7 100644 --- a/clients/client-shield/src/pagination/ListProtectionGroupsPaginator.ts +++ b/clients/client-shield/src/pagination/ListProtectionGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ShieldClient } from "../ShieldClient"; import { ShieldPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ShieldClient, - input: ListProtectionGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProtectionGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProtectionGroups( +export const paginateListProtectionGroups: ( config: ShieldPaginationConfiguration, input: ListProtectionGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProtectionGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ShieldClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Shield | ShieldClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ShieldPaginationConfiguration, + ListProtectionGroupsCommandInput, + ListProtectionGroupsCommandOutput +>(ShieldClient, ListProtectionGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-shield/src/pagination/ListProtectionsPaginator.ts b/clients/client-shield/src/pagination/ListProtectionsPaginator.ts index ba6b112a1501..9160e8bb76ad 100644 --- a/clients/client-shield/src/pagination/ListProtectionsPaginator.ts +++ b/clients/client-shield/src/pagination/ListProtectionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ShieldClient } from "../ShieldClient"; import { ShieldPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ShieldClient, - input: ListProtectionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProtectionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProtections( +export const paginateListProtections: ( config: ShieldPaginationConfiguration, input: ListProtectionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProtectionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ShieldClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Shield | ShieldClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ShieldPaginationConfiguration, + ListProtectionsCommandInput, + ListProtectionsCommandOutput +>(ShieldClient, ListProtectionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-shield/src/pagination/ListResourcesInProtectionGroupPaginator.ts b/clients/client-shield/src/pagination/ListResourcesInProtectionGroupPaginator.ts index 14a6c9a39fc2..8a1031f9adad 100644 --- a/clients/client-shield/src/pagination/ListResourcesInProtectionGroupPaginator.ts +++ b/clients/client-shield/src/pagination/ListResourcesInProtectionGroupPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { ShieldClient } from "../ShieldClient"; import { ShieldPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: ShieldClient, - input: ListResourcesInProtectionGroupCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourcesInProtectionGroupCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourcesInProtectionGroup( +export const paginateListResourcesInProtectionGroup: ( config: ShieldPaginationConfiguration, input: ListResourcesInProtectionGroupCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourcesInProtectionGroupCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof ShieldClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Shield | ShieldClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + ShieldPaginationConfiguration, + ListResourcesInProtectionGroupCommandInput, + ListResourcesInProtectionGroupCommandOutput +>(ShieldClient, ListResourcesInProtectionGroupCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-signer/src/pagination/ListSigningJobsPaginator.ts b/clients/client-signer/src/pagination/ListSigningJobsPaginator.ts index 65611310e41d..1f8874ba1ad3 100644 --- a/clients/client-signer/src/pagination/ListSigningJobsPaginator.ts +++ b/clients/client-signer/src/pagination/ListSigningJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SignerClient } from "../SignerClient"; import { SignerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SignerClient, - input: ListSigningJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSigningJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSigningJobs( +export const paginateListSigningJobs: ( config: SignerPaginationConfiguration, input: ListSigningJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSigningJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SignerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Signer | SignerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SignerPaginationConfiguration, + ListSigningJobsCommandInput, + ListSigningJobsCommandOutput +>(SignerClient, ListSigningJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-signer/src/pagination/ListSigningPlatformsPaginator.ts b/clients/client-signer/src/pagination/ListSigningPlatformsPaginator.ts index 3bb7b54e6787..efe36eadffe6 100644 --- a/clients/client-signer/src/pagination/ListSigningPlatformsPaginator.ts +++ b/clients/client-signer/src/pagination/ListSigningPlatformsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SignerClient } from "../SignerClient"; import { SignerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SignerClient, - input: ListSigningPlatformsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSigningPlatformsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSigningPlatforms( +export const paginateListSigningPlatforms: ( config: SignerPaginationConfiguration, input: ListSigningPlatformsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSigningPlatformsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SignerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Signer | SignerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SignerPaginationConfiguration, + ListSigningPlatformsCommandInput, + ListSigningPlatformsCommandOutput +>(SignerClient, ListSigningPlatformsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-signer/src/pagination/ListSigningProfilesPaginator.ts b/clients/client-signer/src/pagination/ListSigningProfilesPaginator.ts index 2de7331030a4..3c882a9ffd05 100644 --- a/clients/client-signer/src/pagination/ListSigningProfilesPaginator.ts +++ b/clients/client-signer/src/pagination/ListSigningProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SignerClient } from "../SignerClient"; import { SignerPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SignerClient, - input: ListSigningProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSigningProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSigningProfiles( +export const paginateListSigningProfiles: ( config: SignerPaginationConfiguration, input: ListSigningProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSigningProfilesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SignerClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Signer | SignerClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SignerPaginationConfiguration, + ListSigningProfilesCommandInput, + ListSigningProfilesCommandOutput +>(SignerClient, ListSigningProfilesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-simspaceweaver/src/pagination/ListAppsPaginator.ts b/clients/client-simspaceweaver/src/pagination/ListAppsPaginator.ts index 00378bfe78ef..e42763bc47e7 100644 --- a/clients/client-simspaceweaver/src/pagination/ListAppsPaginator.ts +++ b/clients/client-simspaceweaver/src/pagination/ListAppsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAppsCommand, ListAppsCommandInput, ListAppsCommandOutput } from "../commands/ListAppsCommand"; import { SimSpaceWeaverClient } from "../SimSpaceWeaverClient"; import { SimSpaceWeaverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SimSpaceWeaverClient, - input: ListAppsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAppsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApps( +export const paginateListApps: ( config: SimSpaceWeaverPaginationConfiguration, input: ListAppsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAppsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SimSpaceWeaverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SimSpaceWeaver | SimSpaceWeaverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SimSpaceWeaverPaginationConfiguration, + ListAppsCommandInput, + ListAppsCommandOutput +>(SimSpaceWeaverClient, ListAppsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-simspaceweaver/src/pagination/ListSimulationsPaginator.ts b/clients/client-simspaceweaver/src/pagination/ListSimulationsPaginator.ts index 5f43ddf49fb8..0ac95b2ad573 100644 --- a/clients/client-simspaceweaver/src/pagination/ListSimulationsPaginator.ts +++ b/clients/client-simspaceweaver/src/pagination/ListSimulationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SimSpaceWeaverClient } from "../SimSpaceWeaverClient"; import { SimSpaceWeaverPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SimSpaceWeaverClient, - input: ListSimulationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSimulationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSimulations( +export const paginateListSimulations: ( config: SimSpaceWeaverPaginationConfiguration, input: ListSimulationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSimulationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SimSpaceWeaverClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SimSpaceWeaver | SimSpaceWeaverClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SimSpaceWeaverPaginationConfiguration, + ListSimulationsCommandInput, + ListSimulationsCommandOutput +>(SimSpaceWeaverClient, ListSimulationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sms/package.json b/clients/client-sms/package.json index 7332a7398478..f5d930a3e291 100644 --- a/clients/client-sms/package.json +++ b/clients/client-sms/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-sms/src/pagination/GetConnectorsPaginator.ts b/clients/client-sms/src/pagination/GetConnectorsPaginator.ts index 5c3364f87900..38f924791137 100644 --- a/clients/client-sms/src/pagination/GetConnectorsPaginator.ts +++ b/clients/client-sms/src/pagination/GetConnectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SMSClient } from "../SMSClient"; import { SMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SMSClient, - input: GetConnectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetConnectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetConnectors( +export const paginateGetConnectors: ( config: SMSPaginationConfiguration, input: GetConnectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetConnectorsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SMS | SMSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SMSPaginationConfiguration, + GetConnectorsCommandInput, + GetConnectorsCommandOutput +>(SMSClient, GetConnectorsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-sms/src/pagination/GetReplicationJobsPaginator.ts b/clients/client-sms/src/pagination/GetReplicationJobsPaginator.ts index 0c4f15418a93..02747a9438e9 100644 --- a/clients/client-sms/src/pagination/GetReplicationJobsPaginator.ts +++ b/clients/client-sms/src/pagination/GetReplicationJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SMSClient } from "../SMSClient"; import { SMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SMSClient, - input: GetReplicationJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetReplicationJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetReplicationJobs( +export const paginateGetReplicationJobs: ( config: SMSPaginationConfiguration, input: GetReplicationJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetReplicationJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SMS | SMSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SMSPaginationConfiguration, + GetReplicationJobsCommandInput, + GetReplicationJobsCommandOutput +>(SMSClient, GetReplicationJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-sms/src/pagination/GetReplicationRunsPaginator.ts b/clients/client-sms/src/pagination/GetReplicationRunsPaginator.ts index 50edb820d945..a4eff8ec4518 100644 --- a/clients/client-sms/src/pagination/GetReplicationRunsPaginator.ts +++ b/clients/client-sms/src/pagination/GetReplicationRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SMSClient } from "../SMSClient"; import { SMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SMSClient, - input: GetReplicationRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetReplicationRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetReplicationRuns( +export const paginateGetReplicationRuns: ( config: SMSPaginationConfiguration, input: GetReplicationRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetReplicationRunsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SMS | SMSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SMSPaginationConfiguration, + GetReplicationRunsCommandInput, + GetReplicationRunsCommandOutput +>(SMSClient, GetReplicationRunsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-sms/src/pagination/GetServersPaginator.ts b/clients/client-sms/src/pagination/GetServersPaginator.ts index 1caa35463dfc..d4bcc7162fda 100644 --- a/clients/client-sms/src/pagination/GetServersPaginator.ts +++ b/clients/client-sms/src/pagination/GetServersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetServersCommand, GetServersCommandInput, GetServersCommandOutput } from "../commands/GetServersCommand"; import { SMSClient } from "../SMSClient"; import { SMSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SMSClient, - input: GetServersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetServersCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetServers( +export const paginateGetServers: ( config: SMSPaginationConfiguration, input: GetServersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetServersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SMSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SMS | SMSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SMSPaginationConfiguration, + GetServersCommandInput, + GetServersCommandOutput +>(SMSClient, GetServersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-snow-device-management/src/pagination/ListDeviceResourcesPaginator.ts b/clients/client-snow-device-management/src/pagination/ListDeviceResourcesPaginator.ts index 67f448050709..f301f17df556 100644 --- a/clients/client-snow-device-management/src/pagination/ListDeviceResourcesPaginator.ts +++ b/clients/client-snow-device-management/src/pagination/ListDeviceResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SnowDeviceManagementClient } from "../SnowDeviceManagementClient"; import { SnowDeviceManagementPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SnowDeviceManagementClient, - input: ListDeviceResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeviceResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeviceResources( +export const paginateListDeviceResources: ( config: SnowDeviceManagementPaginationConfiguration, input: ListDeviceResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeviceResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SnowDeviceManagementClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SnowDeviceManagement | SnowDeviceManagementClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SnowDeviceManagementPaginationConfiguration, + ListDeviceResourcesCommandInput, + ListDeviceResourcesCommandOutput +>(SnowDeviceManagementClient, ListDeviceResourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-snow-device-management/src/pagination/ListDevicesPaginator.ts b/clients/client-snow-device-management/src/pagination/ListDevicesPaginator.ts index 465a0d69929e..b002eb8b4bc7 100644 --- a/clients/client-snow-device-management/src/pagination/ListDevicesPaginator.ts +++ b/clients/client-snow-device-management/src/pagination/ListDevicesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListDevicesCommand, ListDevicesCommandInput, ListDevicesCommandOutput } from "../commands/ListDevicesCommand"; import { SnowDeviceManagementClient } from "../SnowDeviceManagementClient"; import { SnowDeviceManagementPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SnowDeviceManagementClient, - input: ListDevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDevices( +export const paginateListDevices: ( config: SnowDeviceManagementPaginationConfiguration, input: ListDevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDevicesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SnowDeviceManagementClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SnowDeviceManagement | SnowDeviceManagementClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SnowDeviceManagementPaginationConfiguration, + ListDevicesCommandInput, + ListDevicesCommandOutput +>(SnowDeviceManagementClient, ListDevicesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-snow-device-management/src/pagination/ListExecutionsPaginator.ts b/clients/client-snow-device-management/src/pagination/ListExecutionsPaginator.ts index 2c31b9bb5604..ae1c54187c7b 100644 --- a/clients/client-snow-device-management/src/pagination/ListExecutionsPaginator.ts +++ b/clients/client-snow-device-management/src/pagination/ListExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SnowDeviceManagementClient } from "../SnowDeviceManagementClient"; import { SnowDeviceManagementPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SnowDeviceManagementClient, - input: ListExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExecutions( +export const paginateListExecutions: ( config: SnowDeviceManagementPaginationConfiguration, input: ListExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExecutionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SnowDeviceManagementClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SnowDeviceManagement | SnowDeviceManagementClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SnowDeviceManagementPaginationConfiguration, + ListExecutionsCommandInput, + ListExecutionsCommandOutput +>(SnowDeviceManagementClient, ListExecutionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-snow-device-management/src/pagination/ListTasksPaginator.ts b/clients/client-snow-device-management/src/pagination/ListTasksPaginator.ts index 16afb699b84b..7d95c24d5640 100644 --- a/clients/client-snow-device-management/src/pagination/ListTasksPaginator.ts +++ b/clients/client-snow-device-management/src/pagination/ListTasksPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTasksCommand, ListTasksCommandInput, ListTasksCommandOutput } from "../commands/ListTasksCommand"; import { SnowDeviceManagementClient } from "../SnowDeviceManagementClient"; import { SnowDeviceManagementPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SnowDeviceManagementClient, - input: ListTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTasks( +export const paginateListTasks: ( config: SnowDeviceManagementPaginationConfiguration, input: ListTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTasksCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SnowDeviceManagementClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SnowDeviceManagement | SnowDeviceManagementClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SnowDeviceManagementPaginationConfiguration, + ListTasksCommandInput, + ListTasksCommandOutput +>(SnowDeviceManagementClient, ListTasksCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-snowball/package.json b/clients/client-snowball/package.json index fa978f5db30d..933bae7ca5e6 100644 --- a/clients/client-snowball/package.json +++ b/clients/client-snowball/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-snowball/src/pagination/DescribeAddressesPaginator.ts b/clients/client-snowball/src/pagination/DescribeAddressesPaginator.ts index 10df573219bc..69ea59bdbb22 100644 --- a/clients/client-snowball/src/pagination/DescribeAddressesPaginator.ts +++ b/clients/client-snowball/src/pagination/DescribeAddressesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SnowballClient } from "../SnowballClient"; import { SnowballPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SnowballClient, - input: DescribeAddressesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAddressesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAddresses( +export const paginateDescribeAddresses: ( config: SnowballPaginationConfiguration, input: DescribeAddressesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAddressesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SnowballClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Snowball | SnowballClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SnowballPaginationConfiguration, + DescribeAddressesCommandInput, + DescribeAddressesCommandOutput +>(SnowballClient, DescribeAddressesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-snowball/src/pagination/ListClusterJobsPaginator.ts b/clients/client-snowball/src/pagination/ListClusterJobsPaginator.ts index aeb9a9bf5ffc..03292b570211 100644 --- a/clients/client-snowball/src/pagination/ListClusterJobsPaginator.ts +++ b/clients/client-snowball/src/pagination/ListClusterJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SnowballClient } from "../SnowballClient"; import { SnowballPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SnowballClient, - input: ListClusterJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClusterJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClusterJobs( +export const paginateListClusterJobs: ( config: SnowballPaginationConfiguration, input: ListClusterJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClusterJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SnowballClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Snowball | SnowballClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SnowballPaginationConfiguration, + ListClusterJobsCommandInput, + ListClusterJobsCommandOutput +>(SnowballClient, ListClusterJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-snowball/src/pagination/ListClustersPaginator.ts b/clients/client-snowball/src/pagination/ListClustersPaginator.ts index a853256eaba1..4fbee39ae823 100644 --- a/clients/client-snowball/src/pagination/ListClustersPaginator.ts +++ b/clients/client-snowball/src/pagination/ListClustersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SnowballClient } from "../SnowballClient"; import { SnowballPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SnowballClient, - input: ListClustersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClustersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClusters( +export const paginateListClusters: ( config: SnowballPaginationConfiguration, input: ListClustersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClustersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SnowballClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Snowball | SnowballClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SnowballPaginationConfiguration, + ListClustersCommandInput, + ListClustersCommandOutput +>(SnowballClient, ListClustersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-snowball/src/pagination/ListCompatibleImagesPaginator.ts b/clients/client-snowball/src/pagination/ListCompatibleImagesPaginator.ts index 34f87abbdf7a..184adacef971 100644 --- a/clients/client-snowball/src/pagination/ListCompatibleImagesPaginator.ts +++ b/clients/client-snowball/src/pagination/ListCompatibleImagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SnowballClient } from "../SnowballClient"; import { SnowballPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SnowballClient, - input: ListCompatibleImagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCompatibleImagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCompatibleImages( +export const paginateListCompatibleImages: ( config: SnowballPaginationConfiguration, input: ListCompatibleImagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCompatibleImagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SnowballClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Snowball | SnowballClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SnowballPaginationConfiguration, + ListCompatibleImagesCommandInput, + ListCompatibleImagesCommandOutput +>(SnowballClient, ListCompatibleImagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-snowball/src/pagination/ListJobsPaginator.ts b/clients/client-snowball/src/pagination/ListJobsPaginator.ts index 1d98d798ee17..af1e47179be0 100644 --- a/clients/client-snowball/src/pagination/ListJobsPaginator.ts +++ b/clients/client-snowball/src/pagination/ListJobsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListJobsCommand, ListJobsCommandInput, ListJobsCommandOutput } from "../commands/ListJobsCommand"; import { SnowballClient } from "../SnowballClient"; import { SnowballPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SnowballClient, - input: ListJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListJobs( +export const paginateListJobs: ( config: SnowballPaginationConfiguration, input: ListJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SnowballClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Snowball | SnowballClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SnowballPaginationConfiguration, + ListJobsCommandInput, + ListJobsCommandOutput +>(SnowballClient, ListJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-snowball/src/pagination/ListLongTermPricingPaginator.ts b/clients/client-snowball/src/pagination/ListLongTermPricingPaginator.ts index 743ede544f2e..01fd477f0c46 100644 --- a/clients/client-snowball/src/pagination/ListLongTermPricingPaginator.ts +++ b/clients/client-snowball/src/pagination/ListLongTermPricingPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SnowballClient } from "../SnowballClient"; import { SnowballPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SnowballClient, - input: ListLongTermPricingCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLongTermPricingCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLongTermPricing( +export const paginateListLongTermPricing: ( config: SnowballPaginationConfiguration, input: ListLongTermPricingCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLongTermPricingCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SnowballClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Snowball | SnowballClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SnowballPaginationConfiguration, + ListLongTermPricingCommandInput, + ListLongTermPricingCommandOutput +>(SnowballClient, ListLongTermPricingCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-snowball/src/pagination/ListPickupLocationsPaginator.ts b/clients/client-snowball/src/pagination/ListPickupLocationsPaginator.ts index 82a202e40115..68fab5755810 100644 --- a/clients/client-snowball/src/pagination/ListPickupLocationsPaginator.ts +++ b/clients/client-snowball/src/pagination/ListPickupLocationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SnowballClient } from "../SnowballClient"; import { SnowballPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SnowballClient, - input: ListPickupLocationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPickupLocationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPickupLocations( +export const paginateListPickupLocations: ( config: SnowballPaginationConfiguration, input: ListPickupLocationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPickupLocationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SnowballClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Snowball | SnowballClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SnowballPaginationConfiguration, + ListPickupLocationsCommandInput, + ListPickupLocationsCommandOutput +>(SnowballClient, ListPickupLocationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sns/package.json b/clients/client-sns/package.json index ee7025eb85ad..d4d31954b56b 100644 --- a/clients/client-sns/package.json +++ b/clients/client-sns/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-sns/src/pagination/ListEndpointsByPlatformApplicationPaginator.ts b/clients/client-sns/src/pagination/ListEndpointsByPlatformApplicationPaginator.ts index 4ed1c29afbf1..8f1a707899d6 100644 --- a/clients/client-sns/src/pagination/ListEndpointsByPlatformApplicationPaginator.ts +++ b/clients/client-sns/src/pagination/ListEndpointsByPlatformApplicationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SNSClient } from "../SNSClient"; import { SNSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SNSClient, - input: ListEndpointsByPlatformApplicationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEndpointsByPlatformApplicationCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEndpointsByPlatformApplication( +export const paginateListEndpointsByPlatformApplication: ( config: SNSPaginationConfiguration, input: ListEndpointsByPlatformApplicationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEndpointsByPlatformApplicationCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof SNSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SNS | SNSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SNSPaginationConfiguration, + ListEndpointsByPlatformApplicationCommandInput, + ListEndpointsByPlatformApplicationCommandOutput +>(SNSClient, ListEndpointsByPlatformApplicationCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-sns/src/pagination/ListOriginationNumbersPaginator.ts b/clients/client-sns/src/pagination/ListOriginationNumbersPaginator.ts index 6e2d4e10b8c3..f838bfdb319b 100644 --- a/clients/client-sns/src/pagination/ListOriginationNumbersPaginator.ts +++ b/clients/client-sns/src/pagination/ListOriginationNumbersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SNSClient } from "../SNSClient"; import { SNSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SNSClient, - input: ListOriginationNumbersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOriginationNumbersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOriginationNumbers( +export const paginateListOriginationNumbers: ( config: SNSPaginationConfiguration, input: ListOriginationNumbersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOriginationNumbersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SNSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SNS | SNSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SNSPaginationConfiguration, + ListOriginationNumbersCommandInput, + ListOriginationNumbersCommandOutput +>(SNSClient, ListOriginationNumbersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sns/src/pagination/ListPhoneNumbersOptedOutPaginator.ts b/clients/client-sns/src/pagination/ListPhoneNumbersOptedOutPaginator.ts index 03957b90d794..53e36cb04df2 100644 --- a/clients/client-sns/src/pagination/ListPhoneNumbersOptedOutPaginator.ts +++ b/clients/client-sns/src/pagination/ListPhoneNumbersOptedOutPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SNSClient } from "../SNSClient"; import { SNSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SNSClient, - input: ListPhoneNumbersOptedOutCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPhoneNumbersOptedOutCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPhoneNumbersOptedOut( +export const paginateListPhoneNumbersOptedOut: ( config: SNSPaginationConfiguration, input: ListPhoneNumbersOptedOutCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPhoneNumbersOptedOutCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof SNSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SNS | SNSClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SNSPaginationConfiguration, + ListPhoneNumbersOptedOutCommandInput, + ListPhoneNumbersOptedOutCommandOutput +>(SNSClient, ListPhoneNumbersOptedOutCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-sns/src/pagination/ListPlatformApplicationsPaginator.ts b/clients/client-sns/src/pagination/ListPlatformApplicationsPaginator.ts index 1cdc9483a6c6..5a86be9b0e5c 100644 --- a/clients/client-sns/src/pagination/ListPlatformApplicationsPaginator.ts +++ b/clients/client-sns/src/pagination/ListPlatformApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SNSClient } from "../SNSClient"; import { SNSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SNSClient, - input: ListPlatformApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPlatformApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPlatformApplications( +export const paginateListPlatformApplications: ( config: SNSPaginationConfiguration, input: ListPlatformApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPlatformApplicationsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof SNSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SNS | SNSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SNSPaginationConfiguration, + ListPlatformApplicationsCommandInput, + ListPlatformApplicationsCommandOutput +>(SNSClient, ListPlatformApplicationsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-sns/src/pagination/ListSMSSandboxPhoneNumbersPaginator.ts b/clients/client-sns/src/pagination/ListSMSSandboxPhoneNumbersPaginator.ts index 0da57f1a116c..c66c01e4dfa5 100644 --- a/clients/client-sns/src/pagination/ListSMSSandboxPhoneNumbersPaginator.ts +++ b/clients/client-sns/src/pagination/ListSMSSandboxPhoneNumbersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SNSClient } from "../SNSClient"; import { SNSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SNSClient, - input: ListSMSSandboxPhoneNumbersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSMSSandboxPhoneNumbersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSMSSandboxPhoneNumbers( +export const paginateListSMSSandboxPhoneNumbers: ( config: SNSPaginationConfiguration, input: ListSMSSandboxPhoneNumbersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSMSSandboxPhoneNumbersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SNSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SNS | SNSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SNSPaginationConfiguration, + ListSMSSandboxPhoneNumbersCommandInput, + ListSMSSandboxPhoneNumbersCommandOutput +>(SNSClient, ListSMSSandboxPhoneNumbersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sns/src/pagination/ListSubscriptionsByTopicPaginator.ts b/clients/client-sns/src/pagination/ListSubscriptionsByTopicPaginator.ts index 285d35e4dc23..9f413056a412 100644 --- a/clients/client-sns/src/pagination/ListSubscriptionsByTopicPaginator.ts +++ b/clients/client-sns/src/pagination/ListSubscriptionsByTopicPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SNSClient } from "../SNSClient"; import { SNSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SNSClient, - input: ListSubscriptionsByTopicCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSubscriptionsByTopicCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSubscriptionsByTopic( +export const paginateListSubscriptionsByTopic: ( config: SNSPaginationConfiguration, input: ListSubscriptionsByTopicCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSubscriptionsByTopicCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof SNSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SNS | SNSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SNSPaginationConfiguration, + ListSubscriptionsByTopicCommandInput, + ListSubscriptionsByTopicCommandOutput +>(SNSClient, ListSubscriptionsByTopicCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-sns/src/pagination/ListSubscriptionsPaginator.ts b/clients/client-sns/src/pagination/ListSubscriptionsPaginator.ts index ba633740c681..67047b331770 100644 --- a/clients/client-sns/src/pagination/ListSubscriptionsPaginator.ts +++ b/clients/client-sns/src/pagination/ListSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SNSClient } from "../SNSClient"; import { SNSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SNSClient, - input: ListSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSubscriptions( +export const paginateListSubscriptions: ( config: SNSPaginationConfiguration, input: ListSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSubscriptionsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof SNSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SNS | SNSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SNSPaginationConfiguration, + ListSubscriptionsCommandInput, + ListSubscriptionsCommandOutput +>(SNSClient, ListSubscriptionsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-sns/src/pagination/ListTopicsPaginator.ts b/clients/client-sns/src/pagination/ListTopicsPaginator.ts index 071c7e97b390..f69b1769b469 100644 --- a/clients/client-sns/src/pagination/ListTopicsPaginator.ts +++ b/clients/client-sns/src/pagination/ListTopicsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTopicsCommand, ListTopicsCommandInput, ListTopicsCommandOutput } from "../commands/ListTopicsCommand"; import { SNSClient } from "../SNSClient"; import { SNSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SNSClient, - input: ListTopicsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTopicsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTopics( +export const paginateListTopics: ( config: SNSPaginationConfiguration, input: ListTopicsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTopicsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof SNSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SNS | SNSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SNSPaginationConfiguration, + ListTopicsCommandInput, + ListTopicsCommandOutput +>(SNSClient, ListTopicsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-sqs/src/pagination/ListDeadLetterSourceQueuesPaginator.ts b/clients/client-sqs/src/pagination/ListDeadLetterSourceQueuesPaginator.ts index 85af1ad3fb30..b9b27e602e43 100644 --- a/clients/client-sqs/src/pagination/ListDeadLetterSourceQueuesPaginator.ts +++ b/clients/client-sqs/src/pagination/ListDeadLetterSourceQueuesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SQSClient } from "../SQSClient"; import { SQSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SQSClient, - input: ListDeadLetterSourceQueuesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDeadLetterSourceQueuesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDeadLetterSourceQueues( +export const paginateListDeadLetterSourceQueues: ( config: SQSPaginationConfiguration, input: ListDeadLetterSourceQueuesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDeadLetterSourceQueuesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SQSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SQS | SQSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SQSPaginationConfiguration, + ListDeadLetterSourceQueuesCommandInput, + ListDeadLetterSourceQueuesCommandOutput +>(SQSClient, ListDeadLetterSourceQueuesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sqs/src/pagination/ListQueuesPaginator.ts b/clients/client-sqs/src/pagination/ListQueuesPaginator.ts index 3d597e98e22b..86461ffc1d08 100644 --- a/clients/client-sqs/src/pagination/ListQueuesPaginator.ts +++ b/clients/client-sqs/src/pagination/ListQueuesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListQueuesCommand, ListQueuesCommandInput, ListQueuesCommandOutput } from "../commands/ListQueuesCommand"; import { SQSClient } from "../SQSClient"; import { SQSPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SQSClient, - input: ListQueuesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListQueuesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListQueues( +export const paginateListQueues: ( config: SQSPaginationConfiguration, input: ListQueuesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListQueuesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SQSClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SQS | SQSClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SQSPaginationConfiguration, + ListQueuesCommandInput, + ListQueuesCommandOutput +>(SQSClient, ListQueuesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm-contacts/package.json b/clients/client-ssm-contacts/package.json index db3e98a44935..a1ab9e6ac908 100644 --- a/clients/client-ssm-contacts/package.json +++ b/clients/client-ssm-contacts/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-ssm-contacts/src/pagination/ListContactChannelsPaginator.ts b/clients/client-ssm-contacts/src/pagination/ListContactChannelsPaginator.ts index f24fdea9e048..7508a8788d70 100644 --- a/clients/client-ssm-contacts/src/pagination/ListContactChannelsPaginator.ts +++ b/clients/client-ssm-contacts/src/pagination/ListContactChannelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMContactsClient } from "../SSMContactsClient"; import { SSMContactsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMContactsClient, - input: ListContactChannelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContactChannelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContactChannels( +export const paginateListContactChannels: ( config: SSMContactsPaginationConfiguration, input: ListContactChannelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContactChannelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMContactsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMContacts | SSMContactsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMContactsPaginationConfiguration, + ListContactChannelsCommandInput, + ListContactChannelsCommandOutput +>(SSMContactsClient, ListContactChannelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm-contacts/src/pagination/ListContactsPaginator.ts b/clients/client-ssm-contacts/src/pagination/ListContactsPaginator.ts index ca30f2edb718..3c798f7d2a4f 100644 --- a/clients/client-ssm-contacts/src/pagination/ListContactsPaginator.ts +++ b/clients/client-ssm-contacts/src/pagination/ListContactsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMContactsClient } from "../SSMContactsClient"; import { SSMContactsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMContactsClient, - input: ListContactsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContactsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContacts( +export const paginateListContacts: ( config: SSMContactsPaginationConfiguration, input: ListContactsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContactsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMContactsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMContacts | SSMContactsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMContactsPaginationConfiguration, + ListContactsCommandInput, + ListContactsCommandOutput +>(SSMContactsClient, ListContactsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm-contacts/src/pagination/ListEngagementsPaginator.ts b/clients/client-ssm-contacts/src/pagination/ListEngagementsPaginator.ts index 83905ad77a61..7ea347735eb9 100644 --- a/clients/client-ssm-contacts/src/pagination/ListEngagementsPaginator.ts +++ b/clients/client-ssm-contacts/src/pagination/ListEngagementsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMContactsClient } from "../SSMContactsClient"; import { SSMContactsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMContactsClient, - input: ListEngagementsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEngagementsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEngagements( +export const paginateListEngagements: ( config: SSMContactsPaginationConfiguration, input: ListEngagementsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEngagementsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMContactsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMContacts | SSMContactsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMContactsPaginationConfiguration, + ListEngagementsCommandInput, + ListEngagementsCommandOutput +>(SSMContactsClient, ListEngagementsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm-contacts/src/pagination/ListPageReceiptsPaginator.ts b/clients/client-ssm-contacts/src/pagination/ListPageReceiptsPaginator.ts index b421f6756030..13f28f6157c5 100644 --- a/clients/client-ssm-contacts/src/pagination/ListPageReceiptsPaginator.ts +++ b/clients/client-ssm-contacts/src/pagination/ListPageReceiptsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMContactsClient } from "../SSMContactsClient"; import { SSMContactsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMContactsClient, - input: ListPageReceiptsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPageReceiptsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPageReceipts( +export const paginateListPageReceipts: ( config: SSMContactsPaginationConfiguration, input: ListPageReceiptsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPageReceiptsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMContactsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMContacts | SSMContactsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMContactsPaginationConfiguration, + ListPageReceiptsCommandInput, + ListPageReceiptsCommandOutput +>(SSMContactsClient, ListPageReceiptsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm-contacts/src/pagination/ListPageResolutionsPaginator.ts b/clients/client-ssm-contacts/src/pagination/ListPageResolutionsPaginator.ts index 208129c2421b..3537c5b880d9 100644 --- a/clients/client-ssm-contacts/src/pagination/ListPageResolutionsPaginator.ts +++ b/clients/client-ssm-contacts/src/pagination/ListPageResolutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SSMContactsClient } from "../SSMContactsClient"; import { SSMContactsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMContactsClient, - input: ListPageResolutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPageResolutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPageResolutions( +export const paginateListPageResolutions: ( config: SSMContactsPaginationConfiguration, input: ListPageResolutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPageResolutionsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof SSMContactsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMContacts | SSMContactsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMContactsPaginationConfiguration, + ListPageResolutionsCommandInput, + ListPageResolutionsCommandOutput +>(SSMContactsClient, ListPageResolutionsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-ssm-contacts/src/pagination/ListPagesByContactPaginator.ts b/clients/client-ssm-contacts/src/pagination/ListPagesByContactPaginator.ts index 6df8f8443582..a66329409e2e 100644 --- a/clients/client-ssm-contacts/src/pagination/ListPagesByContactPaginator.ts +++ b/clients/client-ssm-contacts/src/pagination/ListPagesByContactPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMContactsClient } from "../SSMContactsClient"; import { SSMContactsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMContactsClient, - input: ListPagesByContactCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPagesByContactCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPagesByContact( +export const paginateListPagesByContact: ( config: SSMContactsPaginationConfiguration, input: ListPagesByContactCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPagesByContactCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMContactsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMContacts | SSMContactsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMContactsPaginationConfiguration, + ListPagesByContactCommandInput, + ListPagesByContactCommandOutput +>(SSMContactsClient, ListPagesByContactCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm-contacts/src/pagination/ListPagesByEngagementPaginator.ts b/clients/client-ssm-contacts/src/pagination/ListPagesByEngagementPaginator.ts index bf97a1e7b538..f63fb55ddce9 100644 --- a/clients/client-ssm-contacts/src/pagination/ListPagesByEngagementPaginator.ts +++ b/clients/client-ssm-contacts/src/pagination/ListPagesByEngagementPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMContactsClient } from "../SSMContactsClient"; import { SSMContactsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMContactsClient, - input: ListPagesByEngagementCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPagesByEngagementCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPagesByEngagement( +export const paginateListPagesByEngagement: ( config: SSMContactsPaginationConfiguration, input: ListPagesByEngagementCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPagesByEngagementCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMContactsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMContacts | SSMContactsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMContactsPaginationConfiguration, + ListPagesByEngagementCommandInput, + ListPagesByEngagementCommandOutput +>(SSMContactsClient, ListPagesByEngagementCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm-contacts/src/pagination/ListPreviewRotationShiftsPaginator.ts b/clients/client-ssm-contacts/src/pagination/ListPreviewRotationShiftsPaginator.ts index cf4b42f4b7a4..761ea4aa4739 100644 --- a/clients/client-ssm-contacts/src/pagination/ListPreviewRotationShiftsPaginator.ts +++ b/clients/client-ssm-contacts/src/pagination/ListPreviewRotationShiftsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMContactsClient } from "../SSMContactsClient"; import { SSMContactsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMContactsClient, - input: ListPreviewRotationShiftsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPreviewRotationShiftsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPreviewRotationShifts( +export const paginateListPreviewRotationShifts: ( config: SSMContactsPaginationConfiguration, input: ListPreviewRotationShiftsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPreviewRotationShiftsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMContactsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMContacts | SSMContactsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMContactsPaginationConfiguration, + ListPreviewRotationShiftsCommandInput, + ListPreviewRotationShiftsCommandOutput +>(SSMContactsClient, ListPreviewRotationShiftsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm-contacts/src/pagination/ListRotationOverridesPaginator.ts b/clients/client-ssm-contacts/src/pagination/ListRotationOverridesPaginator.ts index 7e9f5fa4fdbb..c940c0548060 100644 --- a/clients/client-ssm-contacts/src/pagination/ListRotationOverridesPaginator.ts +++ b/clients/client-ssm-contacts/src/pagination/ListRotationOverridesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMContactsClient } from "../SSMContactsClient"; import { SSMContactsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMContactsClient, - input: ListRotationOverridesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRotationOverridesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRotationOverrides( +export const paginateListRotationOverrides: ( config: SSMContactsPaginationConfiguration, input: ListRotationOverridesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRotationOverridesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMContactsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMContacts | SSMContactsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMContactsPaginationConfiguration, + ListRotationOverridesCommandInput, + ListRotationOverridesCommandOutput +>(SSMContactsClient, ListRotationOverridesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm-contacts/src/pagination/ListRotationShiftsPaginator.ts b/clients/client-ssm-contacts/src/pagination/ListRotationShiftsPaginator.ts index 3470dfc2f7f3..3476a29d17e5 100644 --- a/clients/client-ssm-contacts/src/pagination/ListRotationShiftsPaginator.ts +++ b/clients/client-ssm-contacts/src/pagination/ListRotationShiftsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMContactsClient } from "../SSMContactsClient"; import { SSMContactsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMContactsClient, - input: ListRotationShiftsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRotationShiftsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRotationShifts( +export const paginateListRotationShifts: ( config: SSMContactsPaginationConfiguration, input: ListRotationShiftsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRotationShiftsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMContactsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMContacts | SSMContactsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMContactsPaginationConfiguration, + ListRotationShiftsCommandInput, + ListRotationShiftsCommandOutput +>(SSMContactsClient, ListRotationShiftsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm-contacts/src/pagination/ListRotationsPaginator.ts b/clients/client-ssm-contacts/src/pagination/ListRotationsPaginator.ts index 5674b8585adf..386dc216c0a7 100644 --- a/clients/client-ssm-contacts/src/pagination/ListRotationsPaginator.ts +++ b/clients/client-ssm-contacts/src/pagination/ListRotationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMContactsClient } from "../SSMContactsClient"; import { SSMContactsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMContactsClient, - input: ListRotationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRotationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRotations( +export const paginateListRotations: ( config: SSMContactsPaginationConfiguration, input: ListRotationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRotationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMContactsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMContacts | SSMContactsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMContactsPaginationConfiguration, + ListRotationsCommandInput, + ListRotationsCommandOutput +>(SSMContactsClient, ListRotationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm-incidents/src/pagination/GetResourcePoliciesPaginator.ts b/clients/client-ssm-incidents/src/pagination/GetResourcePoliciesPaginator.ts index c2f00a5a5ddd..4690b6bc7161 100644 --- a/clients/client-ssm-incidents/src/pagination/GetResourcePoliciesPaginator.ts +++ b/clients/client-ssm-incidents/src/pagination/GetResourcePoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMIncidentsClient } from "../SSMIncidentsClient"; import { SSMIncidentsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMIncidentsClient, - input: GetResourcePoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetResourcePoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetResourcePolicies( +export const paginateGetResourcePolicies: ( config: SSMIncidentsPaginationConfiguration, input: GetResourcePoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetResourcePoliciesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SSMIncidentsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMIncidents | SSMIncidentsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMIncidentsPaginationConfiguration, + GetResourcePoliciesCommandInput, + GetResourcePoliciesCommandOutput +>(SSMIncidentsClient, GetResourcePoliciesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ssm-incidents/src/pagination/ListIncidentFindingsPaginator.ts b/clients/client-ssm-incidents/src/pagination/ListIncidentFindingsPaginator.ts index e4e1860ca75f..16997489067d 100644 --- a/clients/client-ssm-incidents/src/pagination/ListIncidentFindingsPaginator.ts +++ b/clients/client-ssm-incidents/src/pagination/ListIncidentFindingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMIncidentsClient } from "../SSMIncidentsClient"; import { SSMIncidentsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMIncidentsClient, - input: ListIncidentFindingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIncidentFindingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIncidentFindings( +export const paginateListIncidentFindings: ( config: SSMIncidentsPaginationConfiguration, input: ListIncidentFindingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIncidentFindingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SSMIncidentsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMIncidents | SSMIncidentsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMIncidentsPaginationConfiguration, + ListIncidentFindingsCommandInput, + ListIncidentFindingsCommandOutput +>(SSMIncidentsClient, ListIncidentFindingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ssm-incidents/src/pagination/ListIncidentRecordsPaginator.ts b/clients/client-ssm-incidents/src/pagination/ListIncidentRecordsPaginator.ts index 71a5154e64dc..3f5b593de4eb 100644 --- a/clients/client-ssm-incidents/src/pagination/ListIncidentRecordsPaginator.ts +++ b/clients/client-ssm-incidents/src/pagination/ListIncidentRecordsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMIncidentsClient } from "../SSMIncidentsClient"; import { SSMIncidentsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMIncidentsClient, - input: ListIncidentRecordsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIncidentRecordsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIncidentRecords( +export const paginateListIncidentRecords: ( config: SSMIncidentsPaginationConfiguration, input: ListIncidentRecordsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIncidentRecordsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SSMIncidentsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMIncidents | SSMIncidentsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMIncidentsPaginationConfiguration, + ListIncidentRecordsCommandInput, + ListIncidentRecordsCommandOutput +>(SSMIncidentsClient, ListIncidentRecordsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ssm-incidents/src/pagination/ListRelatedItemsPaginator.ts b/clients/client-ssm-incidents/src/pagination/ListRelatedItemsPaginator.ts index fea065f696fc..19bdf08185cb 100644 --- a/clients/client-ssm-incidents/src/pagination/ListRelatedItemsPaginator.ts +++ b/clients/client-ssm-incidents/src/pagination/ListRelatedItemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMIncidentsClient } from "../SSMIncidentsClient"; import { SSMIncidentsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMIncidentsClient, - input: ListRelatedItemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRelatedItemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRelatedItems( +export const paginateListRelatedItems: ( config: SSMIncidentsPaginationConfiguration, input: ListRelatedItemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRelatedItemsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SSMIncidentsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMIncidents | SSMIncidentsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMIncidentsPaginationConfiguration, + ListRelatedItemsCommandInput, + ListRelatedItemsCommandOutput +>(SSMIncidentsClient, ListRelatedItemsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ssm-incidents/src/pagination/ListReplicationSetsPaginator.ts b/clients/client-ssm-incidents/src/pagination/ListReplicationSetsPaginator.ts index 961eb54d8864..5f14c9b0f5f8 100644 --- a/clients/client-ssm-incidents/src/pagination/ListReplicationSetsPaginator.ts +++ b/clients/client-ssm-incidents/src/pagination/ListReplicationSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMIncidentsClient } from "../SSMIncidentsClient"; import { SSMIncidentsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMIncidentsClient, - input: ListReplicationSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReplicationSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReplicationSets( +export const paginateListReplicationSets: ( config: SSMIncidentsPaginationConfiguration, input: ListReplicationSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReplicationSetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SSMIncidentsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMIncidents | SSMIncidentsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMIncidentsPaginationConfiguration, + ListReplicationSetsCommandInput, + ListReplicationSetsCommandOutput +>(SSMIncidentsClient, ListReplicationSetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ssm-incidents/src/pagination/ListResponsePlansPaginator.ts b/clients/client-ssm-incidents/src/pagination/ListResponsePlansPaginator.ts index f89d18e3f9ca..cd2d73a4530d 100644 --- a/clients/client-ssm-incidents/src/pagination/ListResponsePlansPaginator.ts +++ b/clients/client-ssm-incidents/src/pagination/ListResponsePlansPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMIncidentsClient } from "../SSMIncidentsClient"; import { SSMIncidentsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMIncidentsClient, - input: ListResponsePlansCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResponsePlansCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResponsePlans( +export const paginateListResponsePlans: ( config: SSMIncidentsPaginationConfiguration, input: ListResponsePlansCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResponsePlansCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SSMIncidentsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMIncidents | SSMIncidentsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMIncidentsPaginationConfiguration, + ListResponsePlansCommandInput, + ListResponsePlansCommandOutput +>(SSMIncidentsClient, ListResponsePlansCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ssm-incidents/src/pagination/ListTimelineEventsPaginator.ts b/clients/client-ssm-incidents/src/pagination/ListTimelineEventsPaginator.ts index c7b7a085cd2f..1db0c3d802ce 100644 --- a/clients/client-ssm-incidents/src/pagination/ListTimelineEventsPaginator.ts +++ b/clients/client-ssm-incidents/src/pagination/ListTimelineEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMIncidentsClient } from "../SSMIncidentsClient"; import { SSMIncidentsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMIncidentsClient, - input: ListTimelineEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTimelineEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTimelineEvents( +export const paginateListTimelineEvents: ( config: SSMIncidentsPaginationConfiguration, input: ListTimelineEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTimelineEventsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SSMIncidentsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSMIncidents | SSMIncidentsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMIncidentsPaginationConfiguration, + ListTimelineEventsCommandInput, + ListTimelineEventsCommandOutput +>(SSMIncidentsClient, ListTimelineEventsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-ssm-sap/src/pagination/ListApplicationsPaginator.ts b/clients/client-ssm-sap/src/pagination/ListApplicationsPaginator.ts index 1b4a76589c89..b0c2666619b2 100644 --- a/clients/client-ssm-sap/src/pagination/ListApplicationsPaginator.ts +++ b/clients/client-ssm-sap/src/pagination/ListApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SsmSapClient } from "../SsmSapClient"; import { SsmSapPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SsmSapClient, - input: ListApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplications( +export const paginateListApplications: ( config: SsmSapPaginationConfiguration, input: ListApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SsmSapClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SsmSap | SsmSapClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SsmSapPaginationConfiguration, + ListApplicationsCommandInput, + ListApplicationsCommandOutput +>(SsmSapClient, ListApplicationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm-sap/src/pagination/ListComponentsPaginator.ts b/clients/client-ssm-sap/src/pagination/ListComponentsPaginator.ts index c66c220d1806..83df4d2987fb 100644 --- a/clients/client-ssm-sap/src/pagination/ListComponentsPaginator.ts +++ b/clients/client-ssm-sap/src/pagination/ListComponentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SsmSapClient } from "../SsmSapClient"; import { SsmSapPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SsmSapClient, - input: ListComponentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComponentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComponents( +export const paginateListComponents: ( config: SsmSapPaginationConfiguration, input: ListComponentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComponentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SsmSapClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SsmSap | SsmSapClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SsmSapPaginationConfiguration, + ListComponentsCommandInput, + ListComponentsCommandOutput +>(SsmSapClient, ListComponentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm-sap/src/pagination/ListDatabasesPaginator.ts b/clients/client-ssm-sap/src/pagination/ListDatabasesPaginator.ts index 70efd65ce0df..543d1a99b6b1 100644 --- a/clients/client-ssm-sap/src/pagination/ListDatabasesPaginator.ts +++ b/clients/client-ssm-sap/src/pagination/ListDatabasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SsmSapClient } from "../SsmSapClient"; import { SsmSapPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SsmSapClient, - input: ListDatabasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatabasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatabases( +export const paginateListDatabases: ( config: SsmSapPaginationConfiguration, input: ListDatabasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatabasesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SsmSapClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SsmSap | SsmSapClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SsmSapPaginationConfiguration, + ListDatabasesCommandInput, + ListDatabasesCommandOutput +>(SsmSapClient, ListDatabasesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm-sap/src/pagination/ListOperationsPaginator.ts b/clients/client-ssm-sap/src/pagination/ListOperationsPaginator.ts index 05a25130e68d..a28398e12fff 100644 --- a/clients/client-ssm-sap/src/pagination/ListOperationsPaginator.ts +++ b/clients/client-ssm-sap/src/pagination/ListOperationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SsmSapClient } from "../SsmSapClient"; import { SsmSapPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SsmSapClient, - input: ListOperationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOperationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOperations( +export const paginateListOperations: ( config: SsmSapPaginationConfiguration, input: ListOperationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOperationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SsmSapClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SsmSap | SsmSapClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SsmSapPaginationConfiguration, + ListOperationsCommandInput, + ListOperationsCommandOutput +>(SsmSapClient, ListOperationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/package.json b/clients/client-ssm/package.json index a861425974a5..3a77e7431f4d 100644 --- a/clients/client-ssm/package.json +++ b/clients/client-ssm/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-ssm/src/pagination/DescribeActivationsPaginator.ts b/clients/client-ssm/src/pagination/DescribeActivationsPaginator.ts index 004bd5a2bac1..e2f265281ddd 100644 --- a/clients/client-ssm/src/pagination/DescribeActivationsPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeActivationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeActivationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeActivationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeActivations( +export const paginateDescribeActivations: ( config: SSMPaginationConfiguration, input: DescribeActivationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeActivationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeActivationsCommandInput, + DescribeActivationsCommandOutput +>(SSMClient, DescribeActivationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeAssociationExecutionTargetsPaginator.ts b/clients/client-ssm/src/pagination/DescribeAssociationExecutionTargetsPaginator.ts index a0dec8b98c34..a182c48662da 100644 --- a/clients/client-ssm/src/pagination/DescribeAssociationExecutionTargetsPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeAssociationExecutionTargetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeAssociationExecutionTargetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAssociationExecutionTargetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAssociationExecutionTargets( +export const paginateDescribeAssociationExecutionTargets: ( config: SSMPaginationConfiguration, input: DescribeAssociationExecutionTargetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAssociationExecutionTargetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeAssociationExecutionTargetsCommandInput, + DescribeAssociationExecutionTargetsCommandOutput +>(SSMClient, DescribeAssociationExecutionTargetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeAssociationExecutionsPaginator.ts b/clients/client-ssm/src/pagination/DescribeAssociationExecutionsPaginator.ts index 35c6b50ee287..5e28116cac61 100644 --- a/clients/client-ssm/src/pagination/DescribeAssociationExecutionsPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeAssociationExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeAssociationExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAssociationExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAssociationExecutions( +export const paginateDescribeAssociationExecutions: ( config: SSMPaginationConfiguration, input: DescribeAssociationExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAssociationExecutionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeAssociationExecutionsCommandInput, + DescribeAssociationExecutionsCommandOutput +>(SSMClient, DescribeAssociationExecutionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeAutomationExecutionsPaginator.ts b/clients/client-ssm/src/pagination/DescribeAutomationExecutionsPaginator.ts index b7735cb6b006..277a2249feb0 100644 --- a/clients/client-ssm/src/pagination/DescribeAutomationExecutionsPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeAutomationExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeAutomationExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAutomationExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAutomationExecutions( +export const paginateDescribeAutomationExecutions: ( config: SSMPaginationConfiguration, input: DescribeAutomationExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAutomationExecutionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeAutomationExecutionsCommandInput, + DescribeAutomationExecutionsCommandOutput +>(SSMClient, DescribeAutomationExecutionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeAutomationStepExecutionsPaginator.ts b/clients/client-ssm/src/pagination/DescribeAutomationStepExecutionsPaginator.ts index 061130f6f9a7..75ff93c9369c 100644 --- a/clients/client-ssm/src/pagination/DescribeAutomationStepExecutionsPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeAutomationStepExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeAutomationStepExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAutomationStepExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAutomationStepExecutions( +export const paginateDescribeAutomationStepExecutions: ( config: SSMPaginationConfiguration, input: DescribeAutomationStepExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAutomationStepExecutionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeAutomationStepExecutionsCommandInput, + DescribeAutomationStepExecutionsCommandOutput +>(SSMClient, DescribeAutomationStepExecutionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeAvailablePatchesPaginator.ts b/clients/client-ssm/src/pagination/DescribeAvailablePatchesPaginator.ts index 51bfc10946f6..6e6fb7ce4a9b 100644 --- a/clients/client-ssm/src/pagination/DescribeAvailablePatchesPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeAvailablePatchesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeAvailablePatchesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeAvailablePatchesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeAvailablePatches( +export const paginateDescribeAvailablePatches: ( config: SSMPaginationConfiguration, input: DescribeAvailablePatchesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeAvailablePatchesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeAvailablePatchesCommandInput, + DescribeAvailablePatchesCommandOutput +>(SSMClient, DescribeAvailablePatchesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeEffectiveInstanceAssociationsPaginator.ts b/clients/client-ssm/src/pagination/DescribeEffectiveInstanceAssociationsPaginator.ts index 9c81bac080c0..d145a63d2691 100644 --- a/clients/client-ssm/src/pagination/DescribeEffectiveInstanceAssociationsPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeEffectiveInstanceAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeEffectiveInstanceAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEffectiveInstanceAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEffectiveInstanceAssociations( +export const paginateDescribeEffectiveInstanceAssociations: ( config: SSMPaginationConfiguration, input: DescribeEffectiveInstanceAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEffectiveInstanceAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeEffectiveInstanceAssociationsCommandInput, + DescribeEffectiveInstanceAssociationsCommandOutput +>(SSMClient, DescribeEffectiveInstanceAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeEffectivePatchesForPatchBaselinePaginator.ts b/clients/client-ssm/src/pagination/DescribeEffectivePatchesForPatchBaselinePaginator.ts index 93f4a170497a..08dd76f29650 100644 --- a/clients/client-ssm/src/pagination/DescribeEffectivePatchesForPatchBaselinePaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeEffectivePatchesForPatchBaselinePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeEffectivePatchesForPatchBaselineCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeEffectivePatchesForPatchBaselineCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeEffectivePatchesForPatchBaseline( +export const paginateDescribeEffectivePatchesForPatchBaseline: ( config: SSMPaginationConfiguration, input: DescribeEffectivePatchesForPatchBaselineCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeEffectivePatchesForPatchBaselineCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeEffectivePatchesForPatchBaselineCommandInput, + DescribeEffectivePatchesForPatchBaselineCommandOutput +>(SSMClient, DescribeEffectivePatchesForPatchBaselineCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeInstanceAssociationsStatusPaginator.ts b/clients/client-ssm/src/pagination/DescribeInstanceAssociationsStatusPaginator.ts index 24a8f8b0f400..9884f8a870d2 100644 --- a/clients/client-ssm/src/pagination/DescribeInstanceAssociationsStatusPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeInstanceAssociationsStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeInstanceAssociationsStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstanceAssociationsStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstanceAssociationsStatus( +export const paginateDescribeInstanceAssociationsStatus: ( config: SSMPaginationConfiguration, input: DescribeInstanceAssociationsStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstanceAssociationsStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeInstanceAssociationsStatusCommandInput, + DescribeInstanceAssociationsStatusCommandOutput +>(SSMClient, DescribeInstanceAssociationsStatusCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeInstanceInformationPaginator.ts b/clients/client-ssm/src/pagination/DescribeInstanceInformationPaginator.ts index d80e1a10d55e..035193985a10 100644 --- a/clients/client-ssm/src/pagination/DescribeInstanceInformationPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeInstanceInformationPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeInstanceInformationCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstanceInformationCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstanceInformation( +export const paginateDescribeInstanceInformation: ( config: SSMPaginationConfiguration, input: DescribeInstanceInformationCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstanceInformationCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeInstanceInformationCommandInput, + DescribeInstanceInformationCommandOutput +>(SSMClient, DescribeInstanceInformationCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeInstancePatchStatesForPatchGroupPaginator.ts b/clients/client-ssm/src/pagination/DescribeInstancePatchStatesForPatchGroupPaginator.ts index 4af5dc908ccc..d80c2679f00a 100644 --- a/clients/client-ssm/src/pagination/DescribeInstancePatchStatesForPatchGroupPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeInstancePatchStatesForPatchGroupPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeInstancePatchStatesForPatchGroupCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstancePatchStatesForPatchGroupCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstancePatchStatesForPatchGroup( +export const paginateDescribeInstancePatchStatesForPatchGroup: ( config: SSMPaginationConfiguration, input: DescribeInstancePatchStatesForPatchGroupCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstancePatchStatesForPatchGroupCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeInstancePatchStatesForPatchGroupCommandInput, + DescribeInstancePatchStatesForPatchGroupCommandOutput +>(SSMClient, DescribeInstancePatchStatesForPatchGroupCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeInstancePatchStatesPaginator.ts b/clients/client-ssm/src/pagination/DescribeInstancePatchStatesPaginator.ts index a6df5c0df998..4df51e6feb71 100644 --- a/clients/client-ssm/src/pagination/DescribeInstancePatchStatesPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeInstancePatchStatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeInstancePatchStatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstancePatchStatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstancePatchStates( +export const paginateDescribeInstancePatchStates: ( config: SSMPaginationConfiguration, input: DescribeInstancePatchStatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstancePatchStatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeInstancePatchStatesCommandInput, + DescribeInstancePatchStatesCommandOutput +>(SSMClient, DescribeInstancePatchStatesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeInstancePatchesPaginator.ts b/clients/client-ssm/src/pagination/DescribeInstancePatchesPaginator.ts index 6ffaa01ee12f..2db44994b575 100644 --- a/clients/client-ssm/src/pagination/DescribeInstancePatchesPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeInstancePatchesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeInstancePatchesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInstancePatchesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInstancePatches( +export const paginateDescribeInstancePatches: ( config: SSMPaginationConfiguration, input: DescribeInstancePatchesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInstancePatchesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeInstancePatchesCommandInput, + DescribeInstancePatchesCommandOutput +>(SSMClient, DescribeInstancePatchesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeInventoryDeletionsPaginator.ts b/clients/client-ssm/src/pagination/DescribeInventoryDeletionsPaginator.ts index 804d1cb07ef2..b869d13c1e2a 100644 --- a/clients/client-ssm/src/pagination/DescribeInventoryDeletionsPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeInventoryDeletionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeInventoryDeletionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeInventoryDeletionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeInventoryDeletions( +export const paginateDescribeInventoryDeletions: ( config: SSMPaginationConfiguration, input: DescribeInventoryDeletionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeInventoryDeletionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeInventoryDeletionsCommandInput, + DescribeInventoryDeletionsCommandOutput +>(SSMClient, DescribeInventoryDeletionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowExecutionTaskInvocationsPaginator.ts b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowExecutionTaskInvocationsPaginator.ts index a96572b89ba6..fda2a4ec1338 100644 --- a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowExecutionTaskInvocationsPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowExecutionTaskInvocationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeMaintenanceWindowExecutionTaskInvocationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMaintenanceWindowExecutionTaskInvocationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMaintenanceWindowExecutionTaskInvocations( +export const paginateDescribeMaintenanceWindowExecutionTaskInvocations: ( config: SSMPaginationConfiguration, input: DescribeMaintenanceWindowExecutionTaskInvocationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMaintenanceWindowExecutionTaskInvocationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeMaintenanceWindowExecutionTaskInvocationsCommandInput, + DescribeMaintenanceWindowExecutionTaskInvocationsCommandOutput +>(SSMClient, DescribeMaintenanceWindowExecutionTaskInvocationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowExecutionTasksPaginator.ts b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowExecutionTasksPaginator.ts index 73e610da65aa..0e1fa2613d78 100644 --- a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowExecutionTasksPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowExecutionTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeMaintenanceWindowExecutionTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMaintenanceWindowExecutionTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMaintenanceWindowExecutionTasks( +export const paginateDescribeMaintenanceWindowExecutionTasks: ( config: SSMPaginationConfiguration, input: DescribeMaintenanceWindowExecutionTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMaintenanceWindowExecutionTasksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeMaintenanceWindowExecutionTasksCommandInput, + DescribeMaintenanceWindowExecutionTasksCommandOutput +>(SSMClient, DescribeMaintenanceWindowExecutionTasksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowExecutionsPaginator.ts b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowExecutionsPaginator.ts index 2e1a392535f5..f7f4738a309c 100644 --- a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowExecutionsPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeMaintenanceWindowExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMaintenanceWindowExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMaintenanceWindowExecutions( +export const paginateDescribeMaintenanceWindowExecutions: ( config: SSMPaginationConfiguration, input: DescribeMaintenanceWindowExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMaintenanceWindowExecutionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeMaintenanceWindowExecutionsCommandInput, + DescribeMaintenanceWindowExecutionsCommandOutput +>(SSMClient, DescribeMaintenanceWindowExecutionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowSchedulePaginator.ts b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowSchedulePaginator.ts index b4309e3b85f6..cdc445d380d0 100644 --- a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowSchedulePaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowSchedulePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeMaintenanceWindowScheduleCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMaintenanceWindowScheduleCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMaintenanceWindowSchedule( +export const paginateDescribeMaintenanceWindowSchedule: ( config: SSMPaginationConfiguration, input: DescribeMaintenanceWindowScheduleCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMaintenanceWindowScheduleCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeMaintenanceWindowScheduleCommandInput, + DescribeMaintenanceWindowScheduleCommandOutput +>(SSMClient, DescribeMaintenanceWindowScheduleCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowTargetsPaginator.ts b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowTargetsPaginator.ts index 533f0c095884..053ee9f56c63 100644 --- a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowTargetsPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowTargetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeMaintenanceWindowTargetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMaintenanceWindowTargetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMaintenanceWindowTargets( +export const paginateDescribeMaintenanceWindowTargets: ( config: SSMPaginationConfiguration, input: DescribeMaintenanceWindowTargetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMaintenanceWindowTargetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeMaintenanceWindowTargetsCommandInput, + DescribeMaintenanceWindowTargetsCommandOutput +>(SSMClient, DescribeMaintenanceWindowTargetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowTasksPaginator.ts b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowTasksPaginator.ts index 8e841199e16d..777a3fe1b93e 100644 --- a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowTasksPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeMaintenanceWindowTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMaintenanceWindowTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMaintenanceWindowTasks( +export const paginateDescribeMaintenanceWindowTasks: ( config: SSMPaginationConfiguration, input: DescribeMaintenanceWindowTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMaintenanceWindowTasksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeMaintenanceWindowTasksCommandInput, + DescribeMaintenanceWindowTasksCommandOutput +>(SSMClient, DescribeMaintenanceWindowTasksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowsForTargetPaginator.ts b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowsForTargetPaginator.ts index c61fd73dceb3..0cddd3a362b7 100644 --- a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowsForTargetPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowsForTargetPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeMaintenanceWindowsForTargetCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMaintenanceWindowsForTargetCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMaintenanceWindowsForTarget( +export const paginateDescribeMaintenanceWindowsForTarget: ( config: SSMPaginationConfiguration, input: DescribeMaintenanceWindowsForTargetCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMaintenanceWindowsForTargetCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeMaintenanceWindowsForTargetCommandInput, + DescribeMaintenanceWindowsForTargetCommandOutput +>(SSMClient, DescribeMaintenanceWindowsForTargetCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowsPaginator.ts b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowsPaginator.ts index 082a606020b1..98f4c6b3daa7 100644 --- a/clients/client-ssm/src/pagination/DescribeMaintenanceWindowsPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeMaintenanceWindowsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeMaintenanceWindowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeMaintenanceWindowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeMaintenanceWindows( +export const paginateDescribeMaintenanceWindows: ( config: SSMPaginationConfiguration, input: DescribeMaintenanceWindowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeMaintenanceWindowsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeMaintenanceWindowsCommandInput, + DescribeMaintenanceWindowsCommandOutput +>(SSMClient, DescribeMaintenanceWindowsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeOpsItemsPaginator.ts b/clients/client-ssm/src/pagination/DescribeOpsItemsPaginator.ts index 4de89f22425c..0ba4bec95d8a 100644 --- a/clients/client-ssm/src/pagination/DescribeOpsItemsPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeOpsItemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeOpsItemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeOpsItemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeOpsItems( +export const paginateDescribeOpsItems: ( config: SSMPaginationConfiguration, input: DescribeOpsItemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeOpsItemsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeOpsItemsCommandInput, + DescribeOpsItemsCommandOutput +>(SSMClient, DescribeOpsItemsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeParametersPaginator.ts b/clients/client-ssm/src/pagination/DescribeParametersPaginator.ts index 255fe0706ca3..b8ab83fc8b45 100644 --- a/clients/client-ssm/src/pagination/DescribeParametersPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeParametersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeParametersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeParametersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeParameters( +export const paginateDescribeParameters: ( config: SSMPaginationConfiguration, input: DescribeParametersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeParametersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeParametersCommandInput, + DescribeParametersCommandOutput +>(SSMClient, DescribeParametersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribePatchBaselinesPaginator.ts b/clients/client-ssm/src/pagination/DescribePatchBaselinesPaginator.ts index 03211893f8ba..56474d626063 100644 --- a/clients/client-ssm/src/pagination/DescribePatchBaselinesPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribePatchBaselinesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribePatchBaselinesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePatchBaselinesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePatchBaselines( +export const paginateDescribePatchBaselines: ( config: SSMPaginationConfiguration, input: DescribePatchBaselinesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePatchBaselinesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribePatchBaselinesCommandInput, + DescribePatchBaselinesCommandOutput +>(SSMClient, DescribePatchBaselinesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribePatchGroupsPaginator.ts b/clients/client-ssm/src/pagination/DescribePatchGroupsPaginator.ts index f80f9adb643a..d74a7c928ab7 100644 --- a/clients/client-ssm/src/pagination/DescribePatchGroupsPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribePatchGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribePatchGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePatchGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePatchGroups( +export const paginateDescribePatchGroups: ( config: SSMPaginationConfiguration, input: DescribePatchGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePatchGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribePatchGroupsCommandInput, + DescribePatchGroupsCommandOutput +>(SSMClient, DescribePatchGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribePatchPropertiesPaginator.ts b/clients/client-ssm/src/pagination/DescribePatchPropertiesPaginator.ts index 55d3560f90cc..c9312d6f87fb 100644 --- a/clients/client-ssm/src/pagination/DescribePatchPropertiesPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribePatchPropertiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribePatchPropertiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribePatchPropertiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribePatchProperties( +export const paginateDescribePatchProperties: ( config: SSMPaginationConfiguration, input: DescribePatchPropertiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribePatchPropertiesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribePatchPropertiesCommandInput, + DescribePatchPropertiesCommandOutput +>(SSMClient, DescribePatchPropertiesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/DescribeSessionsPaginator.ts b/clients/client-ssm/src/pagination/DescribeSessionsPaginator.ts index 7890ffda9c96..7017210a5154 100644 --- a/clients/client-ssm/src/pagination/DescribeSessionsPaginator.ts +++ b/clients/client-ssm/src/pagination/DescribeSessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: DescribeSessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeSessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeSessions( +export const paginateDescribeSessions: ( config: SSMPaginationConfiguration, input: DescribeSessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeSessionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + DescribeSessionsCommandInput, + DescribeSessionsCommandOutput +>(SSMClient, DescribeSessionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/GetInventoryPaginator.ts b/clients/client-ssm/src/pagination/GetInventoryPaginator.ts index ca92aff4027d..454d8586f4b0 100644 --- a/clients/client-ssm/src/pagination/GetInventoryPaginator.ts +++ b/clients/client-ssm/src/pagination/GetInventoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: GetInventoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetInventoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetInventory( +export const paginateGetInventory: ( config: SSMPaginationConfiguration, input: GetInventoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetInventoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + GetInventoryCommandInput, + GetInventoryCommandOutput +>(SSMClient, GetInventoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/GetInventorySchemaPaginator.ts b/clients/client-ssm/src/pagination/GetInventorySchemaPaginator.ts index 92eacb8e0cf3..cff3114a065f 100644 --- a/clients/client-ssm/src/pagination/GetInventorySchemaPaginator.ts +++ b/clients/client-ssm/src/pagination/GetInventorySchemaPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: GetInventorySchemaCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetInventorySchemaCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetInventorySchema( +export const paginateGetInventorySchema: ( config: SSMPaginationConfiguration, input: GetInventorySchemaCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetInventorySchemaCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + GetInventorySchemaCommandInput, + GetInventorySchemaCommandOutput +>(SSMClient, GetInventorySchemaCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/GetOpsSummaryPaginator.ts b/clients/client-ssm/src/pagination/GetOpsSummaryPaginator.ts index b0ab3697321c..be0bd01f3789 100644 --- a/clients/client-ssm/src/pagination/GetOpsSummaryPaginator.ts +++ b/clients/client-ssm/src/pagination/GetOpsSummaryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: GetOpsSummaryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetOpsSummaryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetOpsSummary( +export const paginateGetOpsSummary: ( config: SSMPaginationConfiguration, input: GetOpsSummaryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetOpsSummaryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + GetOpsSummaryCommandInput, + GetOpsSummaryCommandOutput +>(SSMClient, GetOpsSummaryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/GetParameterHistoryPaginator.ts b/clients/client-ssm/src/pagination/GetParameterHistoryPaginator.ts index 6e67ab7a0680..f4e61050d4b5 100644 --- a/clients/client-ssm/src/pagination/GetParameterHistoryPaginator.ts +++ b/clients/client-ssm/src/pagination/GetParameterHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: GetParameterHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetParameterHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetParameterHistory( +export const paginateGetParameterHistory: ( config: SSMPaginationConfiguration, input: GetParameterHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetParameterHistoryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + GetParameterHistoryCommandInput, + GetParameterHistoryCommandOutput +>(SSMClient, GetParameterHistoryCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/GetParametersByPathPaginator.ts b/clients/client-ssm/src/pagination/GetParametersByPathPaginator.ts index 40d1af5be6d8..488c73a276a2 100644 --- a/clients/client-ssm/src/pagination/GetParametersByPathPaginator.ts +++ b/clients/client-ssm/src/pagination/GetParametersByPathPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: GetParametersByPathCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetParametersByPathCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetParametersByPath( +export const paginateGetParametersByPath: ( config: SSMPaginationConfiguration, input: GetParametersByPathCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetParametersByPathCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + GetParametersByPathCommandInput, + GetParametersByPathCommandOutput +>(SSMClient, GetParametersByPathCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/GetResourcePoliciesPaginator.ts b/clients/client-ssm/src/pagination/GetResourcePoliciesPaginator.ts index 296e02564d27..888bbd6299c6 100644 --- a/clients/client-ssm/src/pagination/GetResourcePoliciesPaginator.ts +++ b/clients/client-ssm/src/pagination/GetResourcePoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: GetResourcePoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetResourcePoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetResourcePolicies( +export const paginateGetResourcePolicies: ( config: SSMPaginationConfiguration, input: GetResourcePoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetResourcePoliciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + GetResourcePoliciesCommandInput, + GetResourcePoliciesCommandOutput +>(SSMClient, GetResourcePoliciesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/ListAssociationVersionsPaginator.ts b/clients/client-ssm/src/pagination/ListAssociationVersionsPaginator.ts index 4f17272f4f21..98ee47b53083 100644 --- a/clients/client-ssm/src/pagination/ListAssociationVersionsPaginator.ts +++ b/clients/client-ssm/src/pagination/ListAssociationVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: ListAssociationVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssociationVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssociationVersions( +export const paginateListAssociationVersions: ( config: SSMPaginationConfiguration, input: ListAssociationVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssociationVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + ListAssociationVersionsCommandInput, + ListAssociationVersionsCommandOutput +>(SSMClient, ListAssociationVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/ListAssociationsPaginator.ts b/clients/client-ssm/src/pagination/ListAssociationsPaginator.ts index 76e673ef3c86..b2f525feaea8 100644 --- a/clients/client-ssm/src/pagination/ListAssociationsPaginator.ts +++ b/clients/client-ssm/src/pagination/ListAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: ListAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssociations( +export const paginateListAssociations: ( config: SSMPaginationConfiguration, input: ListAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + ListAssociationsCommandInput, + ListAssociationsCommandOutput +>(SSMClient, ListAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/ListCommandInvocationsPaginator.ts b/clients/client-ssm/src/pagination/ListCommandInvocationsPaginator.ts index deb34d32e462..30009010b31d 100644 --- a/clients/client-ssm/src/pagination/ListCommandInvocationsPaginator.ts +++ b/clients/client-ssm/src/pagination/ListCommandInvocationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: ListCommandInvocationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCommandInvocationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCommandInvocations( +export const paginateListCommandInvocations: ( config: SSMPaginationConfiguration, input: ListCommandInvocationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCommandInvocationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + ListCommandInvocationsCommandInput, + ListCommandInvocationsCommandOutput +>(SSMClient, ListCommandInvocationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/ListCommandsPaginator.ts b/clients/client-ssm/src/pagination/ListCommandsPaginator.ts index 3daffda1034b..bc4951277892 100644 --- a/clients/client-ssm/src/pagination/ListCommandsPaginator.ts +++ b/clients/client-ssm/src/pagination/ListCommandsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: ListCommandsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCommandsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCommands( +export const paginateListCommands: ( config: SSMPaginationConfiguration, input: ListCommandsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCommandsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + ListCommandsCommandInput, + ListCommandsCommandOutput +>(SSMClient, ListCommandsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/ListComplianceItemsPaginator.ts b/clients/client-ssm/src/pagination/ListComplianceItemsPaginator.ts index 48bd4d617f33..f0ab1109779c 100644 --- a/clients/client-ssm/src/pagination/ListComplianceItemsPaginator.ts +++ b/clients/client-ssm/src/pagination/ListComplianceItemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: ListComplianceItemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComplianceItemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComplianceItems( +export const paginateListComplianceItems: ( config: SSMPaginationConfiguration, input: ListComplianceItemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComplianceItemsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + ListComplianceItemsCommandInput, + ListComplianceItemsCommandOutput +>(SSMClient, ListComplianceItemsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/ListComplianceSummariesPaginator.ts b/clients/client-ssm/src/pagination/ListComplianceSummariesPaginator.ts index 5bf3282ccb1d..3dd54600bd30 100644 --- a/clients/client-ssm/src/pagination/ListComplianceSummariesPaginator.ts +++ b/clients/client-ssm/src/pagination/ListComplianceSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: ListComplianceSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListComplianceSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListComplianceSummaries( +export const paginateListComplianceSummaries: ( config: SSMPaginationConfiguration, input: ListComplianceSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListComplianceSummariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + ListComplianceSummariesCommandInput, + ListComplianceSummariesCommandOutput +>(SSMClient, ListComplianceSummariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/ListDocumentVersionsPaginator.ts b/clients/client-ssm/src/pagination/ListDocumentVersionsPaginator.ts index 47c08c328ba0..edd948c9188d 100644 --- a/clients/client-ssm/src/pagination/ListDocumentVersionsPaginator.ts +++ b/clients/client-ssm/src/pagination/ListDocumentVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: ListDocumentVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDocumentVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDocumentVersions( +export const paginateListDocumentVersions: ( config: SSMPaginationConfiguration, input: ListDocumentVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDocumentVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + ListDocumentVersionsCommandInput, + ListDocumentVersionsCommandOutput +>(SSMClient, ListDocumentVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/ListDocumentsPaginator.ts b/clients/client-ssm/src/pagination/ListDocumentsPaginator.ts index 91e652d86dd1..ab116146c210 100644 --- a/clients/client-ssm/src/pagination/ListDocumentsPaginator.ts +++ b/clients/client-ssm/src/pagination/ListDocumentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: ListDocumentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDocumentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDocuments( +export const paginateListDocuments: ( config: SSMPaginationConfiguration, input: ListDocumentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDocumentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + ListDocumentsCommandInput, + ListDocumentsCommandOutput +>(SSMClient, ListDocumentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/ListOpsItemEventsPaginator.ts b/clients/client-ssm/src/pagination/ListOpsItemEventsPaginator.ts index 72981028880c..fc2aa78378cb 100644 --- a/clients/client-ssm/src/pagination/ListOpsItemEventsPaginator.ts +++ b/clients/client-ssm/src/pagination/ListOpsItemEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: ListOpsItemEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOpsItemEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOpsItemEvents( +export const paginateListOpsItemEvents: ( config: SSMPaginationConfiguration, input: ListOpsItemEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOpsItemEventsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + ListOpsItemEventsCommandInput, + ListOpsItemEventsCommandOutput +>(SSMClient, ListOpsItemEventsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/ListOpsItemRelatedItemsPaginator.ts b/clients/client-ssm/src/pagination/ListOpsItemRelatedItemsPaginator.ts index 7fd77ae477da..a731ef1e5918 100644 --- a/clients/client-ssm/src/pagination/ListOpsItemRelatedItemsPaginator.ts +++ b/clients/client-ssm/src/pagination/ListOpsItemRelatedItemsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: ListOpsItemRelatedItemsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOpsItemRelatedItemsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOpsItemRelatedItems( +export const paginateListOpsItemRelatedItems: ( config: SSMPaginationConfiguration, input: ListOpsItemRelatedItemsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOpsItemRelatedItemsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + ListOpsItemRelatedItemsCommandInput, + ListOpsItemRelatedItemsCommandOutput +>(SSMClient, ListOpsItemRelatedItemsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/ListOpsMetadataPaginator.ts b/clients/client-ssm/src/pagination/ListOpsMetadataPaginator.ts index 0a2c59653108..778d0dd84e9f 100644 --- a/clients/client-ssm/src/pagination/ListOpsMetadataPaginator.ts +++ b/clients/client-ssm/src/pagination/ListOpsMetadataPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: ListOpsMetadataCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOpsMetadataCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOpsMetadata( +export const paginateListOpsMetadata: ( config: SSMPaginationConfiguration, input: ListOpsMetadataCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOpsMetadataCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + ListOpsMetadataCommandInput, + ListOpsMetadataCommandOutput +>(SSMClient, ListOpsMetadataCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/ListResourceComplianceSummariesPaginator.ts b/clients/client-ssm/src/pagination/ListResourceComplianceSummariesPaginator.ts index b072eb34fedd..6e58da15c47c 100644 --- a/clients/client-ssm/src/pagination/ListResourceComplianceSummariesPaginator.ts +++ b/clients/client-ssm/src/pagination/ListResourceComplianceSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: ListResourceComplianceSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourceComplianceSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourceComplianceSummaries( +export const paginateListResourceComplianceSummaries: ( config: SSMPaginationConfiguration, input: ListResourceComplianceSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourceComplianceSummariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + ListResourceComplianceSummariesCommandInput, + ListResourceComplianceSummariesCommandOutput +>(SSMClient, ListResourceComplianceSummariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-ssm/src/pagination/ListResourceDataSyncPaginator.ts b/clients/client-ssm/src/pagination/ListResourceDataSyncPaginator.ts index a65cbb1fad5d..6b7aa7a5dc2e 100644 --- a/clients/client-ssm/src/pagination/ListResourceDataSyncPaginator.ts +++ b/clients/client-ssm/src/pagination/ListResourceDataSyncPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSMClient } from "../SSMClient"; import { SSMPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSMClient, - input: ListResourceDataSyncCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourceDataSyncCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourceDataSync( +export const paginateListResourceDataSync: ( config: SSMPaginationConfiguration, input: ListResourceDataSyncCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourceDataSyncCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSMClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSM | SSMClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSMPaginationConfiguration, + ListResourceDataSyncCommandInput, + ListResourceDataSyncCommandOutput +>(SSMClient, ListResourceDataSyncCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/package.json b/clients/client-sso-admin/package.json index 83672fb10833..a84e320d8748 100644 --- a/clients/client-sso-admin/package.json +++ b/clients/client-sso-admin/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-sso-admin/src/pagination/ListAccountAssignmentCreationStatusPaginator.ts b/clients/client-sso-admin/src/pagination/ListAccountAssignmentCreationStatusPaginator.ts index 3fdd2247ed80..cbbe8ebec1e3 100644 --- a/clients/client-sso-admin/src/pagination/ListAccountAssignmentCreationStatusPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListAccountAssignmentCreationStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListAccountAssignmentCreationStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccountAssignmentCreationStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccountAssignmentCreationStatus( +export const paginateListAccountAssignmentCreationStatus: ( config: SSOAdminPaginationConfiguration, input: ListAccountAssignmentCreationStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccountAssignmentCreationStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListAccountAssignmentCreationStatusCommandInput, + ListAccountAssignmentCreationStatusCommandOutput +>(SSOAdminClient, ListAccountAssignmentCreationStatusCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListAccountAssignmentDeletionStatusPaginator.ts b/clients/client-sso-admin/src/pagination/ListAccountAssignmentDeletionStatusPaginator.ts index cf932aa0e490..dbe8ef1e825a 100644 --- a/clients/client-sso-admin/src/pagination/ListAccountAssignmentDeletionStatusPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListAccountAssignmentDeletionStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListAccountAssignmentDeletionStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccountAssignmentDeletionStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccountAssignmentDeletionStatus( +export const paginateListAccountAssignmentDeletionStatus: ( config: SSOAdminPaginationConfiguration, input: ListAccountAssignmentDeletionStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccountAssignmentDeletionStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListAccountAssignmentDeletionStatusCommandInput, + ListAccountAssignmentDeletionStatusCommandOutput +>(SSOAdminClient, ListAccountAssignmentDeletionStatusCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListAccountAssignmentsForPrincipalPaginator.ts b/clients/client-sso-admin/src/pagination/ListAccountAssignmentsForPrincipalPaginator.ts index 32e3db6945da..46a1ec196d92 100644 --- a/clients/client-sso-admin/src/pagination/ListAccountAssignmentsForPrincipalPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListAccountAssignmentsForPrincipalPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListAccountAssignmentsForPrincipalCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccountAssignmentsForPrincipalCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccountAssignmentsForPrincipal( +export const paginateListAccountAssignmentsForPrincipal: ( config: SSOAdminPaginationConfiguration, input: ListAccountAssignmentsForPrincipalCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccountAssignmentsForPrincipalCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListAccountAssignmentsForPrincipalCommandInput, + ListAccountAssignmentsForPrincipalCommandOutput +>(SSOAdminClient, ListAccountAssignmentsForPrincipalCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListAccountAssignmentsPaginator.ts b/clients/client-sso-admin/src/pagination/ListAccountAssignmentsPaginator.ts index 22f4d3885b02..c4a9509758b8 100644 --- a/clients/client-sso-admin/src/pagination/ListAccountAssignmentsPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListAccountAssignmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListAccountAssignmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccountAssignmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccountAssignments( +export const paginateListAccountAssignments: ( config: SSOAdminPaginationConfiguration, input: ListAccountAssignmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccountAssignmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListAccountAssignmentsCommandInput, + ListAccountAssignmentsCommandOutput +>(SSOAdminClient, ListAccountAssignmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListAccountsForProvisionedPermissionSetPaginator.ts b/clients/client-sso-admin/src/pagination/ListAccountsForProvisionedPermissionSetPaginator.ts index 4a84651e51e1..5fbe174fa112 100644 --- a/clients/client-sso-admin/src/pagination/ListAccountsForProvisionedPermissionSetPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListAccountsForProvisionedPermissionSetPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListAccountsForProvisionedPermissionSetCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccountsForProvisionedPermissionSetCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccountsForProvisionedPermissionSet( +export const paginateListAccountsForProvisionedPermissionSet: ( config: SSOAdminPaginationConfiguration, input: ListAccountsForProvisionedPermissionSetCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccountsForProvisionedPermissionSetCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListAccountsForProvisionedPermissionSetCommandInput, + ListAccountsForProvisionedPermissionSetCommandOutput +>(SSOAdminClient, ListAccountsForProvisionedPermissionSetCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListApplicationAccessScopesPaginator.ts b/clients/client-sso-admin/src/pagination/ListApplicationAccessScopesPaginator.ts index 73e2530acbe4..a3051dea30e9 100644 --- a/clients/client-sso-admin/src/pagination/ListApplicationAccessScopesPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListApplicationAccessScopesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListApplicationAccessScopesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationAccessScopesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationAccessScopes( +export const paginateListApplicationAccessScopes: ( config: SSOAdminPaginationConfiguration, input: ListApplicationAccessScopesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationAccessScopesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListApplicationAccessScopesCommandInput, + ListApplicationAccessScopesCommandOutput +>(SSOAdminClient, ListApplicationAccessScopesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListApplicationAssignmentsForPrincipalPaginator.ts b/clients/client-sso-admin/src/pagination/ListApplicationAssignmentsForPrincipalPaginator.ts index adf481af93b5..553832485cc6 100644 --- a/clients/client-sso-admin/src/pagination/ListApplicationAssignmentsForPrincipalPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListApplicationAssignmentsForPrincipalPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListApplicationAssignmentsForPrincipalCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationAssignmentsForPrincipalCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationAssignmentsForPrincipal( +export const paginateListApplicationAssignmentsForPrincipal: ( config: SSOAdminPaginationConfiguration, input: ListApplicationAssignmentsForPrincipalCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationAssignmentsForPrincipalCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListApplicationAssignmentsForPrincipalCommandInput, + ListApplicationAssignmentsForPrincipalCommandOutput +>(SSOAdminClient, ListApplicationAssignmentsForPrincipalCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListApplicationAssignmentsPaginator.ts b/clients/client-sso-admin/src/pagination/ListApplicationAssignmentsPaginator.ts index cc53d71be4ed..ab1f8680296a 100644 --- a/clients/client-sso-admin/src/pagination/ListApplicationAssignmentsPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListApplicationAssignmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListApplicationAssignmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationAssignmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationAssignments( +export const paginateListApplicationAssignments: ( config: SSOAdminPaginationConfiguration, input: ListApplicationAssignmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationAssignmentsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListApplicationAssignmentsCommandInput, + ListApplicationAssignmentsCommandOutput +>(SSOAdminClient, ListApplicationAssignmentsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListApplicationAuthenticationMethodsPaginator.ts b/clients/client-sso-admin/src/pagination/ListApplicationAuthenticationMethodsPaginator.ts index 2fe14e7bace8..040adfacc08f 100644 --- a/clients/client-sso-admin/src/pagination/ListApplicationAuthenticationMethodsPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListApplicationAuthenticationMethodsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListApplicationAuthenticationMethodsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationAuthenticationMethodsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationAuthenticationMethods( +export const paginateListApplicationAuthenticationMethods: ( config: SSOAdminPaginationConfiguration, input: ListApplicationAuthenticationMethodsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationAuthenticationMethodsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListApplicationAuthenticationMethodsCommandInput, + ListApplicationAuthenticationMethodsCommandOutput +>(SSOAdminClient, ListApplicationAuthenticationMethodsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-sso-admin/src/pagination/ListApplicationGrantsPaginator.ts b/clients/client-sso-admin/src/pagination/ListApplicationGrantsPaginator.ts index b9197390c722..63cecb1749e8 100644 --- a/clients/client-sso-admin/src/pagination/ListApplicationGrantsPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListApplicationGrantsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListApplicationGrantsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationGrantsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationGrants( +export const paginateListApplicationGrants: ( config: SSOAdminPaginationConfiguration, input: ListApplicationGrantsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationGrantsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListApplicationGrantsCommandInput, + ListApplicationGrantsCommandOutput +>(SSOAdminClient, ListApplicationGrantsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-sso-admin/src/pagination/ListApplicationProvidersPaginator.ts b/clients/client-sso-admin/src/pagination/ListApplicationProvidersPaginator.ts index eef9bc9f472a..b59451b5c699 100644 --- a/clients/client-sso-admin/src/pagination/ListApplicationProvidersPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListApplicationProvidersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListApplicationProvidersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationProvidersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplicationProviders( +export const paginateListApplicationProviders: ( config: SSOAdminPaginationConfiguration, input: ListApplicationProvidersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationProvidersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListApplicationProvidersCommandInput, + ListApplicationProvidersCommandOutput +>(SSOAdminClient, ListApplicationProvidersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListApplicationsPaginator.ts b/clients/client-sso-admin/src/pagination/ListApplicationsPaginator.ts index f25017152142..32b2db532c13 100644 --- a/clients/client-sso-admin/src/pagination/ListApplicationsPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListApplications( +export const paginateListApplications: ( config: SSOAdminPaginationConfiguration, input: ListApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListApplicationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListApplicationsCommandInput, + ListApplicationsCommandOutput +>(SSOAdminClient, ListApplicationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListCustomerManagedPolicyReferencesInPermissionSetPaginator.ts b/clients/client-sso-admin/src/pagination/ListCustomerManagedPolicyReferencesInPermissionSetPaginator.ts index 0fed5d45a331..b802ea8a718c 100644 --- a/clients/client-sso-admin/src/pagination/ListCustomerManagedPolicyReferencesInPermissionSetPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListCustomerManagedPolicyReferencesInPermissionSetPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListCustomerManagedPolicyReferencesInPermissionSetCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCustomerManagedPolicyReferencesInPermissionSetCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCustomerManagedPolicyReferencesInPermissionSet( +export const paginateListCustomerManagedPolicyReferencesInPermissionSet: ( config: SSOAdminPaginationConfiguration, input: ListCustomerManagedPolicyReferencesInPermissionSetCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCustomerManagedPolicyReferencesInPermissionSetCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListCustomerManagedPolicyReferencesInPermissionSetCommandInput, + ListCustomerManagedPolicyReferencesInPermissionSetCommandOutput +>(SSOAdminClient, ListCustomerManagedPolicyReferencesInPermissionSetCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListInstancesPaginator.ts b/clients/client-sso-admin/src/pagination/ListInstancesPaginator.ts index 978971682762..512e9522eb4c 100644 --- a/clients/client-sso-admin/src/pagination/ListInstancesPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListInstances( +export const paginateListInstances: ( config: SSOAdminPaginationConfiguration, input: ListInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListInstancesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListInstancesCommandInput, + ListInstancesCommandOutput +>(SSOAdminClient, ListInstancesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListManagedPoliciesInPermissionSetPaginator.ts b/clients/client-sso-admin/src/pagination/ListManagedPoliciesInPermissionSetPaginator.ts index e66f233a2e9b..780d0fc549ea 100644 --- a/clients/client-sso-admin/src/pagination/ListManagedPoliciesInPermissionSetPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListManagedPoliciesInPermissionSetPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListManagedPoliciesInPermissionSetCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListManagedPoliciesInPermissionSetCommand(input), ...args); -}; /** * @public */ -export async function* paginateListManagedPoliciesInPermissionSet( +export const paginateListManagedPoliciesInPermissionSet: ( config: SSOAdminPaginationConfiguration, input: ListManagedPoliciesInPermissionSetCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListManagedPoliciesInPermissionSetCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListManagedPoliciesInPermissionSetCommandInput, + ListManagedPoliciesInPermissionSetCommandOutput +>(SSOAdminClient, ListManagedPoliciesInPermissionSetCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListPermissionSetProvisioningStatusPaginator.ts b/clients/client-sso-admin/src/pagination/ListPermissionSetProvisioningStatusPaginator.ts index eb4f2338063d..fd0fba7a2221 100644 --- a/clients/client-sso-admin/src/pagination/ListPermissionSetProvisioningStatusPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListPermissionSetProvisioningStatusPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListPermissionSetProvisioningStatusCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPermissionSetProvisioningStatusCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPermissionSetProvisioningStatus( +export const paginateListPermissionSetProvisioningStatus: ( config: SSOAdminPaginationConfiguration, input: ListPermissionSetProvisioningStatusCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPermissionSetProvisioningStatusCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListPermissionSetProvisioningStatusCommandInput, + ListPermissionSetProvisioningStatusCommandOutput +>(SSOAdminClient, ListPermissionSetProvisioningStatusCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListPermissionSetsPaginator.ts b/clients/client-sso-admin/src/pagination/ListPermissionSetsPaginator.ts index a5310e897c47..0e658d454e85 100644 --- a/clients/client-sso-admin/src/pagination/ListPermissionSetsPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListPermissionSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListPermissionSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPermissionSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPermissionSets( +export const paginateListPermissionSets: ( config: SSOAdminPaginationConfiguration, input: ListPermissionSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPermissionSetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListPermissionSetsCommandInput, + ListPermissionSetsCommandOutput +>(SSOAdminClient, ListPermissionSetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListPermissionSetsProvisionedToAccountPaginator.ts b/clients/client-sso-admin/src/pagination/ListPermissionSetsProvisionedToAccountPaginator.ts index d3e387116a96..13a752651da0 100644 --- a/clients/client-sso-admin/src/pagination/ListPermissionSetsProvisionedToAccountPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListPermissionSetsProvisionedToAccountPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListPermissionSetsProvisionedToAccountCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPermissionSetsProvisionedToAccountCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPermissionSetsProvisionedToAccount( +export const paginateListPermissionSetsProvisionedToAccount: ( config: SSOAdminPaginationConfiguration, input: ListPermissionSetsProvisionedToAccountCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPermissionSetsProvisionedToAccountCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListPermissionSetsProvisionedToAccountCommandInput, + ListPermissionSetsProvisionedToAccountCommandOutput +>(SSOAdminClient, ListPermissionSetsProvisionedToAccountCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso-admin/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-sso-admin/src/pagination/ListTagsForResourcePaginator.ts index 03c9cba0bbee..462f62f4e054 100644 --- a/clients/client-sso-admin/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: SSOAdminPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(SSOAdminClient, ListTagsForResourceCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-sso-admin/src/pagination/ListTrustedTokenIssuersPaginator.ts b/clients/client-sso-admin/src/pagination/ListTrustedTokenIssuersPaginator.ts index e2397e8ba148..8572daac065f 100644 --- a/clients/client-sso-admin/src/pagination/ListTrustedTokenIssuersPaginator.ts +++ b/clients/client-sso-admin/src/pagination/ListTrustedTokenIssuersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOAdminClient } from "../SSOAdminClient"; import { SSOAdminPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOAdminClient, - input: ListTrustedTokenIssuersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTrustedTokenIssuersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTrustedTokenIssuers( +export const paginateListTrustedTokenIssuers: ( config: SSOAdminPaginationConfiguration, input: ListTrustedTokenIssuersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTrustedTokenIssuersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SSOAdminClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSOAdmin | SSOAdminClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOAdminPaginationConfiguration, + ListTrustedTokenIssuersCommandInput, + ListTrustedTokenIssuersCommandOutput +>(SSOAdminClient, ListTrustedTokenIssuersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-sso/src/pagination/ListAccountRolesPaginator.ts b/clients/client-sso/src/pagination/ListAccountRolesPaginator.ts index 8ae60a6280b2..aaad8d6833eb 100644 --- a/clients/client-sso/src/pagination/ListAccountRolesPaginator.ts +++ b/clients/client-sso/src/pagination/ListAccountRolesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOClient } from "../SSOClient"; import { SSOPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOClient, - input: ListAccountRolesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccountRolesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccountRoles( +export const paginateListAccountRoles: ( config: SSOPaginationConfiguration, input: ListAccountRolesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccountRolesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SSOClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSO | SSOClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOPaginationConfiguration, + ListAccountRolesCommandInput, + ListAccountRolesCommandOutput +>(SSOClient, ListAccountRolesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-sso/src/pagination/ListAccountsPaginator.ts b/clients/client-sso/src/pagination/ListAccountsPaginator.ts index 35ef35884a77..4a7be677adb2 100644 --- a/clients/client-sso/src/pagination/ListAccountsPaginator.ts +++ b/clients/client-sso/src/pagination/ListAccountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SSOClient } from "../SSOClient"; import { SSOPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SSOClient, - input: ListAccountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccounts( +export const paginateListAccounts: ( config: SSOPaginationConfiguration, input: ListAccountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccountsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SSOClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SSO | SSOClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SSOPaginationConfiguration, + ListAccountsCommandInput, + ListAccountsCommandOutput +>(SSOClient, ListAccountsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-storage-gateway/package.json b/clients/client-storage-gateway/package.json index ae12bcd96496..202e50611a86 100644 --- a/clients/client-storage-gateway/package.json +++ b/clients/client-storage-gateway/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-storage-gateway/src/pagination/DescribeTapeArchivesPaginator.ts b/clients/client-storage-gateway/src/pagination/DescribeTapeArchivesPaginator.ts index 80b775dc2ced..d704431814c7 100644 --- a/clients/client-storage-gateway/src/pagination/DescribeTapeArchivesPaginator.ts +++ b/clients/client-storage-gateway/src/pagination/DescribeTapeArchivesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { StorageGatewayClient } from "../StorageGatewayClient"; import { StorageGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: StorageGatewayClient, - input: DescribeTapeArchivesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTapeArchivesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTapeArchives( +export const paginateDescribeTapeArchives: ( config: StorageGatewayPaginationConfiguration, input: DescribeTapeArchivesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTapeArchivesCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof StorageGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected StorageGateway | StorageGatewayClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + StorageGatewayPaginationConfiguration, + DescribeTapeArchivesCommandInput, + DescribeTapeArchivesCommandOutput +>(StorageGatewayClient, DescribeTapeArchivesCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-storage-gateway/src/pagination/DescribeTapeRecoveryPointsPaginator.ts b/clients/client-storage-gateway/src/pagination/DescribeTapeRecoveryPointsPaginator.ts index a0fe9430606a..bbad2b8f09c1 100644 --- a/clients/client-storage-gateway/src/pagination/DescribeTapeRecoveryPointsPaginator.ts +++ b/clients/client-storage-gateway/src/pagination/DescribeTapeRecoveryPointsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { StorageGatewayClient } from "../StorageGatewayClient"; import { StorageGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: StorageGatewayClient, - input: DescribeTapeRecoveryPointsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTapeRecoveryPointsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTapeRecoveryPoints( +export const paginateDescribeTapeRecoveryPoints: ( config: StorageGatewayPaginationConfiguration, input: DescribeTapeRecoveryPointsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTapeRecoveryPointsCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof StorageGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected StorageGateway | StorageGatewayClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + StorageGatewayPaginationConfiguration, + DescribeTapeRecoveryPointsCommandInput, + DescribeTapeRecoveryPointsCommandOutput +>(StorageGatewayClient, DescribeTapeRecoveryPointsCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-storage-gateway/src/pagination/DescribeTapesPaginator.ts b/clients/client-storage-gateway/src/pagination/DescribeTapesPaginator.ts index 14a684059a62..1e1d25489391 100644 --- a/clients/client-storage-gateway/src/pagination/DescribeTapesPaginator.ts +++ b/clients/client-storage-gateway/src/pagination/DescribeTapesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { StorageGatewayClient } from "../StorageGatewayClient"; import { StorageGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: StorageGatewayClient, - input: DescribeTapesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeTapesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeTapes( +export const paginateDescribeTapes: ( config: StorageGatewayPaginationConfiguration, input: DescribeTapesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeTapesCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof StorageGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected StorageGateway | StorageGatewayClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + StorageGatewayPaginationConfiguration, + DescribeTapesCommandInput, + DescribeTapesCommandOutput +>(StorageGatewayClient, DescribeTapesCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-storage-gateway/src/pagination/DescribeVTLDevicesPaginator.ts b/clients/client-storage-gateway/src/pagination/DescribeVTLDevicesPaginator.ts index 75b5fc28161b..7f6720489019 100644 --- a/clients/client-storage-gateway/src/pagination/DescribeVTLDevicesPaginator.ts +++ b/clients/client-storage-gateway/src/pagination/DescribeVTLDevicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { StorageGatewayClient } from "../StorageGatewayClient"; import { StorageGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: StorageGatewayClient, - input: DescribeVTLDevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeVTLDevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeVTLDevices( +export const paginateDescribeVTLDevices: ( config: StorageGatewayPaginationConfiguration, input: DescribeVTLDevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeVTLDevicesCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof StorageGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected StorageGateway | StorageGatewayClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + StorageGatewayPaginationConfiguration, + DescribeVTLDevicesCommandInput, + DescribeVTLDevicesCommandOutput +>(StorageGatewayClient, DescribeVTLDevicesCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-storage-gateway/src/pagination/ListFileSharesPaginator.ts b/clients/client-storage-gateway/src/pagination/ListFileSharesPaginator.ts index 04cd37e49bd8..35a2a3fa64c9 100644 --- a/clients/client-storage-gateway/src/pagination/ListFileSharesPaginator.ts +++ b/clients/client-storage-gateway/src/pagination/ListFileSharesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { StorageGatewayClient } from "../StorageGatewayClient"; import { StorageGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: StorageGatewayClient, - input: ListFileSharesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFileSharesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFileShares( +export const paginateListFileShares: ( config: StorageGatewayPaginationConfiguration, input: ListFileSharesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFileSharesCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof StorageGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected StorageGateway | StorageGatewayClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + StorageGatewayPaginationConfiguration, + ListFileSharesCommandInput, + ListFileSharesCommandOutput +>(StorageGatewayClient, ListFileSharesCommand, "Marker", "NextMarker", "Limit"); diff --git a/clients/client-storage-gateway/src/pagination/ListFileSystemAssociationsPaginator.ts b/clients/client-storage-gateway/src/pagination/ListFileSystemAssociationsPaginator.ts index 9c2519275f6f..185c837503e6 100644 --- a/clients/client-storage-gateway/src/pagination/ListFileSystemAssociationsPaginator.ts +++ b/clients/client-storage-gateway/src/pagination/ListFileSystemAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { StorageGatewayClient } from "../StorageGatewayClient"; import { StorageGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: StorageGatewayClient, - input: ListFileSystemAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFileSystemAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFileSystemAssociations( +export const paginateListFileSystemAssociations: ( config: StorageGatewayPaginationConfiguration, input: ListFileSystemAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFileSystemAssociationsCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof StorageGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected StorageGateway | StorageGatewayClient"); - } - yield page; - const prevToken = token; - token = page.NextMarker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + StorageGatewayPaginationConfiguration, + ListFileSystemAssociationsCommandInput, + ListFileSystemAssociationsCommandOutput +>(StorageGatewayClient, ListFileSystemAssociationsCommand, "Marker", "NextMarker", "Limit"); diff --git a/clients/client-storage-gateway/src/pagination/ListGatewaysPaginator.ts b/clients/client-storage-gateway/src/pagination/ListGatewaysPaginator.ts index cdc69e86ab2e..b49bdb8bf82f 100644 --- a/clients/client-storage-gateway/src/pagination/ListGatewaysPaginator.ts +++ b/clients/client-storage-gateway/src/pagination/ListGatewaysPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { StorageGatewayClient } from "../StorageGatewayClient"; import { StorageGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: StorageGatewayClient, - input: ListGatewaysCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGatewaysCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGateways( +export const paginateListGateways: ( config: StorageGatewayPaginationConfiguration, input: ListGatewaysCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGatewaysCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof StorageGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected StorageGateway | StorageGatewayClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + StorageGatewayPaginationConfiguration, + ListGatewaysCommandInput, + ListGatewaysCommandOutput +>(StorageGatewayClient, ListGatewaysCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-storage-gateway/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-storage-gateway/src/pagination/ListTagsForResourcePaginator.ts index ec8b25813b04..8d3e3e187d55 100644 --- a/clients/client-storage-gateway/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-storage-gateway/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { StorageGatewayClient } from "../StorageGatewayClient"; import { StorageGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: StorageGatewayClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: StorageGatewayPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof StorageGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected StorageGateway | StorageGatewayClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + StorageGatewayPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(StorageGatewayClient, ListTagsForResourceCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-storage-gateway/src/pagination/ListTapePoolsPaginator.ts b/clients/client-storage-gateway/src/pagination/ListTapePoolsPaginator.ts index ac08aa559281..f0ab0c48518c 100644 --- a/clients/client-storage-gateway/src/pagination/ListTapePoolsPaginator.ts +++ b/clients/client-storage-gateway/src/pagination/ListTapePoolsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { StorageGatewayClient } from "../StorageGatewayClient"; import { StorageGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: StorageGatewayClient, - input: ListTapePoolsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTapePoolsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTapePools( +export const paginateListTapePools: ( config: StorageGatewayPaginationConfiguration, input: ListTapePoolsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTapePoolsCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof StorageGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected StorageGateway | StorageGatewayClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + StorageGatewayPaginationConfiguration, + ListTapePoolsCommandInput, + ListTapePoolsCommandOutput +>(StorageGatewayClient, ListTapePoolsCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-storage-gateway/src/pagination/ListTapesPaginator.ts b/clients/client-storage-gateway/src/pagination/ListTapesPaginator.ts index ce76601cec90..7e5fac72dd16 100644 --- a/clients/client-storage-gateway/src/pagination/ListTapesPaginator.ts +++ b/clients/client-storage-gateway/src/pagination/ListTapesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTapesCommand, ListTapesCommandInput, ListTapesCommandOutput } from "../commands/ListTapesCommand"; import { StorageGatewayClient } from "../StorageGatewayClient"; import { StorageGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: StorageGatewayClient, - input: ListTapesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTapesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTapes( +export const paginateListTapes: ( config: StorageGatewayPaginationConfiguration, input: ListTapesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTapesCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof StorageGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected StorageGateway | StorageGatewayClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + StorageGatewayPaginationConfiguration, + ListTapesCommandInput, + ListTapesCommandOutput +>(StorageGatewayClient, ListTapesCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-storage-gateway/src/pagination/ListVolumesPaginator.ts b/clients/client-storage-gateway/src/pagination/ListVolumesPaginator.ts index 020b3873800d..e7c19f82a74a 100644 --- a/clients/client-storage-gateway/src/pagination/ListVolumesPaginator.ts +++ b/clients/client-storage-gateway/src/pagination/ListVolumesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListVolumesCommand, ListVolumesCommandInput, ListVolumesCommandOutput } from "../commands/ListVolumesCommand"; import { StorageGatewayClient } from "../StorageGatewayClient"; import { StorageGatewayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: StorageGatewayClient, - input: ListVolumesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVolumesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVolumes( +export const paginateListVolumes: ( config: StorageGatewayPaginationConfiguration, input: ListVolumesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVolumesCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof StorageGatewayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected StorageGateway | StorageGatewayClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + StorageGatewayPaginationConfiguration, + ListVolumesCommandInput, + ListVolumesCommandOutput +>(StorageGatewayClient, ListVolumesCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-support-app/src/pagination/ListSlackChannelConfigurationsPaginator.ts b/clients/client-support-app/src/pagination/ListSlackChannelConfigurationsPaginator.ts index c13c098464a7..20de15e79a20 100644 --- a/clients/client-support-app/src/pagination/ListSlackChannelConfigurationsPaginator.ts +++ b/clients/client-support-app/src/pagination/ListSlackChannelConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SupportAppClient } from "../SupportAppClient"; import { SupportAppPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SupportAppClient, - input: ListSlackChannelConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSlackChannelConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSlackChannelConfigurations( +export const paginateListSlackChannelConfigurations: ( config: SupportAppPaginationConfiguration, input: ListSlackChannelConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSlackChannelConfigurationsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof SupportAppClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SupportApp | SupportAppClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SupportAppPaginationConfiguration, + ListSlackChannelConfigurationsCommandInput, + ListSlackChannelConfigurationsCommandOutput +>(SupportAppClient, ListSlackChannelConfigurationsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-support-app/src/pagination/ListSlackWorkspaceConfigurationsPaginator.ts b/clients/client-support-app/src/pagination/ListSlackWorkspaceConfigurationsPaginator.ts index b4dc4420e221..d352ef755743 100644 --- a/clients/client-support-app/src/pagination/ListSlackWorkspaceConfigurationsPaginator.ts +++ b/clients/client-support-app/src/pagination/ListSlackWorkspaceConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { SupportAppClient } from "../SupportAppClient"; import { SupportAppPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SupportAppClient, - input: ListSlackWorkspaceConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSlackWorkspaceConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSlackWorkspaceConfigurations( +export const paginateListSlackWorkspaceConfigurations: ( config: SupportAppPaginationConfiguration, input: ListSlackWorkspaceConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSlackWorkspaceConfigurationsCommandOutput; - while (hasNext) { - input.nextToken = token; - if (config.client instanceof SupportAppClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SupportApp | SupportAppClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SupportAppPaginationConfiguration, + ListSlackWorkspaceConfigurationsCommandInput, + ListSlackWorkspaceConfigurationsCommandOutput +>(SupportAppClient, ListSlackWorkspaceConfigurationsCommand, "nextToken", "nextToken", ""); diff --git a/clients/client-support/package.json b/clients/client-support/package.json index 3d9dbdf8d858..73096a1d4043 100644 --- a/clients/client-support/package.json +++ b/clients/client-support/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-support/src/pagination/DescribeCasesPaginator.ts b/clients/client-support/src/pagination/DescribeCasesPaginator.ts index 744b6e8762c6..a7c810970714 100644 --- a/clients/client-support/src/pagination/DescribeCasesPaginator.ts +++ b/clients/client-support/src/pagination/DescribeCasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SupportClient } from "../SupportClient"; import { SupportPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SupportClient, - input: DescribeCasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCases( +export const paginateDescribeCases: ( config: SupportPaginationConfiguration, input: DescribeCasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCasesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SupportClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Support | SupportClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SupportPaginationConfiguration, + DescribeCasesCommandInput, + DescribeCasesCommandOutput +>(SupportClient, DescribeCasesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-support/src/pagination/DescribeCommunicationsPaginator.ts b/clients/client-support/src/pagination/DescribeCommunicationsPaginator.ts index 31c7130421c2..27e01e44f255 100644 --- a/clients/client-support/src/pagination/DescribeCommunicationsPaginator.ts +++ b/clients/client-support/src/pagination/DescribeCommunicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SupportClient } from "../SupportClient"; import { SupportPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SupportClient, - input: DescribeCommunicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCommunicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCommunications( +export const paginateDescribeCommunications: ( config: SupportPaginationConfiguration, input: DescribeCommunicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCommunicationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof SupportClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Support | SupportClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SupportPaginationConfiguration, + DescribeCommunicationsCommandInput, + DescribeCommunicationsCommandOutput +>(SupportClient, DescribeCommunicationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-swf/package.json b/clients/client-swf/package.json index cb9b3026d791..75cd56d57244 100644 --- a/clients/client-swf/package.json +++ b/clients/client-swf/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-swf/src/pagination/GetWorkflowExecutionHistoryPaginator.ts b/clients/client-swf/src/pagination/GetWorkflowExecutionHistoryPaginator.ts index e80f81370dcf..604e00a982b5 100644 --- a/clients/client-swf/src/pagination/GetWorkflowExecutionHistoryPaginator.ts +++ b/clients/client-swf/src/pagination/GetWorkflowExecutionHistoryPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SWFClient } from "../SWFClient"; import { SWFPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SWFClient, - input: GetWorkflowExecutionHistoryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetWorkflowExecutionHistoryCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetWorkflowExecutionHistory( +export const paginateGetWorkflowExecutionHistory: ( config: SWFPaginationConfiguration, input: GetWorkflowExecutionHistoryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextPageToken - let token: typeof input.nextPageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetWorkflowExecutionHistoryCommandOutput; - while (hasNext) { - input.nextPageToken = token; - input["maximumPageSize"] = config.pageSize; - if (config.client instanceof SWFClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SWF | SWFClient"); - } - yield page; - const prevToken = token; - token = page.nextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SWFPaginationConfiguration, + GetWorkflowExecutionHistoryCommandInput, + GetWorkflowExecutionHistoryCommandOutput +>(SWFClient, GetWorkflowExecutionHistoryCommand, "nextPageToken", "nextPageToken", "maximumPageSize"); diff --git a/clients/client-swf/src/pagination/ListActivityTypesPaginator.ts b/clients/client-swf/src/pagination/ListActivityTypesPaginator.ts index 395d32dd9746..c472c89dcf3c 100644 --- a/clients/client-swf/src/pagination/ListActivityTypesPaginator.ts +++ b/clients/client-swf/src/pagination/ListActivityTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SWFClient } from "../SWFClient"; import { SWFPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SWFClient, - input: ListActivityTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListActivityTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListActivityTypes( +export const paginateListActivityTypes: ( config: SWFPaginationConfiguration, input: ListActivityTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextPageToken - let token: typeof input.nextPageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListActivityTypesCommandOutput; - while (hasNext) { - input.nextPageToken = token; - input["maximumPageSize"] = config.pageSize; - if (config.client instanceof SWFClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SWF | SWFClient"); - } - yield page; - const prevToken = token; - token = page.nextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SWFPaginationConfiguration, + ListActivityTypesCommandInput, + ListActivityTypesCommandOutput +>(SWFClient, ListActivityTypesCommand, "nextPageToken", "nextPageToken", "maximumPageSize"); diff --git a/clients/client-swf/src/pagination/ListClosedWorkflowExecutionsPaginator.ts b/clients/client-swf/src/pagination/ListClosedWorkflowExecutionsPaginator.ts index 716424a3538b..a05187d6d0db 100644 --- a/clients/client-swf/src/pagination/ListClosedWorkflowExecutionsPaginator.ts +++ b/clients/client-swf/src/pagination/ListClosedWorkflowExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SWFClient } from "../SWFClient"; import { SWFPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SWFClient, - input: ListClosedWorkflowExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListClosedWorkflowExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListClosedWorkflowExecutions( +export const paginateListClosedWorkflowExecutions: ( config: SWFPaginationConfiguration, input: ListClosedWorkflowExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextPageToken - let token: typeof input.nextPageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListClosedWorkflowExecutionsCommandOutput; - while (hasNext) { - input.nextPageToken = token; - input["maximumPageSize"] = config.pageSize; - if (config.client instanceof SWFClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SWF | SWFClient"); - } - yield page; - const prevToken = token; - token = page.nextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SWFPaginationConfiguration, + ListClosedWorkflowExecutionsCommandInput, + ListClosedWorkflowExecutionsCommandOutput +>(SWFClient, ListClosedWorkflowExecutionsCommand, "nextPageToken", "nextPageToken", "maximumPageSize"); diff --git a/clients/client-swf/src/pagination/ListDomainsPaginator.ts b/clients/client-swf/src/pagination/ListDomainsPaginator.ts index ffdb97e3c5c9..4a86f5541ca6 100644 --- a/clients/client-swf/src/pagination/ListDomainsPaginator.ts +++ b/clients/client-swf/src/pagination/ListDomainsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListDomainsCommand, ListDomainsCommandInput, ListDomainsCommandOutput } from "../commands/ListDomainsCommand"; import { SWFClient } from "../SWFClient"; import { SWFPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SWFClient, - input: ListDomainsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomains( +export const paginateListDomains: ( config: SWFPaginationConfiguration, input: ListDomainsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextPageToken - let token: typeof input.nextPageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainsCommandOutput; - while (hasNext) { - input.nextPageToken = token; - input["maximumPageSize"] = config.pageSize; - if (config.client instanceof SWFClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SWF | SWFClient"); - } - yield page; - const prevToken = token; - token = page.nextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SWFPaginationConfiguration, + ListDomainsCommandInput, + ListDomainsCommandOutput +>(SWFClient, ListDomainsCommand, "nextPageToken", "nextPageToken", "maximumPageSize"); diff --git a/clients/client-swf/src/pagination/ListOpenWorkflowExecutionsPaginator.ts b/clients/client-swf/src/pagination/ListOpenWorkflowExecutionsPaginator.ts index 3c31463920aa..86f46a040010 100644 --- a/clients/client-swf/src/pagination/ListOpenWorkflowExecutionsPaginator.ts +++ b/clients/client-swf/src/pagination/ListOpenWorkflowExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SWFClient } from "../SWFClient"; import { SWFPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SWFClient, - input: ListOpenWorkflowExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOpenWorkflowExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOpenWorkflowExecutions( +export const paginateListOpenWorkflowExecutions: ( config: SWFPaginationConfiguration, input: ListOpenWorkflowExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextPageToken - let token: typeof input.nextPageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOpenWorkflowExecutionsCommandOutput; - while (hasNext) { - input.nextPageToken = token; - input["maximumPageSize"] = config.pageSize; - if (config.client instanceof SWFClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SWF | SWFClient"); - } - yield page; - const prevToken = token; - token = page.nextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SWFPaginationConfiguration, + ListOpenWorkflowExecutionsCommandInput, + ListOpenWorkflowExecutionsCommandOutput +>(SWFClient, ListOpenWorkflowExecutionsCommand, "nextPageToken", "nextPageToken", "maximumPageSize"); diff --git a/clients/client-swf/src/pagination/ListWorkflowTypesPaginator.ts b/clients/client-swf/src/pagination/ListWorkflowTypesPaginator.ts index 5fa46950cd84..e7cbc5d3462a 100644 --- a/clients/client-swf/src/pagination/ListWorkflowTypesPaginator.ts +++ b/clients/client-swf/src/pagination/ListWorkflowTypesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SWFClient } from "../SWFClient"; import { SWFPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SWFClient, - input: ListWorkflowTypesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkflowTypesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkflowTypes( +export const paginateListWorkflowTypes: ( config: SWFPaginationConfiguration, input: ListWorkflowTypesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextPageToken - let token: typeof input.nextPageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkflowTypesCommandOutput; - while (hasNext) { - input.nextPageToken = token; - input["maximumPageSize"] = config.pageSize; - if (config.client instanceof SWFClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SWF | SWFClient"); - } - yield page; - const prevToken = token; - token = page.nextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SWFPaginationConfiguration, + ListWorkflowTypesCommandInput, + ListWorkflowTypesCommandOutput +>(SWFClient, ListWorkflowTypesCommand, "nextPageToken", "nextPageToken", "maximumPageSize"); diff --git a/clients/client-swf/src/pagination/PollForDecisionTaskPaginator.ts b/clients/client-swf/src/pagination/PollForDecisionTaskPaginator.ts index 1eb618f6c4b6..7b08de1fcf04 100644 --- a/clients/client-swf/src/pagination/PollForDecisionTaskPaginator.ts +++ b/clients/client-swf/src/pagination/PollForDecisionTaskPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SWFClient } from "../SWFClient"; import { SWFPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SWFClient, - input: PollForDecisionTaskCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new PollForDecisionTaskCommand(input), ...args); -}; /** * @public */ -export async function* paginatePollForDecisionTask( +export const paginatePollForDecisionTask: ( config: SWFPaginationConfiguration, input: PollForDecisionTaskCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextPageToken - let token: typeof input.nextPageToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: PollForDecisionTaskCommandOutput; - while (hasNext) { - input.nextPageToken = token; - input["maximumPageSize"] = config.pageSize; - if (config.client instanceof SWFClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected SWF | SWFClient"); - } - yield page; - const prevToken = token; - token = page.nextPageToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SWFPaginationConfiguration, + PollForDecisionTaskCommandInput, + PollForDecisionTaskCommandOutput +>(SWFClient, PollForDecisionTaskCommand, "nextPageToken", "nextPageToken", "maximumPageSize"); diff --git a/clients/client-synthetics/src/pagination/DescribeCanariesLastRunPaginator.ts b/clients/client-synthetics/src/pagination/DescribeCanariesLastRunPaginator.ts index 53ad7ae0c24c..02f078f2f884 100644 --- a/clients/client-synthetics/src/pagination/DescribeCanariesLastRunPaginator.ts +++ b/clients/client-synthetics/src/pagination/DescribeCanariesLastRunPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SyntheticsClient } from "../SyntheticsClient"; import { SyntheticsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SyntheticsClient, - input: DescribeCanariesLastRunCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCanariesLastRunCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCanariesLastRun( +export const paginateDescribeCanariesLastRun: ( config: SyntheticsPaginationConfiguration, input: DescribeCanariesLastRunCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCanariesLastRunCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SyntheticsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Synthetics | SyntheticsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SyntheticsPaginationConfiguration, + DescribeCanariesLastRunCommandInput, + DescribeCanariesLastRunCommandOutput +>(SyntheticsClient, DescribeCanariesLastRunCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-synthetics/src/pagination/DescribeCanariesPaginator.ts b/clients/client-synthetics/src/pagination/DescribeCanariesPaginator.ts index f583255210ca..eb64ad0f1669 100644 --- a/clients/client-synthetics/src/pagination/DescribeCanariesPaginator.ts +++ b/clients/client-synthetics/src/pagination/DescribeCanariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SyntheticsClient } from "../SyntheticsClient"; import { SyntheticsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SyntheticsClient, - input: DescribeCanariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCanariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeCanaries( +export const paginateDescribeCanaries: ( config: SyntheticsPaginationConfiguration, input: DescribeCanariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCanariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SyntheticsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Synthetics | SyntheticsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SyntheticsPaginationConfiguration, + DescribeCanariesCommandInput, + DescribeCanariesCommandOutput +>(SyntheticsClient, DescribeCanariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-synthetics/src/pagination/DescribeRuntimeVersionsPaginator.ts b/clients/client-synthetics/src/pagination/DescribeRuntimeVersionsPaginator.ts index 656d82749ef5..791e73ee5ec4 100644 --- a/clients/client-synthetics/src/pagination/DescribeRuntimeVersionsPaginator.ts +++ b/clients/client-synthetics/src/pagination/DescribeRuntimeVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SyntheticsClient } from "../SyntheticsClient"; import { SyntheticsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SyntheticsClient, - input: DescribeRuntimeVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRuntimeVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRuntimeVersions( +export const paginateDescribeRuntimeVersions: ( config: SyntheticsPaginationConfiguration, input: DescribeRuntimeVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRuntimeVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SyntheticsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Synthetics | SyntheticsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SyntheticsPaginationConfiguration, + DescribeRuntimeVersionsCommandInput, + DescribeRuntimeVersionsCommandOutput +>(SyntheticsClient, DescribeRuntimeVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-synthetics/src/pagination/GetCanaryRunsPaginator.ts b/clients/client-synthetics/src/pagination/GetCanaryRunsPaginator.ts index d416c472111d..ea5bb7e9e770 100644 --- a/clients/client-synthetics/src/pagination/GetCanaryRunsPaginator.ts +++ b/clients/client-synthetics/src/pagination/GetCanaryRunsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SyntheticsClient } from "../SyntheticsClient"; import { SyntheticsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SyntheticsClient, - input: GetCanaryRunsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetCanaryRunsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetCanaryRuns( +export const paginateGetCanaryRuns: ( config: SyntheticsPaginationConfiguration, input: GetCanaryRunsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetCanaryRunsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SyntheticsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Synthetics | SyntheticsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SyntheticsPaginationConfiguration, + GetCanaryRunsCommandInput, + GetCanaryRunsCommandOutput +>(SyntheticsClient, GetCanaryRunsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-synthetics/src/pagination/ListAssociatedGroupsPaginator.ts b/clients/client-synthetics/src/pagination/ListAssociatedGroupsPaginator.ts index e52232760665..a010a68d833d 100644 --- a/clients/client-synthetics/src/pagination/ListAssociatedGroupsPaginator.ts +++ b/clients/client-synthetics/src/pagination/ListAssociatedGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SyntheticsClient } from "../SyntheticsClient"; import { SyntheticsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SyntheticsClient, - input: ListAssociatedGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssociatedGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssociatedGroups( +export const paginateListAssociatedGroups: ( config: SyntheticsPaginationConfiguration, input: ListAssociatedGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssociatedGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SyntheticsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Synthetics | SyntheticsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SyntheticsPaginationConfiguration, + ListAssociatedGroupsCommandInput, + ListAssociatedGroupsCommandOutput +>(SyntheticsClient, ListAssociatedGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-synthetics/src/pagination/ListGroupResourcesPaginator.ts b/clients/client-synthetics/src/pagination/ListGroupResourcesPaginator.ts index 1f2339f7e233..277c33868c20 100644 --- a/clients/client-synthetics/src/pagination/ListGroupResourcesPaginator.ts +++ b/clients/client-synthetics/src/pagination/ListGroupResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { SyntheticsClient } from "../SyntheticsClient"; import { SyntheticsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SyntheticsClient, - input: ListGroupResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroupResources( +export const paginateListGroupResources: ( config: SyntheticsPaginationConfiguration, input: ListGroupResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupResourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SyntheticsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Synthetics | SyntheticsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SyntheticsPaginationConfiguration, + ListGroupResourcesCommandInput, + ListGroupResourcesCommandOutput +>(SyntheticsClient, ListGroupResourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-synthetics/src/pagination/ListGroupsPaginator.ts b/clients/client-synthetics/src/pagination/ListGroupsPaginator.ts index 0a4e1129477d..3fa2476d3ef1 100644 --- a/clients/client-synthetics/src/pagination/ListGroupsPaginator.ts +++ b/clients/client-synthetics/src/pagination/ListGroupsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListGroupsCommand, ListGroupsCommandInput, ListGroupsCommandOutput } from "../commands/ListGroupsCommand"; import { SyntheticsClient } from "../SyntheticsClient"; import { SyntheticsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: SyntheticsClient, - input: ListGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroups( +export const paginateListGroups: ( config: SyntheticsPaginationConfiguration, input: ListGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof SyntheticsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Synthetics | SyntheticsClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + SyntheticsPaginationConfiguration, + ListGroupsCommandInput, + ListGroupsCommandOutput +>(SyntheticsClient, ListGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-textract/package.json b/clients/client-textract/package.json index a81c4b1099b7..e6c95636f797 100644 --- a/clients/client-textract/package.json +++ b/clients/client-textract/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-textract/src/pagination/ListAdapterVersionsPaginator.ts b/clients/client-textract/src/pagination/ListAdapterVersionsPaginator.ts index 13190146a6ff..d81150b04c08 100644 --- a/clients/client-textract/src/pagination/ListAdapterVersionsPaginator.ts +++ b/clients/client-textract/src/pagination/ListAdapterVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TextractClient } from "../TextractClient"; import { TextractPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TextractClient, - input: ListAdapterVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAdapterVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAdapterVersions( +export const paginateListAdapterVersions: ( config: TextractPaginationConfiguration, input: ListAdapterVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAdapterVersionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TextractClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Textract | TextractClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TextractPaginationConfiguration, + ListAdapterVersionsCommandInput, + ListAdapterVersionsCommandOutput +>(TextractClient, ListAdapterVersionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-textract/src/pagination/ListAdaptersPaginator.ts b/clients/client-textract/src/pagination/ListAdaptersPaginator.ts index a33f43c7aab8..92fad6d4aac6 100644 --- a/clients/client-textract/src/pagination/ListAdaptersPaginator.ts +++ b/clients/client-textract/src/pagination/ListAdaptersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TextractClient } from "../TextractClient"; import { TextractPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TextractClient, - input: ListAdaptersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAdaptersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAdapters( +export const paginateListAdapters: ( config: TextractPaginationConfiguration, input: ListAdaptersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAdaptersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TextractClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Textract | TextractClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TextractPaginationConfiguration, + ListAdaptersCommandInput, + ListAdaptersCommandOutput +>(TextractClient, ListAdaptersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-timestream-query/package.json b/clients/client-timestream-query/package.json index f4383d1ba79c..896f793b0534 100644 --- a/clients/client-timestream-query/package.json +++ b/clients/client-timestream-query/package.json @@ -35,6 +35,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-timestream-query/src/pagination/ListScheduledQueriesPaginator.ts b/clients/client-timestream-query/src/pagination/ListScheduledQueriesPaginator.ts index fb8edd0d79a7..2c3b91c4e255 100644 --- a/clients/client-timestream-query/src/pagination/ListScheduledQueriesPaginator.ts +++ b/clients/client-timestream-query/src/pagination/ListScheduledQueriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TimestreamQueryClient } from "../TimestreamQueryClient"; import { TimestreamQueryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TimestreamQueryClient, - input: ListScheduledQueriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListScheduledQueriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListScheduledQueries( +export const paginateListScheduledQueries: ( config: TimestreamQueryPaginationConfiguration, input: ListScheduledQueriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListScheduledQueriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TimestreamQueryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected TimestreamQuery | TimestreamQueryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TimestreamQueryPaginationConfiguration, + ListScheduledQueriesCommandInput, + ListScheduledQueriesCommandOutput +>(TimestreamQueryClient, ListScheduledQueriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-timestream-query/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-timestream-query/src/pagination/ListTagsForResourcePaginator.ts index ec7c498ab0c3..984a425dd656 100644 --- a/clients/client-timestream-query/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-timestream-query/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TimestreamQueryClient } from "../TimestreamQueryClient"; import { TimestreamQueryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TimestreamQueryClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: TimestreamQueryPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TimestreamQueryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected TimestreamQuery | TimestreamQueryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TimestreamQueryPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(TimestreamQueryClient, ListTagsForResourceCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-timestream-query/src/pagination/QueryPaginator.ts b/clients/client-timestream-query/src/pagination/QueryPaginator.ts index b8c5b4e05f5a..d105f11ad060 100644 --- a/clients/client-timestream-query/src/pagination/QueryPaginator.ts +++ b/clients/client-timestream-query/src/pagination/QueryPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { QueryCommand, QueryCommandInput, QueryCommandOutput } from "../commands/QueryCommand"; import { TimestreamQueryClient } from "../TimestreamQueryClient"; import { TimestreamQueryPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TimestreamQueryClient, - input: QueryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new QueryCommand(input), ...args); -}; /** * @public */ -export async function* paginateQuery( +export const paginateQuery: ( config: TimestreamQueryPaginationConfiguration, input: QueryCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: QueryCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxRows"] = config.pageSize; - if (config.client instanceof TimestreamQueryClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected TimestreamQuery | TimestreamQueryClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TimestreamQueryPaginationConfiguration, + QueryCommandInput, + QueryCommandOutput +>(TimestreamQueryClient, QueryCommand, "NextToken", "NextToken", "MaxRows"); diff --git a/clients/client-timestream-write/package.json b/clients/client-timestream-write/package.json index ad5fa1f46bd0..1cd08e0196b6 100644 --- a/clients/client-timestream-write/package.json +++ b/clients/client-timestream-write/package.json @@ -35,6 +35,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-timestream-write/src/pagination/ListBatchLoadTasksPaginator.ts b/clients/client-timestream-write/src/pagination/ListBatchLoadTasksPaginator.ts index e769c2f3f9bb..fc0b16a477a2 100644 --- a/clients/client-timestream-write/src/pagination/ListBatchLoadTasksPaginator.ts +++ b/clients/client-timestream-write/src/pagination/ListBatchLoadTasksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TimestreamWriteClient } from "../TimestreamWriteClient"; import { TimestreamWritePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TimestreamWriteClient, - input: ListBatchLoadTasksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBatchLoadTasksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBatchLoadTasks( +export const paginateListBatchLoadTasks: ( config: TimestreamWritePaginationConfiguration, input: ListBatchLoadTasksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBatchLoadTasksCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TimestreamWriteClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected TimestreamWrite | TimestreamWriteClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TimestreamWritePaginationConfiguration, + ListBatchLoadTasksCommandInput, + ListBatchLoadTasksCommandOutput +>(TimestreamWriteClient, ListBatchLoadTasksCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-timestream-write/src/pagination/ListDatabasesPaginator.ts b/clients/client-timestream-write/src/pagination/ListDatabasesPaginator.ts index 630e11a96296..02c647cff88d 100644 --- a/clients/client-timestream-write/src/pagination/ListDatabasesPaginator.ts +++ b/clients/client-timestream-write/src/pagination/ListDatabasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TimestreamWriteClient } from "../TimestreamWriteClient"; import { TimestreamWritePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TimestreamWriteClient, - input: ListDatabasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDatabasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDatabases( +export const paginateListDatabases: ( config: TimestreamWritePaginationConfiguration, input: ListDatabasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDatabasesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TimestreamWriteClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected TimestreamWrite | TimestreamWriteClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TimestreamWritePaginationConfiguration, + ListDatabasesCommandInput, + ListDatabasesCommandOutput +>(TimestreamWriteClient, ListDatabasesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-timestream-write/src/pagination/ListTablesPaginator.ts b/clients/client-timestream-write/src/pagination/ListTablesPaginator.ts index 71a3fc750bc7..4c85a03436f4 100644 --- a/clients/client-timestream-write/src/pagination/ListTablesPaginator.ts +++ b/clients/client-timestream-write/src/pagination/ListTablesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTablesCommand, ListTablesCommandInput, ListTablesCommandOutput } from "../commands/ListTablesCommand"; import { TimestreamWriteClient } from "../TimestreamWriteClient"; import { TimestreamWritePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TimestreamWriteClient, - input: ListTablesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTablesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTables( +export const paginateListTables: ( config: TimestreamWritePaginationConfiguration, input: ListTablesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTablesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TimestreamWriteClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected TimestreamWrite | TimestreamWriteClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TimestreamWritePaginationConfiguration, + ListTablesCommandInput, + ListTablesCommandOutput +>(TimestreamWriteClient, ListTablesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-tnb/src/pagination/ListSolFunctionInstancesPaginator.ts b/clients/client-tnb/src/pagination/ListSolFunctionInstancesPaginator.ts index fd9f6c1f9fbd..ea6a38173731 100644 --- a/clients/client-tnb/src/pagination/ListSolFunctionInstancesPaginator.ts +++ b/clients/client-tnb/src/pagination/ListSolFunctionInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TnbClient } from "../TnbClient"; import { TnbPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TnbClient, - input: ListSolFunctionInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSolFunctionInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSolFunctionInstances( +export const paginateListSolFunctionInstances: ( config: TnbPaginationConfiguration, input: ListSolFunctionInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSolFunctionInstancesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof TnbClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Tnb | TnbClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TnbPaginationConfiguration, + ListSolFunctionInstancesCommandInput, + ListSolFunctionInstancesCommandOutput +>(TnbClient, ListSolFunctionInstancesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-tnb/src/pagination/ListSolFunctionPackagesPaginator.ts b/clients/client-tnb/src/pagination/ListSolFunctionPackagesPaginator.ts index ff160c4a7864..8b3d06cf85bc 100644 --- a/clients/client-tnb/src/pagination/ListSolFunctionPackagesPaginator.ts +++ b/clients/client-tnb/src/pagination/ListSolFunctionPackagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TnbClient } from "../TnbClient"; import { TnbPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TnbClient, - input: ListSolFunctionPackagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSolFunctionPackagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSolFunctionPackages( +export const paginateListSolFunctionPackages: ( config: TnbPaginationConfiguration, input: ListSolFunctionPackagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSolFunctionPackagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof TnbClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Tnb | TnbClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TnbPaginationConfiguration, + ListSolFunctionPackagesCommandInput, + ListSolFunctionPackagesCommandOutput +>(TnbClient, ListSolFunctionPackagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-tnb/src/pagination/ListSolNetworkInstancesPaginator.ts b/clients/client-tnb/src/pagination/ListSolNetworkInstancesPaginator.ts index 346d3df95069..555d897162f4 100644 --- a/clients/client-tnb/src/pagination/ListSolNetworkInstancesPaginator.ts +++ b/clients/client-tnb/src/pagination/ListSolNetworkInstancesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TnbClient } from "../TnbClient"; import { TnbPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TnbClient, - input: ListSolNetworkInstancesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSolNetworkInstancesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSolNetworkInstances( +export const paginateListSolNetworkInstances: ( config: TnbPaginationConfiguration, input: ListSolNetworkInstancesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSolNetworkInstancesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof TnbClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Tnb | TnbClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TnbPaginationConfiguration, + ListSolNetworkInstancesCommandInput, + ListSolNetworkInstancesCommandOutput +>(TnbClient, ListSolNetworkInstancesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-tnb/src/pagination/ListSolNetworkOperationsPaginator.ts b/clients/client-tnb/src/pagination/ListSolNetworkOperationsPaginator.ts index fc15f6de0c98..14e967628ef7 100644 --- a/clients/client-tnb/src/pagination/ListSolNetworkOperationsPaginator.ts +++ b/clients/client-tnb/src/pagination/ListSolNetworkOperationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TnbClient } from "../TnbClient"; import { TnbPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TnbClient, - input: ListSolNetworkOperationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSolNetworkOperationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSolNetworkOperations( +export const paginateListSolNetworkOperations: ( config: TnbPaginationConfiguration, input: ListSolNetworkOperationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSolNetworkOperationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof TnbClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Tnb | TnbClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TnbPaginationConfiguration, + ListSolNetworkOperationsCommandInput, + ListSolNetworkOperationsCommandOutput +>(TnbClient, ListSolNetworkOperationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-tnb/src/pagination/ListSolNetworkPackagesPaginator.ts b/clients/client-tnb/src/pagination/ListSolNetworkPackagesPaginator.ts index 7f1175255cf5..50bb0d99019d 100644 --- a/clients/client-tnb/src/pagination/ListSolNetworkPackagesPaginator.ts +++ b/clients/client-tnb/src/pagination/ListSolNetworkPackagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TnbClient } from "../TnbClient"; import { TnbPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TnbClient, - input: ListSolNetworkPackagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSolNetworkPackagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSolNetworkPackages( +export const paginateListSolNetworkPackages: ( config: TnbPaginationConfiguration, input: ListSolNetworkPackagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSolNetworkPackagesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof TnbClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Tnb | TnbClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TnbPaginationConfiguration, + ListSolNetworkPackagesCommandInput, + ListSolNetworkPackagesCommandOutput +>(TnbClient, ListSolNetworkPackagesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-transcribe/package.json b/clients/client-transcribe/package.json index 63f35be4a1a3..a1c0fd7a8d22 100644 --- a/clients/client-transcribe/package.json +++ b/clients/client-transcribe/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-transcribe/src/pagination/ListCallAnalyticsCategoriesPaginator.ts b/clients/client-transcribe/src/pagination/ListCallAnalyticsCategoriesPaginator.ts index 5dd0e119eac2..ef63d9bc65d7 100644 --- a/clients/client-transcribe/src/pagination/ListCallAnalyticsCategoriesPaginator.ts +++ b/clients/client-transcribe/src/pagination/ListCallAnalyticsCategoriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TranscribeClient } from "../TranscribeClient"; import { TranscribePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TranscribeClient, - input: ListCallAnalyticsCategoriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCallAnalyticsCategoriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCallAnalyticsCategories( +export const paginateListCallAnalyticsCategories: ( config: TranscribePaginationConfiguration, input: ListCallAnalyticsCategoriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCallAnalyticsCategoriesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TranscribeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transcribe | TranscribeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TranscribePaginationConfiguration, + ListCallAnalyticsCategoriesCommandInput, + ListCallAnalyticsCategoriesCommandOutput +>(TranscribeClient, ListCallAnalyticsCategoriesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transcribe/src/pagination/ListCallAnalyticsJobsPaginator.ts b/clients/client-transcribe/src/pagination/ListCallAnalyticsJobsPaginator.ts index 76382f351675..4bd855068083 100644 --- a/clients/client-transcribe/src/pagination/ListCallAnalyticsJobsPaginator.ts +++ b/clients/client-transcribe/src/pagination/ListCallAnalyticsJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TranscribeClient } from "../TranscribeClient"; import { TranscribePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TranscribeClient, - input: ListCallAnalyticsJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCallAnalyticsJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCallAnalyticsJobs( +export const paginateListCallAnalyticsJobs: ( config: TranscribePaginationConfiguration, input: ListCallAnalyticsJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCallAnalyticsJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TranscribeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transcribe | TranscribeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TranscribePaginationConfiguration, + ListCallAnalyticsJobsCommandInput, + ListCallAnalyticsJobsCommandOutput +>(TranscribeClient, ListCallAnalyticsJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transcribe/src/pagination/ListLanguageModelsPaginator.ts b/clients/client-transcribe/src/pagination/ListLanguageModelsPaginator.ts index 99ddef99c63e..42346df38247 100644 --- a/clients/client-transcribe/src/pagination/ListLanguageModelsPaginator.ts +++ b/clients/client-transcribe/src/pagination/ListLanguageModelsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TranscribeClient } from "../TranscribeClient"; import { TranscribePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TranscribeClient, - input: ListLanguageModelsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLanguageModelsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLanguageModels( +export const paginateListLanguageModels: ( config: TranscribePaginationConfiguration, input: ListLanguageModelsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLanguageModelsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TranscribeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transcribe | TranscribeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TranscribePaginationConfiguration, + ListLanguageModelsCommandInput, + ListLanguageModelsCommandOutput +>(TranscribeClient, ListLanguageModelsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transcribe/src/pagination/ListMedicalScribeJobsPaginator.ts b/clients/client-transcribe/src/pagination/ListMedicalScribeJobsPaginator.ts index 039997048f59..77b1b094364f 100644 --- a/clients/client-transcribe/src/pagination/ListMedicalScribeJobsPaginator.ts +++ b/clients/client-transcribe/src/pagination/ListMedicalScribeJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TranscribeClient } from "../TranscribeClient"; import { TranscribePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TranscribeClient, - input: ListMedicalScribeJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMedicalScribeJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMedicalScribeJobs( +export const paginateListMedicalScribeJobs: ( config: TranscribePaginationConfiguration, input: ListMedicalScribeJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMedicalScribeJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TranscribeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transcribe | TranscribeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TranscribePaginationConfiguration, + ListMedicalScribeJobsCommandInput, + ListMedicalScribeJobsCommandOutput +>(TranscribeClient, ListMedicalScribeJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transcribe/src/pagination/ListMedicalTranscriptionJobsPaginator.ts b/clients/client-transcribe/src/pagination/ListMedicalTranscriptionJobsPaginator.ts index b2ad7083cb58..6ffebf538145 100644 --- a/clients/client-transcribe/src/pagination/ListMedicalTranscriptionJobsPaginator.ts +++ b/clients/client-transcribe/src/pagination/ListMedicalTranscriptionJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TranscribeClient } from "../TranscribeClient"; import { TranscribePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TranscribeClient, - input: ListMedicalTranscriptionJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMedicalTranscriptionJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMedicalTranscriptionJobs( +export const paginateListMedicalTranscriptionJobs: ( config: TranscribePaginationConfiguration, input: ListMedicalTranscriptionJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMedicalTranscriptionJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TranscribeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transcribe | TranscribeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TranscribePaginationConfiguration, + ListMedicalTranscriptionJobsCommandInput, + ListMedicalTranscriptionJobsCommandOutput +>(TranscribeClient, ListMedicalTranscriptionJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transcribe/src/pagination/ListMedicalVocabulariesPaginator.ts b/clients/client-transcribe/src/pagination/ListMedicalVocabulariesPaginator.ts index 2419b904edce..534299ab7961 100644 --- a/clients/client-transcribe/src/pagination/ListMedicalVocabulariesPaginator.ts +++ b/clients/client-transcribe/src/pagination/ListMedicalVocabulariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TranscribeClient } from "../TranscribeClient"; import { TranscribePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TranscribeClient, - input: ListMedicalVocabulariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMedicalVocabulariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMedicalVocabularies( +export const paginateListMedicalVocabularies: ( config: TranscribePaginationConfiguration, input: ListMedicalVocabulariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMedicalVocabulariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TranscribeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transcribe | TranscribeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TranscribePaginationConfiguration, + ListMedicalVocabulariesCommandInput, + ListMedicalVocabulariesCommandOutput +>(TranscribeClient, ListMedicalVocabulariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transcribe/src/pagination/ListTranscriptionJobsPaginator.ts b/clients/client-transcribe/src/pagination/ListTranscriptionJobsPaginator.ts index 81c95caa291e..c8936ac11148 100644 --- a/clients/client-transcribe/src/pagination/ListTranscriptionJobsPaginator.ts +++ b/clients/client-transcribe/src/pagination/ListTranscriptionJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TranscribeClient } from "../TranscribeClient"; import { TranscribePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TranscribeClient, - input: ListTranscriptionJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTranscriptionJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTranscriptionJobs( +export const paginateListTranscriptionJobs: ( config: TranscribePaginationConfiguration, input: ListTranscriptionJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTranscriptionJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TranscribeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transcribe | TranscribeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TranscribePaginationConfiguration, + ListTranscriptionJobsCommandInput, + ListTranscriptionJobsCommandOutput +>(TranscribeClient, ListTranscriptionJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transcribe/src/pagination/ListVocabulariesPaginator.ts b/clients/client-transcribe/src/pagination/ListVocabulariesPaginator.ts index b4c961017e35..32c4d7355fbc 100644 --- a/clients/client-transcribe/src/pagination/ListVocabulariesPaginator.ts +++ b/clients/client-transcribe/src/pagination/ListVocabulariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TranscribeClient } from "../TranscribeClient"; import { TranscribePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TranscribeClient, - input: ListVocabulariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVocabulariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVocabularies( +export const paginateListVocabularies: ( config: TranscribePaginationConfiguration, input: ListVocabulariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVocabulariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TranscribeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transcribe | TranscribeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TranscribePaginationConfiguration, + ListVocabulariesCommandInput, + ListVocabulariesCommandOutput +>(TranscribeClient, ListVocabulariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transcribe/src/pagination/ListVocabularyFiltersPaginator.ts b/clients/client-transcribe/src/pagination/ListVocabularyFiltersPaginator.ts index 61767b08abc1..322256783b05 100644 --- a/clients/client-transcribe/src/pagination/ListVocabularyFiltersPaginator.ts +++ b/clients/client-transcribe/src/pagination/ListVocabularyFiltersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TranscribeClient } from "../TranscribeClient"; import { TranscribePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TranscribeClient, - input: ListVocabularyFiltersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListVocabularyFiltersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListVocabularyFilters( +export const paginateListVocabularyFilters: ( config: TranscribePaginationConfiguration, input: ListVocabularyFiltersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListVocabularyFiltersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TranscribeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transcribe | TranscribeClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TranscribePaginationConfiguration, + ListVocabularyFiltersCommandInput, + ListVocabularyFiltersCommandOutput +>(TranscribeClient, ListVocabularyFiltersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transfer/package.json b/clients/client-transfer/package.json index 4cba5458d0f9..f50304e320ef 100644 --- a/clients/client-transfer/package.json +++ b/clients/client-transfer/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-transfer/src/pagination/ListAccessesPaginator.ts b/clients/client-transfer/src/pagination/ListAccessesPaginator.ts index 9973eb87345f..f5a6a1d9231f 100644 --- a/clients/client-transfer/src/pagination/ListAccessesPaginator.ts +++ b/clients/client-transfer/src/pagination/ListAccessesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TransferClient } from "../TransferClient"; import { TransferPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TransferClient, - input: ListAccessesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccesses( +export const paginateListAccesses: ( config: TransferPaginationConfiguration, input: ListAccessesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TransferClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transfer | TransferClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TransferPaginationConfiguration, + ListAccessesCommandInput, + ListAccessesCommandOutput +>(TransferClient, ListAccessesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transfer/src/pagination/ListAgreementsPaginator.ts b/clients/client-transfer/src/pagination/ListAgreementsPaginator.ts index 36b16eceeb5d..e140a38ed7eb 100644 --- a/clients/client-transfer/src/pagination/ListAgreementsPaginator.ts +++ b/clients/client-transfer/src/pagination/ListAgreementsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TransferClient } from "../TransferClient"; import { TransferPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TransferClient, - input: ListAgreementsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAgreementsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAgreements( +export const paginateListAgreements: ( config: TransferPaginationConfiguration, input: ListAgreementsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAgreementsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TransferClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transfer | TransferClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TransferPaginationConfiguration, + ListAgreementsCommandInput, + ListAgreementsCommandOutput +>(TransferClient, ListAgreementsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transfer/src/pagination/ListCertificatesPaginator.ts b/clients/client-transfer/src/pagination/ListCertificatesPaginator.ts index 93959789c545..12de840e679a 100644 --- a/clients/client-transfer/src/pagination/ListCertificatesPaginator.ts +++ b/clients/client-transfer/src/pagination/ListCertificatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TransferClient } from "../TransferClient"; import { TransferPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TransferClient, - input: ListCertificatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCertificatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCertificates( +export const paginateListCertificates: ( config: TransferPaginationConfiguration, input: ListCertificatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCertificatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TransferClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transfer | TransferClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TransferPaginationConfiguration, + ListCertificatesCommandInput, + ListCertificatesCommandOutput +>(TransferClient, ListCertificatesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transfer/src/pagination/ListConnectorsPaginator.ts b/clients/client-transfer/src/pagination/ListConnectorsPaginator.ts index df6b07ad02ac..2850eaf0e229 100644 --- a/clients/client-transfer/src/pagination/ListConnectorsPaginator.ts +++ b/clients/client-transfer/src/pagination/ListConnectorsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TransferClient } from "../TransferClient"; import { TransferPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TransferClient, - input: ListConnectorsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListConnectorsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListConnectors( +export const paginateListConnectors: ( config: TransferPaginationConfiguration, input: ListConnectorsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListConnectorsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TransferClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transfer | TransferClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TransferPaginationConfiguration, + ListConnectorsCommandInput, + ListConnectorsCommandOutput +>(TransferClient, ListConnectorsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transfer/src/pagination/ListExecutionsPaginator.ts b/clients/client-transfer/src/pagination/ListExecutionsPaginator.ts index e58402d127f2..85bbbfde6c84 100644 --- a/clients/client-transfer/src/pagination/ListExecutionsPaginator.ts +++ b/clients/client-transfer/src/pagination/ListExecutionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TransferClient } from "../TransferClient"; import { TransferPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TransferClient, - input: ListExecutionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListExecutionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListExecutions( +export const paginateListExecutions: ( config: TransferPaginationConfiguration, input: ListExecutionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListExecutionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TransferClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transfer | TransferClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TransferPaginationConfiguration, + ListExecutionsCommandInput, + ListExecutionsCommandOutput +>(TransferClient, ListExecutionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transfer/src/pagination/ListProfilesPaginator.ts b/clients/client-transfer/src/pagination/ListProfilesPaginator.ts index e0bb90aa1c8e..bcfeedcec5b2 100644 --- a/clients/client-transfer/src/pagination/ListProfilesPaginator.ts +++ b/clients/client-transfer/src/pagination/ListProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TransferClient } from "../TransferClient"; import { TransferPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TransferClient, - input: ListProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProfiles( +export const paginateListProfiles: ( config: TransferPaginationConfiguration, input: ListProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProfilesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TransferClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transfer | TransferClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TransferPaginationConfiguration, + ListProfilesCommandInput, + ListProfilesCommandOutput +>(TransferClient, ListProfilesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transfer/src/pagination/ListSecurityPoliciesPaginator.ts b/clients/client-transfer/src/pagination/ListSecurityPoliciesPaginator.ts index aa7eb435b44f..ad424ab1ec7a 100644 --- a/clients/client-transfer/src/pagination/ListSecurityPoliciesPaginator.ts +++ b/clients/client-transfer/src/pagination/ListSecurityPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TransferClient } from "../TransferClient"; import { TransferPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TransferClient, - input: ListSecurityPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSecurityPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSecurityPolicies( +export const paginateListSecurityPolicies: ( config: TransferPaginationConfiguration, input: ListSecurityPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSecurityPoliciesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TransferClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transfer | TransferClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TransferPaginationConfiguration, + ListSecurityPoliciesCommandInput, + ListSecurityPoliciesCommandOutput +>(TransferClient, ListSecurityPoliciesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transfer/src/pagination/ListServersPaginator.ts b/clients/client-transfer/src/pagination/ListServersPaginator.ts index 1741426ee00c..f2b41a14ddfd 100644 --- a/clients/client-transfer/src/pagination/ListServersPaginator.ts +++ b/clients/client-transfer/src/pagination/ListServersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListServersCommand, ListServersCommandInput, ListServersCommandOutput } from "../commands/ListServersCommand"; import { TransferClient } from "../TransferClient"; import { TransferPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TransferClient, - input: ListServersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServers( +export const paginateListServers: ( config: TransferPaginationConfiguration, input: ListServersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TransferClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transfer | TransferClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TransferPaginationConfiguration, + ListServersCommandInput, + ListServersCommandOutput +>(TransferClient, ListServersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transfer/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-transfer/src/pagination/ListTagsForResourcePaginator.ts index a7d50f95d83e..dcadaf22c939 100644 --- a/clients/client-transfer/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-transfer/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TransferClient } from "../TransferClient"; import { TransferPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TransferClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: TransferPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TransferClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transfer | TransferClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TransferPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(TransferClient, ListTagsForResourceCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transfer/src/pagination/ListUsersPaginator.ts b/clients/client-transfer/src/pagination/ListUsersPaginator.ts index a801ff445668..fa6febfab45b 100644 --- a/clients/client-transfer/src/pagination/ListUsersPaginator.ts +++ b/clients/client-transfer/src/pagination/ListUsersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListUsersCommand, ListUsersCommandInput, ListUsersCommandOutput } from "../commands/ListUsersCommand"; import { TransferClient } from "../TransferClient"; import { TransferPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TransferClient, - input: ListUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUsers( +export const paginateListUsers: ( config: TransferPaginationConfiguration, input: ListUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUsersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TransferClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transfer | TransferClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TransferPaginationConfiguration, + ListUsersCommandInput, + ListUsersCommandOutput +>(TransferClient, ListUsersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-transfer/src/pagination/ListWorkflowsPaginator.ts b/clients/client-transfer/src/pagination/ListWorkflowsPaginator.ts index 75f70236d05f..5d0860f8fcc9 100644 --- a/clients/client-transfer/src/pagination/ListWorkflowsPaginator.ts +++ b/clients/client-transfer/src/pagination/ListWorkflowsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TransferClient } from "../TransferClient"; import { TransferPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TransferClient, - input: ListWorkflowsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkflowsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkflows( +export const paginateListWorkflows: ( config: TransferPaginationConfiguration, input: ListWorkflowsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkflowsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TransferClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Transfer | TransferClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TransferPaginationConfiguration, + ListWorkflowsCommandInput, + ListWorkflowsCommandOutput +>(TransferClient, ListWorkflowsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-translate/package.json b/clients/client-translate/package.json index f4c5be2c2fd6..e079fdfa5d51 100644 --- a/clients/client-translate/package.json +++ b/clients/client-translate/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-translate/src/pagination/ListLanguagesPaginator.ts b/clients/client-translate/src/pagination/ListLanguagesPaginator.ts index f25e968632ef..b6acebc04e9f 100644 --- a/clients/client-translate/src/pagination/ListLanguagesPaginator.ts +++ b/clients/client-translate/src/pagination/ListLanguagesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TranslateClient } from "../TranslateClient"; import { TranslatePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TranslateClient, - input: ListLanguagesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLanguagesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLanguages( +export const paginateListLanguages: ( config: TranslatePaginationConfiguration, input: ListLanguagesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLanguagesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TranslateClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Translate | TranslateClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TranslatePaginationConfiguration, + ListLanguagesCommandInput, + ListLanguagesCommandOutput +>(TranslateClient, ListLanguagesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-translate/src/pagination/ListParallelDataPaginator.ts b/clients/client-translate/src/pagination/ListParallelDataPaginator.ts index ca34cd6f7944..c1826efdd1d4 100644 --- a/clients/client-translate/src/pagination/ListParallelDataPaginator.ts +++ b/clients/client-translate/src/pagination/ListParallelDataPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TranslateClient } from "../TranslateClient"; import { TranslatePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TranslateClient, - input: ListParallelDataCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListParallelDataCommand(input), ...args); -}; /** * @public */ -export async function* paginateListParallelData( +export const paginateListParallelData: ( config: TranslatePaginationConfiguration, input: ListParallelDataCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListParallelDataCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TranslateClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Translate | TranslateClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TranslatePaginationConfiguration, + ListParallelDataCommandInput, + ListParallelDataCommandOutput +>(TranslateClient, ListParallelDataCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-translate/src/pagination/ListTerminologiesPaginator.ts b/clients/client-translate/src/pagination/ListTerminologiesPaginator.ts index 3454800ee450..60a0bbfc3b67 100644 --- a/clients/client-translate/src/pagination/ListTerminologiesPaginator.ts +++ b/clients/client-translate/src/pagination/ListTerminologiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TranslateClient } from "../TranslateClient"; import { TranslatePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TranslateClient, - input: ListTerminologiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTerminologiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTerminologies( +export const paginateListTerminologies: ( config: TranslatePaginationConfiguration, input: ListTerminologiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTerminologiesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TranslateClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Translate | TranslateClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TranslatePaginationConfiguration, + ListTerminologiesCommandInput, + ListTerminologiesCommandOutput +>(TranslateClient, ListTerminologiesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-translate/src/pagination/ListTextTranslationJobsPaginator.ts b/clients/client-translate/src/pagination/ListTextTranslationJobsPaginator.ts index 291d0ef7335f..a7d89d1b4426 100644 --- a/clients/client-translate/src/pagination/ListTextTranslationJobsPaginator.ts +++ b/clients/client-translate/src/pagination/ListTextTranslationJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TranslateClient } from "../TranslateClient"; import { TranslatePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TranslateClient, - input: ListTextTranslationJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTextTranslationJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTextTranslationJobs( +export const paginateListTextTranslationJobs: ( config: TranslatePaginationConfiguration, input: ListTextTranslationJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTextTranslationJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof TranslateClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Translate | TranslateClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TranslatePaginationConfiguration, + ListTextTranslationJobsCommandInput, + ListTextTranslationJobsCommandOutput +>(TranslateClient, ListTextTranslationJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-trustedadvisor/src/pagination/ListChecksPaginator.ts b/clients/client-trustedadvisor/src/pagination/ListChecksPaginator.ts index 6143ca3e41bd..35a44a741286 100644 --- a/clients/client-trustedadvisor/src/pagination/ListChecksPaginator.ts +++ b/clients/client-trustedadvisor/src/pagination/ListChecksPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListChecksCommand, ListChecksCommandInput, ListChecksCommandOutput } from "../commands/ListChecksCommand"; import { TrustedAdvisorClient } from "../TrustedAdvisorClient"; import { TrustedAdvisorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TrustedAdvisorClient, - input: ListChecksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListChecksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListChecks( +export const paginateListChecks: ( config: TrustedAdvisorPaginationConfiguration, input: ListChecksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListChecksCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof TrustedAdvisorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected TrustedAdvisor | TrustedAdvisorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TrustedAdvisorPaginationConfiguration, + ListChecksCommandInput, + ListChecksCommandOutput +>(TrustedAdvisorClient, ListChecksCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-trustedadvisor/src/pagination/ListOrganizationRecommendationAccountsPaginator.ts b/clients/client-trustedadvisor/src/pagination/ListOrganizationRecommendationAccountsPaginator.ts index 10f7088a778f..3968c16056f9 100644 --- a/clients/client-trustedadvisor/src/pagination/ListOrganizationRecommendationAccountsPaginator.ts +++ b/clients/client-trustedadvisor/src/pagination/ListOrganizationRecommendationAccountsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TrustedAdvisorClient } from "../TrustedAdvisorClient"; import { TrustedAdvisorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TrustedAdvisorClient, - input: ListOrganizationRecommendationAccountsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOrganizationRecommendationAccountsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOrganizationRecommendationAccounts( +export const paginateListOrganizationRecommendationAccounts: ( config: TrustedAdvisorPaginationConfiguration, input: ListOrganizationRecommendationAccountsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOrganizationRecommendationAccountsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof TrustedAdvisorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected TrustedAdvisor | TrustedAdvisorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TrustedAdvisorPaginationConfiguration, + ListOrganizationRecommendationAccountsCommandInput, + ListOrganizationRecommendationAccountsCommandOutput +>(TrustedAdvisorClient, ListOrganizationRecommendationAccountsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-trustedadvisor/src/pagination/ListOrganizationRecommendationResourcesPaginator.ts b/clients/client-trustedadvisor/src/pagination/ListOrganizationRecommendationResourcesPaginator.ts index 6ce62bca4af3..ab63196f68e7 100644 --- a/clients/client-trustedadvisor/src/pagination/ListOrganizationRecommendationResourcesPaginator.ts +++ b/clients/client-trustedadvisor/src/pagination/ListOrganizationRecommendationResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TrustedAdvisorClient } from "../TrustedAdvisorClient"; import { TrustedAdvisorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TrustedAdvisorClient, - input: ListOrganizationRecommendationResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOrganizationRecommendationResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOrganizationRecommendationResources( +export const paginateListOrganizationRecommendationResources: ( config: TrustedAdvisorPaginationConfiguration, input: ListOrganizationRecommendationResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOrganizationRecommendationResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof TrustedAdvisorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected TrustedAdvisor | TrustedAdvisorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TrustedAdvisorPaginationConfiguration, + ListOrganizationRecommendationResourcesCommandInput, + ListOrganizationRecommendationResourcesCommandOutput +>(TrustedAdvisorClient, ListOrganizationRecommendationResourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-trustedadvisor/src/pagination/ListOrganizationRecommendationsPaginator.ts b/clients/client-trustedadvisor/src/pagination/ListOrganizationRecommendationsPaginator.ts index 5244835ba858..7356599c708d 100644 --- a/clients/client-trustedadvisor/src/pagination/ListOrganizationRecommendationsPaginator.ts +++ b/clients/client-trustedadvisor/src/pagination/ListOrganizationRecommendationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TrustedAdvisorClient } from "../TrustedAdvisorClient"; import { TrustedAdvisorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TrustedAdvisorClient, - input: ListOrganizationRecommendationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOrganizationRecommendationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOrganizationRecommendations( +export const paginateListOrganizationRecommendations: ( config: TrustedAdvisorPaginationConfiguration, input: ListOrganizationRecommendationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOrganizationRecommendationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof TrustedAdvisorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected TrustedAdvisor | TrustedAdvisorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TrustedAdvisorPaginationConfiguration, + ListOrganizationRecommendationsCommandInput, + ListOrganizationRecommendationsCommandOutput +>(TrustedAdvisorClient, ListOrganizationRecommendationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-trustedadvisor/src/pagination/ListRecommendationResourcesPaginator.ts b/clients/client-trustedadvisor/src/pagination/ListRecommendationResourcesPaginator.ts index ecbf47096b05..f60671bea9e2 100644 --- a/clients/client-trustedadvisor/src/pagination/ListRecommendationResourcesPaginator.ts +++ b/clients/client-trustedadvisor/src/pagination/ListRecommendationResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TrustedAdvisorClient } from "../TrustedAdvisorClient"; import { TrustedAdvisorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TrustedAdvisorClient, - input: ListRecommendationResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecommendationResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecommendationResources( +export const paginateListRecommendationResources: ( config: TrustedAdvisorPaginationConfiguration, input: ListRecommendationResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecommendationResourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof TrustedAdvisorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected TrustedAdvisor | TrustedAdvisorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TrustedAdvisorPaginationConfiguration, + ListRecommendationResourcesCommandInput, + ListRecommendationResourcesCommandOutput +>(TrustedAdvisorClient, ListRecommendationResourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-trustedadvisor/src/pagination/ListRecommendationsPaginator.ts b/clients/client-trustedadvisor/src/pagination/ListRecommendationsPaginator.ts index 522aa871c5f7..908b698c1564 100644 --- a/clients/client-trustedadvisor/src/pagination/ListRecommendationsPaginator.ts +++ b/clients/client-trustedadvisor/src/pagination/ListRecommendationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { TrustedAdvisorClient } from "../TrustedAdvisorClient"; import { TrustedAdvisorPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: TrustedAdvisorClient, - input: ListRecommendationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRecommendationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRecommendations( +export const paginateListRecommendations: ( config: TrustedAdvisorPaginationConfiguration, input: ListRecommendationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRecommendationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof TrustedAdvisorClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected TrustedAdvisor | TrustedAdvisorClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + TrustedAdvisorPaginationConfiguration, + ListRecommendationsCommandInput, + ListRecommendationsCommandOutput +>(TrustedAdvisorClient, ListRecommendationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-verifiedpermissions/package.json b/clients/client-verifiedpermissions/package.json index 9761e90608c3..cceb36c10ec6 100644 --- a/clients/client-verifiedpermissions/package.json +++ b/clients/client-verifiedpermissions/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-verifiedpermissions/src/pagination/ListIdentitySourcesPaginator.ts b/clients/client-verifiedpermissions/src/pagination/ListIdentitySourcesPaginator.ts index fa6e300d8bc4..741c96ec9018 100644 --- a/clients/client-verifiedpermissions/src/pagination/ListIdentitySourcesPaginator.ts +++ b/clients/client-verifiedpermissions/src/pagination/ListIdentitySourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VerifiedPermissionsClient } from "../VerifiedPermissionsClient"; import { VerifiedPermissionsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VerifiedPermissionsClient, - input: ListIdentitySourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIdentitySourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIdentitySources( +export const paginateListIdentitySources: ( config: VerifiedPermissionsPaginationConfiguration, input: ListIdentitySourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIdentitySourcesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof VerifiedPermissionsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VerifiedPermissions | VerifiedPermissionsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VerifiedPermissionsPaginationConfiguration, + ListIdentitySourcesCommandInput, + ListIdentitySourcesCommandOutput +>(VerifiedPermissionsClient, ListIdentitySourcesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-verifiedpermissions/src/pagination/ListPoliciesPaginator.ts b/clients/client-verifiedpermissions/src/pagination/ListPoliciesPaginator.ts index e8b9b2e9dfc3..4ff7aae45567 100644 --- a/clients/client-verifiedpermissions/src/pagination/ListPoliciesPaginator.ts +++ b/clients/client-verifiedpermissions/src/pagination/ListPoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VerifiedPermissionsClient } from "../VerifiedPermissionsClient"; import { VerifiedPermissionsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VerifiedPermissionsClient, - input: ListPoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPolicies( +export const paginateListPolicies: ( config: VerifiedPermissionsPaginationConfiguration, input: ListPoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPoliciesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof VerifiedPermissionsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VerifiedPermissions | VerifiedPermissionsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VerifiedPermissionsPaginationConfiguration, + ListPoliciesCommandInput, + ListPoliciesCommandOutput +>(VerifiedPermissionsClient, ListPoliciesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-verifiedpermissions/src/pagination/ListPolicyStoresPaginator.ts b/clients/client-verifiedpermissions/src/pagination/ListPolicyStoresPaginator.ts index 3a045f603d80..04c472a254ff 100644 --- a/clients/client-verifiedpermissions/src/pagination/ListPolicyStoresPaginator.ts +++ b/clients/client-verifiedpermissions/src/pagination/ListPolicyStoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VerifiedPermissionsClient } from "../VerifiedPermissionsClient"; import { VerifiedPermissionsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VerifiedPermissionsClient, - input: ListPolicyStoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPolicyStoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPolicyStores( +export const paginateListPolicyStores: ( config: VerifiedPermissionsPaginationConfiguration, input: ListPolicyStoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPolicyStoresCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof VerifiedPermissionsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VerifiedPermissions | VerifiedPermissionsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VerifiedPermissionsPaginationConfiguration, + ListPolicyStoresCommandInput, + ListPolicyStoresCommandOutput +>(VerifiedPermissionsClient, ListPolicyStoresCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-verifiedpermissions/src/pagination/ListPolicyTemplatesPaginator.ts b/clients/client-verifiedpermissions/src/pagination/ListPolicyTemplatesPaginator.ts index 33063270e93a..a2f2456d033c 100644 --- a/clients/client-verifiedpermissions/src/pagination/ListPolicyTemplatesPaginator.ts +++ b/clients/client-verifiedpermissions/src/pagination/ListPolicyTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VerifiedPermissionsClient } from "../VerifiedPermissionsClient"; import { VerifiedPermissionsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VerifiedPermissionsClient, - input: ListPolicyTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPolicyTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPolicyTemplates( +export const paginateListPolicyTemplates: ( config: VerifiedPermissionsPaginationConfiguration, input: ListPolicyTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPolicyTemplatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof VerifiedPermissionsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VerifiedPermissions | VerifiedPermissionsClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VerifiedPermissionsPaginationConfiguration, + ListPolicyTemplatesCommandInput, + ListPolicyTemplatesCommandOutput +>(VerifiedPermissionsClient, ListPolicyTemplatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-voice-id/package.json b/clients/client-voice-id/package.json index 58b401b55cc8..9b745822638a 100644 --- a/clients/client-voice-id/package.json +++ b/clients/client-voice-id/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-voice-id/src/pagination/ListDomainsPaginator.ts b/clients/client-voice-id/src/pagination/ListDomainsPaginator.ts index b370d31b5e51..e3823f760d38 100644 --- a/clients/client-voice-id/src/pagination/ListDomainsPaginator.ts +++ b/clients/client-voice-id/src/pagination/ListDomainsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListDomainsCommand, ListDomainsCommandInput, ListDomainsCommandOutput } from "../commands/ListDomainsCommand"; import { VoiceIDClient } from "../VoiceIDClient"; import { VoiceIDPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VoiceIDClient, - input: ListDomainsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomains( +export const paginateListDomains: ( config: VoiceIDPaginationConfiguration, input: ListDomainsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof VoiceIDClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VoiceID | VoiceIDClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VoiceIDPaginationConfiguration, + ListDomainsCommandInput, + ListDomainsCommandOutput +>(VoiceIDClient, ListDomainsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-voice-id/src/pagination/ListFraudsterRegistrationJobsPaginator.ts b/clients/client-voice-id/src/pagination/ListFraudsterRegistrationJobsPaginator.ts index de6d0d085857..7082220f04ba 100644 --- a/clients/client-voice-id/src/pagination/ListFraudsterRegistrationJobsPaginator.ts +++ b/clients/client-voice-id/src/pagination/ListFraudsterRegistrationJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VoiceIDClient } from "../VoiceIDClient"; import { VoiceIDPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VoiceIDClient, - input: ListFraudsterRegistrationJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFraudsterRegistrationJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFraudsterRegistrationJobs( +export const paginateListFraudsterRegistrationJobs: ( config: VoiceIDPaginationConfiguration, input: ListFraudsterRegistrationJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFraudsterRegistrationJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof VoiceIDClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VoiceID | VoiceIDClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VoiceIDPaginationConfiguration, + ListFraudsterRegistrationJobsCommandInput, + ListFraudsterRegistrationJobsCommandOutput +>(VoiceIDClient, ListFraudsterRegistrationJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-voice-id/src/pagination/ListFraudstersPaginator.ts b/clients/client-voice-id/src/pagination/ListFraudstersPaginator.ts index 6bf0090d78bd..4133830e0098 100644 --- a/clients/client-voice-id/src/pagination/ListFraudstersPaginator.ts +++ b/clients/client-voice-id/src/pagination/ListFraudstersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VoiceIDClient } from "../VoiceIDClient"; import { VoiceIDPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VoiceIDClient, - input: ListFraudstersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFraudstersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFraudsters( +export const paginateListFraudsters: ( config: VoiceIDPaginationConfiguration, input: ListFraudstersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFraudstersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof VoiceIDClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VoiceID | VoiceIDClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VoiceIDPaginationConfiguration, + ListFraudstersCommandInput, + ListFraudstersCommandOutput +>(VoiceIDClient, ListFraudstersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-voice-id/src/pagination/ListSpeakerEnrollmentJobsPaginator.ts b/clients/client-voice-id/src/pagination/ListSpeakerEnrollmentJobsPaginator.ts index 202d7e0ba4ec..1df08b063349 100644 --- a/clients/client-voice-id/src/pagination/ListSpeakerEnrollmentJobsPaginator.ts +++ b/clients/client-voice-id/src/pagination/ListSpeakerEnrollmentJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VoiceIDClient } from "../VoiceIDClient"; import { VoiceIDPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VoiceIDClient, - input: ListSpeakerEnrollmentJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSpeakerEnrollmentJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSpeakerEnrollmentJobs( +export const paginateListSpeakerEnrollmentJobs: ( config: VoiceIDPaginationConfiguration, input: ListSpeakerEnrollmentJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSpeakerEnrollmentJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof VoiceIDClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VoiceID | VoiceIDClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VoiceIDPaginationConfiguration, + ListSpeakerEnrollmentJobsCommandInput, + ListSpeakerEnrollmentJobsCommandOutput +>(VoiceIDClient, ListSpeakerEnrollmentJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-voice-id/src/pagination/ListSpeakersPaginator.ts b/clients/client-voice-id/src/pagination/ListSpeakersPaginator.ts index ef84fca3c130..a23bc61fc6c3 100644 --- a/clients/client-voice-id/src/pagination/ListSpeakersPaginator.ts +++ b/clients/client-voice-id/src/pagination/ListSpeakersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VoiceIDClient } from "../VoiceIDClient"; import { VoiceIDPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VoiceIDClient, - input: ListSpeakersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSpeakersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSpeakers( +export const paginateListSpeakers: ( config: VoiceIDPaginationConfiguration, input: ListSpeakersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSpeakersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof VoiceIDClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VoiceID | VoiceIDClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VoiceIDPaginationConfiguration, + ListSpeakersCommandInput, + ListSpeakersCommandOutput +>(VoiceIDClient, ListSpeakersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-voice-id/src/pagination/ListWatchlistsPaginator.ts b/clients/client-voice-id/src/pagination/ListWatchlistsPaginator.ts index 32c642da452b..526f9e64ed3b 100644 --- a/clients/client-voice-id/src/pagination/ListWatchlistsPaginator.ts +++ b/clients/client-voice-id/src/pagination/ListWatchlistsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VoiceIDClient } from "../VoiceIDClient"; import { VoiceIDPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VoiceIDClient, - input: ListWatchlistsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWatchlistsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWatchlists( +export const paginateListWatchlists: ( config: VoiceIDPaginationConfiguration, input: ListWatchlistsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWatchlistsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof VoiceIDClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VoiceID | VoiceIDClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VoiceIDPaginationConfiguration, + ListWatchlistsCommandInput, + ListWatchlistsCommandOutput +>(VoiceIDClient, ListWatchlistsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-vpc-lattice/src/pagination/ListAccessLogSubscriptionsPaginator.ts b/clients/client-vpc-lattice/src/pagination/ListAccessLogSubscriptionsPaginator.ts index 8796897d1937..6cecb36280ba 100644 --- a/clients/client-vpc-lattice/src/pagination/ListAccessLogSubscriptionsPaginator.ts +++ b/clients/client-vpc-lattice/src/pagination/ListAccessLogSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VPCLatticeClient } from "../VPCLatticeClient"; import { VPCLatticePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VPCLatticeClient, - input: ListAccessLogSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAccessLogSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAccessLogSubscriptions( +export const paginateListAccessLogSubscriptions: ( config: VPCLatticePaginationConfiguration, input: ListAccessLogSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAccessLogSubscriptionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof VPCLatticeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VPCLattice | VPCLatticeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VPCLatticePaginationConfiguration, + ListAccessLogSubscriptionsCommandInput, + ListAccessLogSubscriptionsCommandOutput +>(VPCLatticeClient, ListAccessLogSubscriptionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-vpc-lattice/src/pagination/ListListenersPaginator.ts b/clients/client-vpc-lattice/src/pagination/ListListenersPaginator.ts index a696246c686f..491f7cf691e0 100644 --- a/clients/client-vpc-lattice/src/pagination/ListListenersPaginator.ts +++ b/clients/client-vpc-lattice/src/pagination/ListListenersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VPCLatticeClient } from "../VPCLatticeClient"; import { VPCLatticePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VPCLatticeClient, - input: ListListenersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListListenersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListListeners( +export const paginateListListeners: ( config: VPCLatticePaginationConfiguration, input: ListListenersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListListenersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof VPCLatticeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VPCLattice | VPCLatticeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VPCLatticePaginationConfiguration, + ListListenersCommandInput, + ListListenersCommandOutput +>(VPCLatticeClient, ListListenersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-vpc-lattice/src/pagination/ListRulesPaginator.ts b/clients/client-vpc-lattice/src/pagination/ListRulesPaginator.ts index 2e2c4dc23d54..309821a69200 100644 --- a/clients/client-vpc-lattice/src/pagination/ListRulesPaginator.ts +++ b/clients/client-vpc-lattice/src/pagination/ListRulesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListRulesCommand, ListRulesCommandInput, ListRulesCommandOutput } from "../commands/ListRulesCommand"; import { VPCLatticeClient } from "../VPCLatticeClient"; import { VPCLatticePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VPCLatticeClient, - input: ListRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListRules( +export const paginateListRules: ( config: VPCLatticePaginationConfiguration, input: ListRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListRulesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof VPCLatticeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VPCLattice | VPCLatticeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VPCLatticePaginationConfiguration, + ListRulesCommandInput, + ListRulesCommandOutput +>(VPCLatticeClient, ListRulesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-vpc-lattice/src/pagination/ListServiceNetworkServiceAssociationsPaginator.ts b/clients/client-vpc-lattice/src/pagination/ListServiceNetworkServiceAssociationsPaginator.ts index e4dc1e404216..f114767c7986 100644 --- a/clients/client-vpc-lattice/src/pagination/ListServiceNetworkServiceAssociationsPaginator.ts +++ b/clients/client-vpc-lattice/src/pagination/ListServiceNetworkServiceAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VPCLatticeClient } from "../VPCLatticeClient"; import { VPCLatticePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VPCLatticeClient, - input: ListServiceNetworkServiceAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServiceNetworkServiceAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServiceNetworkServiceAssociations( +export const paginateListServiceNetworkServiceAssociations: ( config: VPCLatticePaginationConfiguration, input: ListServiceNetworkServiceAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServiceNetworkServiceAssociationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof VPCLatticeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VPCLattice | VPCLatticeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VPCLatticePaginationConfiguration, + ListServiceNetworkServiceAssociationsCommandInput, + ListServiceNetworkServiceAssociationsCommandOutput +>(VPCLatticeClient, ListServiceNetworkServiceAssociationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-vpc-lattice/src/pagination/ListServiceNetworkVpcAssociationsPaginator.ts b/clients/client-vpc-lattice/src/pagination/ListServiceNetworkVpcAssociationsPaginator.ts index f860eff6cda7..98ac5caba08f 100644 --- a/clients/client-vpc-lattice/src/pagination/ListServiceNetworkVpcAssociationsPaginator.ts +++ b/clients/client-vpc-lattice/src/pagination/ListServiceNetworkVpcAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VPCLatticeClient } from "../VPCLatticeClient"; import { VPCLatticePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VPCLatticeClient, - input: ListServiceNetworkVpcAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServiceNetworkVpcAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServiceNetworkVpcAssociations( +export const paginateListServiceNetworkVpcAssociations: ( config: VPCLatticePaginationConfiguration, input: ListServiceNetworkVpcAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServiceNetworkVpcAssociationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof VPCLatticeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VPCLattice | VPCLatticeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VPCLatticePaginationConfiguration, + ListServiceNetworkVpcAssociationsCommandInput, + ListServiceNetworkVpcAssociationsCommandOutput +>(VPCLatticeClient, ListServiceNetworkVpcAssociationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-vpc-lattice/src/pagination/ListServiceNetworksPaginator.ts b/clients/client-vpc-lattice/src/pagination/ListServiceNetworksPaginator.ts index 0bb53b4c4c9b..7847a87f8787 100644 --- a/clients/client-vpc-lattice/src/pagination/ListServiceNetworksPaginator.ts +++ b/clients/client-vpc-lattice/src/pagination/ListServiceNetworksPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VPCLatticeClient } from "../VPCLatticeClient"; import { VPCLatticePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VPCLatticeClient, - input: ListServiceNetworksCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServiceNetworksCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServiceNetworks( +export const paginateListServiceNetworks: ( config: VPCLatticePaginationConfiguration, input: ListServiceNetworksCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServiceNetworksCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof VPCLatticeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VPCLattice | VPCLatticeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VPCLatticePaginationConfiguration, + ListServiceNetworksCommandInput, + ListServiceNetworksCommandOutput +>(VPCLatticeClient, ListServiceNetworksCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-vpc-lattice/src/pagination/ListServicesPaginator.ts b/clients/client-vpc-lattice/src/pagination/ListServicesPaginator.ts index 0d46e1f3c7fc..35504994907d 100644 --- a/clients/client-vpc-lattice/src/pagination/ListServicesPaginator.ts +++ b/clients/client-vpc-lattice/src/pagination/ListServicesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VPCLatticeClient } from "../VPCLatticeClient"; import { VPCLatticePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VPCLatticeClient, - input: ListServicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListServicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListServices( +export const paginateListServices: ( config: VPCLatticePaginationConfiguration, input: ListServicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListServicesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof VPCLatticeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VPCLattice | VPCLatticeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VPCLatticePaginationConfiguration, + ListServicesCommandInput, + ListServicesCommandOutput +>(VPCLatticeClient, ListServicesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-vpc-lattice/src/pagination/ListTargetGroupsPaginator.ts b/clients/client-vpc-lattice/src/pagination/ListTargetGroupsPaginator.ts index b65d855c6fa0..02a6ad865dd9 100644 --- a/clients/client-vpc-lattice/src/pagination/ListTargetGroupsPaginator.ts +++ b/clients/client-vpc-lattice/src/pagination/ListTargetGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { VPCLatticeClient } from "../VPCLatticeClient"; import { VPCLatticePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VPCLatticeClient, - input: ListTargetGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTargetGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTargetGroups( +export const paginateListTargetGroups: ( config: VPCLatticePaginationConfiguration, input: ListTargetGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTargetGroupsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof VPCLatticeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VPCLattice | VPCLatticeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VPCLatticePaginationConfiguration, + ListTargetGroupsCommandInput, + ListTargetGroupsCommandOutput +>(VPCLatticeClient, ListTargetGroupsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-vpc-lattice/src/pagination/ListTargetsPaginator.ts b/clients/client-vpc-lattice/src/pagination/ListTargetsPaginator.ts index 4ef7d60f557f..4a79a46d390a 100644 --- a/clients/client-vpc-lattice/src/pagination/ListTargetsPaginator.ts +++ b/clients/client-vpc-lattice/src/pagination/ListTargetsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListTargetsCommand, ListTargetsCommandInput, ListTargetsCommandOutput } from "../commands/ListTargetsCommand"; import { VPCLatticeClient } from "../VPCLatticeClient"; import { VPCLatticePaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: VPCLatticeClient, - input: ListTargetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTargetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTargets( +export const paginateListTargets: ( config: VPCLatticePaginationConfiguration, input: ListTargetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTargetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof VPCLatticeClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected VPCLattice | VPCLatticeClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + VPCLatticePaginationConfiguration, + ListTargetsCommandInput, + ListTargetsCommandOutput +>(VPCLatticeClient, ListTargetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-wellarchitected/src/pagination/GetConsolidatedReportPaginator.ts b/clients/client-wellarchitected/src/pagination/GetConsolidatedReportPaginator.ts index 6fbe4421e489..c3ae16b22400 100644 --- a/clients/client-wellarchitected/src/pagination/GetConsolidatedReportPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/GetConsolidatedReportPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: GetConsolidatedReportCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetConsolidatedReportCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetConsolidatedReport( +export const paginateGetConsolidatedReport: ( config: WellArchitectedPaginationConfiguration, input: GetConsolidatedReportCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetConsolidatedReportCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + GetConsolidatedReportCommandInput, + GetConsolidatedReportCommandOutput +>(WellArchitectedClient, GetConsolidatedReportCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListAnswersPaginator.ts b/clients/client-wellarchitected/src/pagination/ListAnswersPaginator.ts index 53462260bd91..3cac73ad9c8f 100644 --- a/clients/client-wellarchitected/src/pagination/ListAnswersPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListAnswersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAnswersCommand, ListAnswersCommandInput, ListAnswersCommandOutput } from "../commands/ListAnswersCommand"; import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListAnswersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAnswersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAnswers( +export const paginateListAnswers: ( config: WellArchitectedPaginationConfiguration, input: ListAnswersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAnswersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListAnswersCommandInput, + ListAnswersCommandOutput +>(WellArchitectedClient, ListAnswersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListCheckDetailsPaginator.ts b/clients/client-wellarchitected/src/pagination/ListCheckDetailsPaginator.ts index 3426a82122f2..e0535ab5c74b 100644 --- a/clients/client-wellarchitected/src/pagination/ListCheckDetailsPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListCheckDetailsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListCheckDetailsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCheckDetailsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCheckDetails( +export const paginateListCheckDetails: ( config: WellArchitectedPaginationConfiguration, input: ListCheckDetailsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCheckDetailsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListCheckDetailsCommandInput, + ListCheckDetailsCommandOutput +>(WellArchitectedClient, ListCheckDetailsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListCheckSummariesPaginator.ts b/clients/client-wellarchitected/src/pagination/ListCheckSummariesPaginator.ts index 57039d60b269..65ff484296ce 100644 --- a/clients/client-wellarchitected/src/pagination/ListCheckSummariesPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListCheckSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListCheckSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListCheckSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListCheckSummaries( +export const paginateListCheckSummaries: ( config: WellArchitectedPaginationConfiguration, input: ListCheckSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListCheckSummariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListCheckSummariesCommandInput, + ListCheckSummariesCommandOutput +>(WellArchitectedClient, ListCheckSummariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListLensReviewImprovementsPaginator.ts b/clients/client-wellarchitected/src/pagination/ListLensReviewImprovementsPaginator.ts index ba457a2e4d42..ed130a0b9280 100644 --- a/clients/client-wellarchitected/src/pagination/ListLensReviewImprovementsPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListLensReviewImprovementsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListLensReviewImprovementsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLensReviewImprovementsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLensReviewImprovements( +export const paginateListLensReviewImprovements: ( config: WellArchitectedPaginationConfiguration, input: ListLensReviewImprovementsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLensReviewImprovementsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListLensReviewImprovementsCommandInput, + ListLensReviewImprovementsCommandOutput +>(WellArchitectedClient, ListLensReviewImprovementsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListLensReviewsPaginator.ts b/clients/client-wellarchitected/src/pagination/ListLensReviewsPaginator.ts index d26ed200f84e..6a0efd63b8e4 100644 --- a/clients/client-wellarchitected/src/pagination/ListLensReviewsPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListLensReviewsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListLensReviewsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLensReviewsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLensReviews( +export const paginateListLensReviews: ( config: WellArchitectedPaginationConfiguration, input: ListLensReviewsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLensReviewsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListLensReviewsCommandInput, + ListLensReviewsCommandOutput +>(WellArchitectedClient, ListLensReviewsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListLensSharesPaginator.ts b/clients/client-wellarchitected/src/pagination/ListLensSharesPaginator.ts index 5ec39962f557..fdfc1766552b 100644 --- a/clients/client-wellarchitected/src/pagination/ListLensSharesPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListLensSharesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListLensSharesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLensSharesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLensShares( +export const paginateListLensShares: ( config: WellArchitectedPaginationConfiguration, input: ListLensSharesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLensSharesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListLensSharesCommandInput, + ListLensSharesCommandOutput +>(WellArchitectedClient, ListLensSharesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListLensesPaginator.ts b/clients/client-wellarchitected/src/pagination/ListLensesPaginator.ts index 05abf41cd60b..24d0d0951026 100644 --- a/clients/client-wellarchitected/src/pagination/ListLensesPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListLensesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListLensesCommand, ListLensesCommandInput, ListLensesCommandOutput } from "../commands/ListLensesCommand"; import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListLensesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListLensesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListLenses( +export const paginateListLenses: ( config: WellArchitectedPaginationConfiguration, input: ListLensesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListLensesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListLensesCommandInput, + ListLensesCommandOutput +>(WellArchitectedClient, ListLensesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListMilestonesPaginator.ts b/clients/client-wellarchitected/src/pagination/ListMilestonesPaginator.ts index 83dd8fa4fa87..52b5832d84d4 100644 --- a/clients/client-wellarchitected/src/pagination/ListMilestonesPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListMilestonesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListMilestonesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMilestonesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMilestones( +export const paginateListMilestones: ( config: WellArchitectedPaginationConfiguration, input: ListMilestonesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMilestonesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListMilestonesCommandInput, + ListMilestonesCommandOutput +>(WellArchitectedClient, ListMilestonesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListNotificationsPaginator.ts b/clients/client-wellarchitected/src/pagination/ListNotificationsPaginator.ts index e3d17bc20f45..c54c99a640d6 100644 --- a/clients/client-wellarchitected/src/pagination/ListNotificationsPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListNotificationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListNotificationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNotificationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNotifications( +export const paginateListNotifications: ( config: WellArchitectedPaginationConfiguration, input: ListNotificationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNotificationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListNotificationsCommandInput, + ListNotificationsCommandOutput +>(WellArchitectedClient, ListNotificationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListProfileNotificationsPaginator.ts b/clients/client-wellarchitected/src/pagination/ListProfileNotificationsPaginator.ts index 844fbfb20bf2..2423a173c81a 100644 --- a/clients/client-wellarchitected/src/pagination/ListProfileNotificationsPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListProfileNotificationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListProfileNotificationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProfileNotificationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProfileNotifications( +export const paginateListProfileNotifications: ( config: WellArchitectedPaginationConfiguration, input: ListProfileNotificationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProfileNotificationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListProfileNotificationsCommandInput, + ListProfileNotificationsCommandOutput +>(WellArchitectedClient, ListProfileNotificationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListProfileSharesPaginator.ts b/clients/client-wellarchitected/src/pagination/ListProfileSharesPaginator.ts index 16297ed87469..1eaae5a315dc 100644 --- a/clients/client-wellarchitected/src/pagination/ListProfileSharesPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListProfileSharesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListProfileSharesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProfileSharesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProfileShares( +export const paginateListProfileShares: ( config: WellArchitectedPaginationConfiguration, input: ListProfileSharesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProfileSharesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListProfileSharesCommandInput, + ListProfileSharesCommandOutput +>(WellArchitectedClient, ListProfileSharesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListProfilesPaginator.ts b/clients/client-wellarchitected/src/pagination/ListProfilesPaginator.ts index c5cfd3f06e58..ac4405998dc5 100644 --- a/clients/client-wellarchitected/src/pagination/ListProfilesPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListProfilesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListProfilesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListProfilesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListProfiles( +export const paginateListProfiles: ( config: WellArchitectedPaginationConfiguration, input: ListProfilesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListProfilesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListProfilesCommandInput, + ListProfilesCommandOutput +>(WellArchitectedClient, ListProfilesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListReviewTemplateAnswersPaginator.ts b/clients/client-wellarchitected/src/pagination/ListReviewTemplateAnswersPaginator.ts index 575456c39613..9c56d1eb48c8 100644 --- a/clients/client-wellarchitected/src/pagination/ListReviewTemplateAnswersPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListReviewTemplateAnswersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListReviewTemplateAnswersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReviewTemplateAnswersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReviewTemplateAnswers( +export const paginateListReviewTemplateAnswers: ( config: WellArchitectedPaginationConfiguration, input: ListReviewTemplateAnswersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReviewTemplateAnswersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListReviewTemplateAnswersCommandInput, + ListReviewTemplateAnswersCommandOutput +>(WellArchitectedClient, ListReviewTemplateAnswersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListReviewTemplatesPaginator.ts b/clients/client-wellarchitected/src/pagination/ListReviewTemplatesPaginator.ts index 7183ccf57c03..1dd324c46d6d 100644 --- a/clients/client-wellarchitected/src/pagination/ListReviewTemplatesPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListReviewTemplatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListReviewTemplatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListReviewTemplatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListReviewTemplates( +export const paginateListReviewTemplates: ( config: WellArchitectedPaginationConfiguration, input: ListReviewTemplatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListReviewTemplatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListReviewTemplatesCommandInput, + ListReviewTemplatesCommandOutput +>(WellArchitectedClient, ListReviewTemplatesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListShareInvitationsPaginator.ts b/clients/client-wellarchitected/src/pagination/ListShareInvitationsPaginator.ts index 77a6343658ef..72de9a67d5a2 100644 --- a/clients/client-wellarchitected/src/pagination/ListShareInvitationsPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListShareInvitationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListShareInvitationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListShareInvitationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListShareInvitations( +export const paginateListShareInvitations: ( config: WellArchitectedPaginationConfiguration, input: ListShareInvitationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListShareInvitationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListShareInvitationsCommandInput, + ListShareInvitationsCommandOutput +>(WellArchitectedClient, ListShareInvitationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListTemplateSharesPaginator.ts b/clients/client-wellarchitected/src/pagination/ListTemplateSharesPaginator.ts index 960341d4a178..2132bd0351a7 100644 --- a/clients/client-wellarchitected/src/pagination/ListTemplateSharesPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListTemplateSharesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListTemplateSharesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTemplateSharesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTemplateShares( +export const paginateListTemplateShares: ( config: WellArchitectedPaginationConfiguration, input: ListTemplateSharesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTemplateSharesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListTemplateSharesCommandInput, + ListTemplateSharesCommandOutput +>(WellArchitectedClient, ListTemplateSharesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListWorkloadSharesPaginator.ts b/clients/client-wellarchitected/src/pagination/ListWorkloadSharesPaginator.ts index ac3c3d77f6b2..e1e49cb5542d 100644 --- a/clients/client-wellarchitected/src/pagination/ListWorkloadSharesPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListWorkloadSharesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListWorkloadSharesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkloadSharesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkloadShares( +export const paginateListWorkloadShares: ( config: WellArchitectedPaginationConfiguration, input: ListWorkloadSharesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkloadSharesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListWorkloadSharesCommandInput, + ListWorkloadSharesCommandOutput +>(WellArchitectedClient, ListWorkloadSharesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wellarchitected/src/pagination/ListWorkloadsPaginator.ts b/clients/client-wellarchitected/src/pagination/ListWorkloadsPaginator.ts index c40cf8b5d08c..7580c40bddae 100644 --- a/clients/client-wellarchitected/src/pagination/ListWorkloadsPaginator.ts +++ b/clients/client-wellarchitected/src/pagination/ListWorkloadsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WellArchitectedClient } from "../WellArchitectedClient"; import { WellArchitectedPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WellArchitectedClient, - input: ListWorkloadsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWorkloadsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWorkloads( +export const paginateListWorkloads: ( config: WellArchitectedPaginationConfiguration, input: ListWorkloadsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWorkloadsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WellArchitectedClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WellArchitected | WellArchitectedClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WellArchitectedPaginationConfiguration, + ListWorkloadsCommandInput, + ListWorkloadsCommandOutput +>(WellArchitectedClient, ListWorkloadsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-wisdom/src/pagination/ListAssistantAssociationsPaginator.ts b/clients/client-wisdom/src/pagination/ListAssistantAssociationsPaginator.ts index 16ef19a23ff0..1f5d5e0c622a 100644 --- a/clients/client-wisdom/src/pagination/ListAssistantAssociationsPaginator.ts +++ b/clients/client-wisdom/src/pagination/ListAssistantAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WisdomClient } from "../WisdomClient"; import { WisdomPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WisdomClient, - input: ListAssistantAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssistantAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssistantAssociations( +export const paginateListAssistantAssociations: ( config: WisdomPaginationConfiguration, input: ListAssistantAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssistantAssociationsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WisdomClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Wisdom | WisdomClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WisdomPaginationConfiguration, + ListAssistantAssociationsCommandInput, + ListAssistantAssociationsCommandOutput +>(WisdomClient, ListAssistantAssociationsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-wisdom/src/pagination/ListAssistantsPaginator.ts b/clients/client-wisdom/src/pagination/ListAssistantsPaginator.ts index 142e4bf2293c..50bf8737c857 100644 --- a/clients/client-wisdom/src/pagination/ListAssistantsPaginator.ts +++ b/clients/client-wisdom/src/pagination/ListAssistantsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WisdomClient } from "../WisdomClient"; import { WisdomPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WisdomClient, - input: ListAssistantsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAssistantsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAssistants( +export const paginateListAssistants: ( config: WisdomPaginationConfiguration, input: ListAssistantsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAssistantsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WisdomClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Wisdom | WisdomClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WisdomPaginationConfiguration, + ListAssistantsCommandInput, + ListAssistantsCommandOutput +>(WisdomClient, ListAssistantsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-wisdom/src/pagination/ListContentsPaginator.ts b/clients/client-wisdom/src/pagination/ListContentsPaginator.ts index 9a628414ebf7..5dac69d9b8ea 100644 --- a/clients/client-wisdom/src/pagination/ListContentsPaginator.ts +++ b/clients/client-wisdom/src/pagination/ListContentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WisdomClient } from "../WisdomClient"; import { WisdomPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WisdomClient, - input: ListContentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListContentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListContents( +export const paginateListContents: ( config: WisdomPaginationConfiguration, input: ListContentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListContentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WisdomClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Wisdom | WisdomClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WisdomPaginationConfiguration, + ListContentsCommandInput, + ListContentsCommandOutput +>(WisdomClient, ListContentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-wisdom/src/pagination/ListImportJobsPaginator.ts b/clients/client-wisdom/src/pagination/ListImportJobsPaginator.ts index 2a156ae7d82b..c30c3e84211b 100644 --- a/clients/client-wisdom/src/pagination/ListImportJobsPaginator.ts +++ b/clients/client-wisdom/src/pagination/ListImportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WisdomClient } from "../WisdomClient"; import { WisdomPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WisdomClient, - input: ListImportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImportJobs( +export const paginateListImportJobs: ( config: WisdomPaginationConfiguration, input: ListImportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImportJobsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WisdomClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Wisdom | WisdomClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WisdomPaginationConfiguration, + ListImportJobsCommandInput, + ListImportJobsCommandOutput +>(WisdomClient, ListImportJobsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-wisdom/src/pagination/ListKnowledgeBasesPaginator.ts b/clients/client-wisdom/src/pagination/ListKnowledgeBasesPaginator.ts index 7fb408acf8e8..6537a18ad5b6 100644 --- a/clients/client-wisdom/src/pagination/ListKnowledgeBasesPaginator.ts +++ b/clients/client-wisdom/src/pagination/ListKnowledgeBasesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WisdomClient } from "../WisdomClient"; import { WisdomPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WisdomClient, - input: ListKnowledgeBasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListKnowledgeBasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListKnowledgeBases( +export const paginateListKnowledgeBases: ( config: WisdomPaginationConfiguration, input: ListKnowledgeBasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListKnowledgeBasesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WisdomClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Wisdom | WisdomClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WisdomPaginationConfiguration, + ListKnowledgeBasesCommandInput, + ListKnowledgeBasesCommandOutput +>(WisdomClient, ListKnowledgeBasesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-wisdom/src/pagination/ListQuickResponsesPaginator.ts b/clients/client-wisdom/src/pagination/ListQuickResponsesPaginator.ts index 0469072c9fa0..dc31a7009cd5 100644 --- a/clients/client-wisdom/src/pagination/ListQuickResponsesPaginator.ts +++ b/clients/client-wisdom/src/pagination/ListQuickResponsesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WisdomClient } from "../WisdomClient"; import { WisdomPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WisdomClient, - input: ListQuickResponsesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListQuickResponsesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListQuickResponses( +export const paginateListQuickResponses: ( config: WisdomPaginationConfiguration, input: ListQuickResponsesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListQuickResponsesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WisdomClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Wisdom | WisdomClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WisdomPaginationConfiguration, + ListQuickResponsesCommandInput, + ListQuickResponsesCommandOutput +>(WisdomClient, ListQuickResponsesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-wisdom/src/pagination/QueryAssistantPaginator.ts b/clients/client-wisdom/src/pagination/QueryAssistantPaginator.ts index f8b57d4ca3d0..0fa6157b9c5c 100644 --- a/clients/client-wisdom/src/pagination/QueryAssistantPaginator.ts +++ b/clients/client-wisdom/src/pagination/QueryAssistantPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WisdomClient } from "../WisdomClient"; import { WisdomPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WisdomClient, - input: QueryAssistantCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new QueryAssistantCommand(input), ...args); -}; /** * @public */ -export async function* paginateQueryAssistant( +export const paginateQueryAssistant: ( config: WisdomPaginationConfiguration, input: QueryAssistantCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: QueryAssistantCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WisdomClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Wisdom | WisdomClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WisdomPaginationConfiguration, + QueryAssistantCommandInput, + QueryAssistantCommandOutput +>(WisdomClient, QueryAssistantCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-wisdom/src/pagination/SearchContentPaginator.ts b/clients/client-wisdom/src/pagination/SearchContentPaginator.ts index 6535a669416c..df3b6761277b 100644 --- a/clients/client-wisdom/src/pagination/SearchContentPaginator.ts +++ b/clients/client-wisdom/src/pagination/SearchContentPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WisdomClient } from "../WisdomClient"; import { WisdomPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WisdomClient, - input: SearchContentCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchContentCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchContent( +export const paginateSearchContent: ( config: WisdomPaginationConfiguration, input: SearchContentCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchContentCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WisdomClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Wisdom | WisdomClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WisdomPaginationConfiguration, + SearchContentCommandInput, + SearchContentCommandOutput +>(WisdomClient, SearchContentCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-wisdom/src/pagination/SearchQuickResponsesPaginator.ts b/clients/client-wisdom/src/pagination/SearchQuickResponsesPaginator.ts index 0c4d1198ee72..e8b059616270 100644 --- a/clients/client-wisdom/src/pagination/SearchQuickResponsesPaginator.ts +++ b/clients/client-wisdom/src/pagination/SearchQuickResponsesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WisdomClient } from "../WisdomClient"; import { WisdomPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WisdomClient, - input: SearchQuickResponsesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchQuickResponsesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchQuickResponses( +export const paginateSearchQuickResponses: ( config: WisdomPaginationConfiguration, input: SearchQuickResponsesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchQuickResponsesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WisdomClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Wisdom | WisdomClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WisdomPaginationConfiguration, + SearchQuickResponsesCommandInput, + SearchQuickResponsesCommandOutput +>(WisdomClient, SearchQuickResponsesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-wisdom/src/pagination/SearchSessionsPaginator.ts b/clients/client-wisdom/src/pagination/SearchSessionsPaginator.ts index 64323f42ee0a..027ffd54a315 100644 --- a/clients/client-wisdom/src/pagination/SearchSessionsPaginator.ts +++ b/clients/client-wisdom/src/pagination/SearchSessionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WisdomClient } from "../WisdomClient"; import { WisdomPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WisdomClient, - input: SearchSessionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchSessionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchSessions( +export const paginateSearchSessions: ( config: WisdomPaginationConfiguration, input: SearchSessionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchSessionsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WisdomClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected Wisdom | WisdomClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WisdomPaginationConfiguration, + SearchSessionsCommandInput, + SearchSessionsCommandOutput +>(WisdomClient, SearchSessionsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-workdocs/src/pagination/DescribeActivitiesPaginator.ts b/clients/client-workdocs/src/pagination/DescribeActivitiesPaginator.ts index fce84f6772be..5aaf0261f047 100644 --- a/clients/client-workdocs/src/pagination/DescribeActivitiesPaginator.ts +++ b/clients/client-workdocs/src/pagination/DescribeActivitiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkDocsClient } from "../WorkDocsClient"; import { WorkDocsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkDocsClient, - input: DescribeActivitiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeActivitiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeActivities( +export const paginateDescribeActivities: ( config: WorkDocsPaginationConfiguration, input: DescribeActivitiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeActivitiesCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof WorkDocsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkDocs | WorkDocsClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkDocsPaginationConfiguration, + DescribeActivitiesCommandInput, + DescribeActivitiesCommandOutput +>(WorkDocsClient, DescribeActivitiesCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-workdocs/src/pagination/DescribeCommentsPaginator.ts b/clients/client-workdocs/src/pagination/DescribeCommentsPaginator.ts index cb2f0f612b1e..d6398463d3d3 100644 --- a/clients/client-workdocs/src/pagination/DescribeCommentsPaginator.ts +++ b/clients/client-workdocs/src/pagination/DescribeCommentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkDocsClient } from "../WorkDocsClient"; import { WorkDocsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkDocsClient, - input: DescribeCommentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeCommentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeComments( +export const paginateDescribeComments: ( config: WorkDocsPaginationConfiguration, input: DescribeCommentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeCommentsCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof WorkDocsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkDocs | WorkDocsClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkDocsPaginationConfiguration, + DescribeCommentsCommandInput, + DescribeCommentsCommandOutput +>(WorkDocsClient, DescribeCommentsCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-workdocs/src/pagination/DescribeDocumentVersionsPaginator.ts b/clients/client-workdocs/src/pagination/DescribeDocumentVersionsPaginator.ts index b76122b815fd..065f7bec45b6 100644 --- a/clients/client-workdocs/src/pagination/DescribeDocumentVersionsPaginator.ts +++ b/clients/client-workdocs/src/pagination/DescribeDocumentVersionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkDocsClient } from "../WorkDocsClient"; import { WorkDocsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkDocsClient, - input: DescribeDocumentVersionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeDocumentVersionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeDocumentVersions( +export const paginateDescribeDocumentVersions: ( config: WorkDocsPaginationConfiguration, input: DescribeDocumentVersionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeDocumentVersionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof WorkDocsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkDocs | WorkDocsClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkDocsPaginationConfiguration, + DescribeDocumentVersionsCommandInput, + DescribeDocumentVersionsCommandOutput +>(WorkDocsClient, DescribeDocumentVersionsCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-workdocs/src/pagination/DescribeFolderContentsPaginator.ts b/clients/client-workdocs/src/pagination/DescribeFolderContentsPaginator.ts index 3d402cf27832..e11da94b31af 100644 --- a/clients/client-workdocs/src/pagination/DescribeFolderContentsPaginator.ts +++ b/clients/client-workdocs/src/pagination/DescribeFolderContentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkDocsClient } from "../WorkDocsClient"; import { WorkDocsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkDocsClient, - input: DescribeFolderContentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeFolderContentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeFolderContents( +export const paginateDescribeFolderContents: ( config: WorkDocsPaginationConfiguration, input: DescribeFolderContentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeFolderContentsCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof WorkDocsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkDocs | WorkDocsClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkDocsPaginationConfiguration, + DescribeFolderContentsCommandInput, + DescribeFolderContentsCommandOutput +>(WorkDocsClient, DescribeFolderContentsCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-workdocs/src/pagination/DescribeGroupsPaginator.ts b/clients/client-workdocs/src/pagination/DescribeGroupsPaginator.ts index 855bff63f088..25b67abe5423 100644 --- a/clients/client-workdocs/src/pagination/DescribeGroupsPaginator.ts +++ b/clients/client-workdocs/src/pagination/DescribeGroupsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkDocsClient } from "../WorkDocsClient"; import { WorkDocsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkDocsClient, - input: DescribeGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeGroups( +export const paginateDescribeGroups: ( config: WorkDocsPaginationConfiguration, input: DescribeGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeGroupsCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof WorkDocsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkDocs | WorkDocsClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkDocsPaginationConfiguration, + DescribeGroupsCommandInput, + DescribeGroupsCommandOutput +>(WorkDocsClient, DescribeGroupsCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-workdocs/src/pagination/DescribeNotificationSubscriptionsPaginator.ts b/clients/client-workdocs/src/pagination/DescribeNotificationSubscriptionsPaginator.ts index 8e693936e89a..8442c9ef9c5a 100644 --- a/clients/client-workdocs/src/pagination/DescribeNotificationSubscriptionsPaginator.ts +++ b/clients/client-workdocs/src/pagination/DescribeNotificationSubscriptionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkDocsClient } from "../WorkDocsClient"; import { WorkDocsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkDocsClient, - input: DescribeNotificationSubscriptionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeNotificationSubscriptionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeNotificationSubscriptions( +export const paginateDescribeNotificationSubscriptions: ( config: WorkDocsPaginationConfiguration, input: DescribeNotificationSubscriptionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeNotificationSubscriptionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof WorkDocsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkDocs | WorkDocsClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkDocsPaginationConfiguration, + DescribeNotificationSubscriptionsCommandInput, + DescribeNotificationSubscriptionsCommandOutput +>(WorkDocsClient, DescribeNotificationSubscriptionsCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-workdocs/src/pagination/DescribeResourcePermissionsPaginator.ts b/clients/client-workdocs/src/pagination/DescribeResourcePermissionsPaginator.ts index 0604392a090d..e4b74736b915 100644 --- a/clients/client-workdocs/src/pagination/DescribeResourcePermissionsPaginator.ts +++ b/clients/client-workdocs/src/pagination/DescribeResourcePermissionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkDocsClient } from "../WorkDocsClient"; import { WorkDocsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkDocsClient, - input: DescribeResourcePermissionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeResourcePermissionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeResourcePermissions( +export const paginateDescribeResourcePermissions: ( config: WorkDocsPaginationConfiguration, input: DescribeResourcePermissionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeResourcePermissionsCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof WorkDocsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkDocs | WorkDocsClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkDocsPaginationConfiguration, + DescribeResourcePermissionsCommandInput, + DescribeResourcePermissionsCommandOutput +>(WorkDocsClient, DescribeResourcePermissionsCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-workdocs/src/pagination/DescribeRootFoldersPaginator.ts b/clients/client-workdocs/src/pagination/DescribeRootFoldersPaginator.ts index b44ee4fb6770..88ce97f3b0e2 100644 --- a/clients/client-workdocs/src/pagination/DescribeRootFoldersPaginator.ts +++ b/clients/client-workdocs/src/pagination/DescribeRootFoldersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkDocsClient } from "../WorkDocsClient"; import { WorkDocsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkDocsClient, - input: DescribeRootFoldersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeRootFoldersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeRootFolders( +export const paginateDescribeRootFolders: ( config: WorkDocsPaginationConfiguration, input: DescribeRootFoldersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeRootFoldersCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof WorkDocsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkDocs | WorkDocsClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkDocsPaginationConfiguration, + DescribeRootFoldersCommandInput, + DescribeRootFoldersCommandOutput +>(WorkDocsClient, DescribeRootFoldersCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-workdocs/src/pagination/DescribeUsersPaginator.ts b/clients/client-workdocs/src/pagination/DescribeUsersPaginator.ts index edabbd1c9178..45afe11a5d51 100644 --- a/clients/client-workdocs/src/pagination/DescribeUsersPaginator.ts +++ b/clients/client-workdocs/src/pagination/DescribeUsersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkDocsClient } from "../WorkDocsClient"; import { WorkDocsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkDocsClient, - input: DescribeUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeUsers( +export const paginateDescribeUsers: ( config: WorkDocsPaginationConfiguration, input: DescribeUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeUsersCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof WorkDocsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkDocs | WorkDocsClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkDocsPaginationConfiguration, + DescribeUsersCommandInput, + DescribeUsersCommandOutput +>(WorkDocsClient, DescribeUsersCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-workdocs/src/pagination/SearchResourcesPaginator.ts b/clients/client-workdocs/src/pagination/SearchResourcesPaginator.ts index b5777d4003fd..ceb8156a208b 100644 --- a/clients/client-workdocs/src/pagination/SearchResourcesPaginator.ts +++ b/clients/client-workdocs/src/pagination/SearchResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkDocsClient } from "../WorkDocsClient"; import { WorkDocsPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkDocsClient, - input: SearchResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new SearchResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateSearchResources( +export const paginateSearchResources: ( config: WorkDocsPaginationConfiguration, input: SearchResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.Marker - let token: typeof input.Marker | undefined = config.startingToken || undefined; - let hasNext = true; - let page: SearchResourcesCommandOutput; - while (hasNext) { - input.Marker = token; - input["Limit"] = config.pageSize; - if (config.client instanceof WorkDocsClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkDocs | WorkDocsClient"); - } - yield page; - const prevToken = token; - token = page.Marker; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkDocsPaginationConfiguration, + SearchResourcesCommandInput, + SearchResourcesCommandOutput +>(WorkDocsClient, SearchResourcesCommand, "Marker", "Marker", "Limit"); diff --git a/clients/client-worklink/src/pagination/ListDevicesPaginator.ts b/clients/client-worklink/src/pagination/ListDevicesPaginator.ts index cd15f18db7ce..677be9581f9e 100644 --- a/clients/client-worklink/src/pagination/ListDevicesPaginator.ts +++ b/clients/client-worklink/src/pagination/ListDevicesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListDevicesCommand, ListDevicesCommandInput, ListDevicesCommandOutput } from "../commands/ListDevicesCommand"; import { WorkLinkClient } from "../WorkLinkClient"; import { WorkLinkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkLinkClient, - input: ListDevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDevices( +export const paginateListDevices: ( config: WorkLinkPaginationConfiguration, input: ListDevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDevicesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkLinkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkLink | WorkLinkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkLinkPaginationConfiguration, + ListDevicesCommandInput, + ListDevicesCommandOutput +>(WorkLinkClient, ListDevicesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-worklink/src/pagination/ListDomainsPaginator.ts b/clients/client-worklink/src/pagination/ListDomainsPaginator.ts index da8e2ae21489..33463eef8f64 100644 --- a/clients/client-worklink/src/pagination/ListDomainsPaginator.ts +++ b/clients/client-worklink/src/pagination/ListDomainsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListDomainsCommand, ListDomainsCommandInput, ListDomainsCommandOutput } from "../commands/ListDomainsCommand"; import { WorkLinkClient } from "../WorkLinkClient"; import { WorkLinkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkLinkClient, - input: ListDomainsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDomainsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDomains( +export const paginateListDomains: ( config: WorkLinkPaginationConfiguration, input: ListDomainsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDomainsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkLinkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkLink | WorkLinkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkLinkPaginationConfiguration, + ListDomainsCommandInput, + ListDomainsCommandOutput +>(WorkLinkClient, ListDomainsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-worklink/src/pagination/ListFleetsPaginator.ts b/clients/client-worklink/src/pagination/ListFleetsPaginator.ts index 016350d7bce2..ae3c55ee1547 100644 --- a/clients/client-worklink/src/pagination/ListFleetsPaginator.ts +++ b/clients/client-worklink/src/pagination/ListFleetsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListFleetsCommand, ListFleetsCommandInput, ListFleetsCommandOutput } from "../commands/ListFleetsCommand"; import { WorkLinkClient } from "../WorkLinkClient"; import { WorkLinkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkLinkClient, - input: ListFleetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListFleetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListFleets( +export const paginateListFleets: ( config: WorkLinkPaginationConfiguration, input: ListFleetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListFleetsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkLinkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkLink | WorkLinkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkLinkPaginationConfiguration, + ListFleetsCommandInput, + ListFleetsCommandOutput +>(WorkLinkClient, ListFleetsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-worklink/src/pagination/ListWebsiteAuthorizationProvidersPaginator.ts b/clients/client-worklink/src/pagination/ListWebsiteAuthorizationProvidersPaginator.ts index c3d379388a5d..ce71c4e85758 100644 --- a/clients/client-worklink/src/pagination/ListWebsiteAuthorizationProvidersPaginator.ts +++ b/clients/client-worklink/src/pagination/ListWebsiteAuthorizationProvidersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkLinkClient } from "../WorkLinkClient"; import { WorkLinkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkLinkClient, - input: ListWebsiteAuthorizationProvidersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWebsiteAuthorizationProvidersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWebsiteAuthorizationProviders( +export const paginateListWebsiteAuthorizationProviders: ( config: WorkLinkPaginationConfiguration, input: ListWebsiteAuthorizationProvidersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWebsiteAuthorizationProvidersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkLinkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkLink | WorkLinkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkLinkPaginationConfiguration, + ListWebsiteAuthorizationProvidersCommandInput, + ListWebsiteAuthorizationProvidersCommandOutput +>(WorkLinkClient, ListWebsiteAuthorizationProvidersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-worklink/src/pagination/ListWebsiteCertificateAuthoritiesPaginator.ts b/clients/client-worklink/src/pagination/ListWebsiteCertificateAuthoritiesPaginator.ts index 4d0d7dcb24d7..66e7d5d2bf40 100644 --- a/clients/client-worklink/src/pagination/ListWebsiteCertificateAuthoritiesPaginator.ts +++ b/clients/client-worklink/src/pagination/ListWebsiteCertificateAuthoritiesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkLinkClient } from "../WorkLinkClient"; import { WorkLinkPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkLinkClient, - input: ListWebsiteCertificateAuthoritiesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListWebsiteCertificateAuthoritiesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListWebsiteCertificateAuthorities( +export const paginateListWebsiteCertificateAuthorities: ( config: WorkLinkPaginationConfiguration, input: ListWebsiteCertificateAuthoritiesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListWebsiteCertificateAuthoritiesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkLinkClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkLink | WorkLinkClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkLinkPaginationConfiguration, + ListWebsiteCertificateAuthoritiesCommandInput, + ListWebsiteCertificateAuthoritiesCommandOutput +>(WorkLinkClient, ListWebsiteCertificateAuthoritiesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workmail/package.json b/clients/client-workmail/package.json index e1186a4b3f34..5f509e7bcb46 100644 --- a/clients/client-workmail/package.json +++ b/clients/client-workmail/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-workmail/src/pagination/ListAliasesPaginator.ts b/clients/client-workmail/src/pagination/ListAliasesPaginator.ts index 936053bc7f61..00f273884286 100644 --- a/clients/client-workmail/src/pagination/ListAliasesPaginator.ts +++ b/clients/client-workmail/src/pagination/ListAliasesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListAliasesCommand, ListAliasesCommandInput, ListAliasesCommandOutput } from "../commands/ListAliasesCommand"; import { WorkMailClient } from "../WorkMailClient"; import { WorkMailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkMailClient, - input: ListAliasesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAliasesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAliases( +export const paginateListAliases: ( config: WorkMailPaginationConfiguration, input: ListAliasesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAliasesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkMailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkMail | WorkMailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkMailPaginationConfiguration, + ListAliasesCommandInput, + ListAliasesCommandOutput +>(WorkMailClient, ListAliasesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workmail/src/pagination/ListAvailabilityConfigurationsPaginator.ts b/clients/client-workmail/src/pagination/ListAvailabilityConfigurationsPaginator.ts index 496d14e0d59a..e5fea88f7ae3 100644 --- a/clients/client-workmail/src/pagination/ListAvailabilityConfigurationsPaginator.ts +++ b/clients/client-workmail/src/pagination/ListAvailabilityConfigurationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkMailClient } from "../WorkMailClient"; import { WorkMailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkMailClient, - input: ListAvailabilityConfigurationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListAvailabilityConfigurationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListAvailabilityConfigurations( +export const paginateListAvailabilityConfigurations: ( config: WorkMailPaginationConfiguration, input: ListAvailabilityConfigurationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListAvailabilityConfigurationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkMailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkMail | WorkMailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkMailPaginationConfiguration, + ListAvailabilityConfigurationsCommandInput, + ListAvailabilityConfigurationsCommandOutput +>(WorkMailClient, ListAvailabilityConfigurationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workmail/src/pagination/ListGroupMembersPaginator.ts b/clients/client-workmail/src/pagination/ListGroupMembersPaginator.ts index b33333d93705..d282ac4a4e4f 100644 --- a/clients/client-workmail/src/pagination/ListGroupMembersPaginator.ts +++ b/clients/client-workmail/src/pagination/ListGroupMembersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkMailClient } from "../WorkMailClient"; import { WorkMailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkMailClient, - input: ListGroupMembersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupMembersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroupMembers( +export const paginateListGroupMembers: ( config: WorkMailPaginationConfiguration, input: ListGroupMembersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupMembersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkMailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkMail | WorkMailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkMailPaginationConfiguration, + ListGroupMembersCommandInput, + ListGroupMembersCommandOutput +>(WorkMailClient, ListGroupMembersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workmail/src/pagination/ListGroupsForEntityPaginator.ts b/clients/client-workmail/src/pagination/ListGroupsForEntityPaginator.ts index 73263042559c..b385684cc71c 100644 --- a/clients/client-workmail/src/pagination/ListGroupsForEntityPaginator.ts +++ b/clients/client-workmail/src/pagination/ListGroupsForEntityPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkMailClient } from "../WorkMailClient"; import { WorkMailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkMailClient, - input: ListGroupsForEntityCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupsForEntityCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroupsForEntity( +export const paginateListGroupsForEntity: ( config: WorkMailPaginationConfiguration, input: ListGroupsForEntityCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupsForEntityCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkMailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkMail | WorkMailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkMailPaginationConfiguration, + ListGroupsForEntityCommandInput, + ListGroupsForEntityCommandOutput +>(WorkMailClient, ListGroupsForEntityCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workmail/src/pagination/ListGroupsPaginator.ts b/clients/client-workmail/src/pagination/ListGroupsPaginator.ts index 014b3dc644ae..d7570a65daf5 100644 --- a/clients/client-workmail/src/pagination/ListGroupsPaginator.ts +++ b/clients/client-workmail/src/pagination/ListGroupsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListGroupsCommand, ListGroupsCommandInput, ListGroupsCommandOutput } from "../commands/ListGroupsCommand"; import { WorkMailClient } from "../WorkMailClient"; import { WorkMailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkMailClient, - input: ListGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListGroups( +export const paginateListGroups: ( config: WorkMailPaginationConfiguration, input: ListGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkMailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkMail | WorkMailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkMailPaginationConfiguration, + ListGroupsCommandInput, + ListGroupsCommandOutput +>(WorkMailClient, ListGroupsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workmail/src/pagination/ListImpersonationRolesPaginator.ts b/clients/client-workmail/src/pagination/ListImpersonationRolesPaginator.ts index 243f9596c838..b733b9103664 100644 --- a/clients/client-workmail/src/pagination/ListImpersonationRolesPaginator.ts +++ b/clients/client-workmail/src/pagination/ListImpersonationRolesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkMailClient } from "../WorkMailClient"; import { WorkMailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkMailClient, - input: ListImpersonationRolesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListImpersonationRolesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListImpersonationRoles( +export const paginateListImpersonationRoles: ( config: WorkMailPaginationConfiguration, input: ListImpersonationRolesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListImpersonationRolesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkMailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkMail | WorkMailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkMailPaginationConfiguration, + ListImpersonationRolesCommandInput, + ListImpersonationRolesCommandOutput +>(WorkMailClient, ListImpersonationRolesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workmail/src/pagination/ListMailDomainsPaginator.ts b/clients/client-workmail/src/pagination/ListMailDomainsPaginator.ts index 08065abe2fac..4d97c2ffb9de 100644 --- a/clients/client-workmail/src/pagination/ListMailDomainsPaginator.ts +++ b/clients/client-workmail/src/pagination/ListMailDomainsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkMailClient } from "../WorkMailClient"; import { WorkMailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkMailClient, - input: ListMailDomainsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMailDomainsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMailDomains( +export const paginateListMailDomains: ( config: WorkMailPaginationConfiguration, input: ListMailDomainsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMailDomainsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkMailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkMail | WorkMailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkMailPaginationConfiguration, + ListMailDomainsCommandInput, + ListMailDomainsCommandOutput +>(WorkMailClient, ListMailDomainsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workmail/src/pagination/ListMailboxExportJobsPaginator.ts b/clients/client-workmail/src/pagination/ListMailboxExportJobsPaginator.ts index 07f3682bca02..43748cb99a19 100644 --- a/clients/client-workmail/src/pagination/ListMailboxExportJobsPaginator.ts +++ b/clients/client-workmail/src/pagination/ListMailboxExportJobsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkMailClient } from "../WorkMailClient"; import { WorkMailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkMailClient, - input: ListMailboxExportJobsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMailboxExportJobsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMailboxExportJobs( +export const paginateListMailboxExportJobs: ( config: WorkMailPaginationConfiguration, input: ListMailboxExportJobsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMailboxExportJobsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkMailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkMail | WorkMailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkMailPaginationConfiguration, + ListMailboxExportJobsCommandInput, + ListMailboxExportJobsCommandOutput +>(WorkMailClient, ListMailboxExportJobsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workmail/src/pagination/ListMailboxPermissionsPaginator.ts b/clients/client-workmail/src/pagination/ListMailboxPermissionsPaginator.ts index 1eb0fff13ed2..6c60a2182765 100644 --- a/clients/client-workmail/src/pagination/ListMailboxPermissionsPaginator.ts +++ b/clients/client-workmail/src/pagination/ListMailboxPermissionsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkMailClient } from "../WorkMailClient"; import { WorkMailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkMailClient, - input: ListMailboxPermissionsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMailboxPermissionsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMailboxPermissions( +export const paginateListMailboxPermissions: ( config: WorkMailPaginationConfiguration, input: ListMailboxPermissionsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMailboxPermissionsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkMailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkMail | WorkMailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkMailPaginationConfiguration, + ListMailboxPermissionsCommandInput, + ListMailboxPermissionsCommandOutput +>(WorkMailClient, ListMailboxPermissionsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workmail/src/pagination/ListMobileDeviceAccessOverridesPaginator.ts b/clients/client-workmail/src/pagination/ListMobileDeviceAccessOverridesPaginator.ts index 830f0de87a5c..4453fdb559ca 100644 --- a/clients/client-workmail/src/pagination/ListMobileDeviceAccessOverridesPaginator.ts +++ b/clients/client-workmail/src/pagination/ListMobileDeviceAccessOverridesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkMailClient } from "../WorkMailClient"; import { WorkMailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkMailClient, - input: ListMobileDeviceAccessOverridesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListMobileDeviceAccessOverridesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListMobileDeviceAccessOverrides( +export const paginateListMobileDeviceAccessOverrides: ( config: WorkMailPaginationConfiguration, input: ListMobileDeviceAccessOverridesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListMobileDeviceAccessOverridesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkMailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkMail | WorkMailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkMailPaginationConfiguration, + ListMobileDeviceAccessOverridesCommandInput, + ListMobileDeviceAccessOverridesCommandOutput +>(WorkMailClient, ListMobileDeviceAccessOverridesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workmail/src/pagination/ListOrganizationsPaginator.ts b/clients/client-workmail/src/pagination/ListOrganizationsPaginator.ts index 8021bb3f1685..e20120cdac69 100644 --- a/clients/client-workmail/src/pagination/ListOrganizationsPaginator.ts +++ b/clients/client-workmail/src/pagination/ListOrganizationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkMailClient } from "../WorkMailClient"; import { WorkMailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkMailClient, - input: ListOrganizationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListOrganizationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListOrganizations( +export const paginateListOrganizations: ( config: WorkMailPaginationConfiguration, input: ListOrganizationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListOrganizationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkMailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkMail | WorkMailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkMailPaginationConfiguration, + ListOrganizationsCommandInput, + ListOrganizationsCommandOutput +>(WorkMailClient, ListOrganizationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workmail/src/pagination/ListResourceDelegatesPaginator.ts b/clients/client-workmail/src/pagination/ListResourceDelegatesPaginator.ts index 5a7a2964324f..75a2ae367684 100644 --- a/clients/client-workmail/src/pagination/ListResourceDelegatesPaginator.ts +++ b/clients/client-workmail/src/pagination/ListResourceDelegatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkMailClient } from "../WorkMailClient"; import { WorkMailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkMailClient, - input: ListResourceDelegatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourceDelegatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourceDelegates( +export const paginateListResourceDelegates: ( config: WorkMailPaginationConfiguration, input: ListResourceDelegatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourceDelegatesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkMailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkMail | WorkMailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkMailPaginationConfiguration, + ListResourceDelegatesCommandInput, + ListResourceDelegatesCommandOutput +>(WorkMailClient, ListResourceDelegatesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workmail/src/pagination/ListResourcesPaginator.ts b/clients/client-workmail/src/pagination/ListResourcesPaginator.ts index 2eb63e7a0ddd..9bd0fa7fcbfe 100644 --- a/clients/client-workmail/src/pagination/ListResourcesPaginator.ts +++ b/clients/client-workmail/src/pagination/ListResourcesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkMailClient } from "../WorkMailClient"; import { WorkMailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkMailClient, - input: ListResourcesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourcesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResources( +export const paginateListResources: ( config: WorkMailPaginationConfiguration, input: ListResourcesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourcesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkMailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkMail | WorkMailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkMailPaginationConfiguration, + ListResourcesCommandInput, + ListResourcesCommandOutput +>(WorkMailClient, ListResourcesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workmail/src/pagination/ListUsersPaginator.ts b/clients/client-workmail/src/pagination/ListUsersPaginator.ts index 3dae2077254e..89e0e6d9fb01 100644 --- a/clients/client-workmail/src/pagination/ListUsersPaginator.ts +++ b/clients/client-workmail/src/pagination/ListUsersPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListUsersCommand, ListUsersCommandInput, ListUsersCommandOutput } from "../commands/ListUsersCommand"; import { WorkMailClient } from "../WorkMailClient"; import { WorkMailPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkMailClient, - input: ListUsersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUsersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUsers( +export const paginateListUsers: ( config: WorkMailPaginationConfiguration, input: ListUsersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUsersCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkMailClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkMail | WorkMailClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkMailPaginationConfiguration, + ListUsersCommandInput, + ListUsersCommandOutput +>(WorkMailClient, ListUsersCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workspaces-thin-client/src/pagination/ListDevicesPaginator.ts b/clients/client-workspaces-thin-client/src/pagination/ListDevicesPaginator.ts index 249f9557267f..c107ee85e763 100644 --- a/clients/client-workspaces-thin-client/src/pagination/ListDevicesPaginator.ts +++ b/clients/client-workspaces-thin-client/src/pagination/ListDevicesPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListDevicesCommand, ListDevicesCommandInput, ListDevicesCommandOutput } from "../commands/ListDevicesCommand"; import { WorkSpacesThinClientClient } from "../WorkSpacesThinClientClient"; import { WorkSpacesThinClientPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesThinClientClient, - input: ListDevicesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListDevicesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListDevices( +export const paginateListDevices: ( config: WorkSpacesThinClientPaginationConfiguration, input: ListDevicesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListDevicesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WorkSpacesThinClientClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpacesThinClient | WorkSpacesThinClientClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesThinClientPaginationConfiguration, + ListDevicesCommandInput, + ListDevicesCommandOutput +>(WorkSpacesThinClientClient, ListDevicesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-workspaces-thin-client/src/pagination/ListEnvironmentsPaginator.ts b/clients/client-workspaces-thin-client/src/pagination/ListEnvironmentsPaginator.ts index f70f8a05d043..b44d10427a69 100644 --- a/clients/client-workspaces-thin-client/src/pagination/ListEnvironmentsPaginator.ts +++ b/clients/client-workspaces-thin-client/src/pagination/ListEnvironmentsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkSpacesThinClientClient } from "../WorkSpacesThinClientClient"; import { WorkSpacesThinClientPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesThinClientClient, - input: ListEnvironmentsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListEnvironmentsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListEnvironments( +export const paginateListEnvironments: ( config: WorkSpacesThinClientPaginationConfiguration, input: ListEnvironmentsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListEnvironmentsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WorkSpacesThinClientClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpacesThinClient | WorkSpacesThinClientClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesThinClientPaginationConfiguration, + ListEnvironmentsCommandInput, + ListEnvironmentsCommandOutput +>(WorkSpacesThinClientClient, ListEnvironmentsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-workspaces-thin-client/src/pagination/ListSoftwareSetsPaginator.ts b/clients/client-workspaces-thin-client/src/pagination/ListSoftwareSetsPaginator.ts index d811d5357360..4e83b5aefda0 100644 --- a/clients/client-workspaces-thin-client/src/pagination/ListSoftwareSetsPaginator.ts +++ b/clients/client-workspaces-thin-client/src/pagination/ListSoftwareSetsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkSpacesThinClientClient } from "../WorkSpacesThinClientClient"; import { WorkSpacesThinClientPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesThinClientClient, - input: ListSoftwareSetsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListSoftwareSetsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListSoftwareSets( +export const paginateListSoftwareSets: ( config: WorkSpacesThinClientPaginationConfiguration, input: ListSoftwareSetsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListSoftwareSetsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WorkSpacesThinClientClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpacesThinClient | WorkSpacesThinClientClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesThinClientPaginationConfiguration, + ListSoftwareSetsCommandInput, + ListSoftwareSetsCommandOutput +>(WorkSpacesThinClientClient, ListSoftwareSetsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-workspaces-web/src/pagination/ListBrowserSettingsPaginator.ts b/clients/client-workspaces-web/src/pagination/ListBrowserSettingsPaginator.ts index 97627b655e2d..01fc9dfc1cbf 100644 --- a/clients/client-workspaces-web/src/pagination/ListBrowserSettingsPaginator.ts +++ b/clients/client-workspaces-web/src/pagination/ListBrowserSettingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkSpacesWebClient } from "../WorkSpacesWebClient"; import { WorkSpacesWebPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesWebClient, - input: ListBrowserSettingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListBrowserSettingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListBrowserSettings( +export const paginateListBrowserSettings: ( config: WorkSpacesWebPaginationConfiguration, input: ListBrowserSettingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListBrowserSettingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WorkSpacesWebClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpacesWeb | WorkSpacesWebClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesWebPaginationConfiguration, + ListBrowserSettingsCommandInput, + ListBrowserSettingsCommandOutput +>(WorkSpacesWebClient, ListBrowserSettingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-workspaces-web/src/pagination/ListIdentityProvidersPaginator.ts b/clients/client-workspaces-web/src/pagination/ListIdentityProvidersPaginator.ts index bde3bf7e16a1..a35a495e849f 100644 --- a/clients/client-workspaces-web/src/pagination/ListIdentityProvidersPaginator.ts +++ b/clients/client-workspaces-web/src/pagination/ListIdentityProvidersPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkSpacesWebClient } from "../WorkSpacesWebClient"; import { WorkSpacesWebPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesWebClient, - input: ListIdentityProvidersCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIdentityProvidersCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIdentityProviders( +export const paginateListIdentityProviders: ( config: WorkSpacesWebPaginationConfiguration, input: ListIdentityProvidersCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIdentityProvidersCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WorkSpacesWebClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpacesWeb | WorkSpacesWebClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesWebPaginationConfiguration, + ListIdentityProvidersCommandInput, + ListIdentityProvidersCommandOutput +>(WorkSpacesWebClient, ListIdentityProvidersCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-workspaces-web/src/pagination/ListIpAccessSettingsPaginator.ts b/clients/client-workspaces-web/src/pagination/ListIpAccessSettingsPaginator.ts index 32ee854aa198..36f79475dae1 100644 --- a/clients/client-workspaces-web/src/pagination/ListIpAccessSettingsPaginator.ts +++ b/clients/client-workspaces-web/src/pagination/ListIpAccessSettingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkSpacesWebClient } from "../WorkSpacesWebClient"; import { WorkSpacesWebPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesWebClient, - input: ListIpAccessSettingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListIpAccessSettingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListIpAccessSettings( +export const paginateListIpAccessSettings: ( config: WorkSpacesWebPaginationConfiguration, input: ListIpAccessSettingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListIpAccessSettingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WorkSpacesWebClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpacesWeb | WorkSpacesWebClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesWebPaginationConfiguration, + ListIpAccessSettingsCommandInput, + ListIpAccessSettingsCommandOutput +>(WorkSpacesWebClient, ListIpAccessSettingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-workspaces-web/src/pagination/ListNetworkSettingsPaginator.ts b/clients/client-workspaces-web/src/pagination/ListNetworkSettingsPaginator.ts index dc03fabb947c..df8d3afc230a 100644 --- a/clients/client-workspaces-web/src/pagination/ListNetworkSettingsPaginator.ts +++ b/clients/client-workspaces-web/src/pagination/ListNetworkSettingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkSpacesWebClient } from "../WorkSpacesWebClient"; import { WorkSpacesWebPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesWebClient, - input: ListNetworkSettingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListNetworkSettingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListNetworkSettings( +export const paginateListNetworkSettings: ( config: WorkSpacesWebPaginationConfiguration, input: ListNetworkSettingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListNetworkSettingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WorkSpacesWebClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpacesWeb | WorkSpacesWebClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesWebPaginationConfiguration, + ListNetworkSettingsCommandInput, + ListNetworkSettingsCommandOutput +>(WorkSpacesWebClient, ListNetworkSettingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-workspaces-web/src/pagination/ListPortalsPaginator.ts b/clients/client-workspaces-web/src/pagination/ListPortalsPaginator.ts index 3b3f6458ec04..5d53d3e17435 100644 --- a/clients/client-workspaces-web/src/pagination/ListPortalsPaginator.ts +++ b/clients/client-workspaces-web/src/pagination/ListPortalsPaginator.ts @@ -1,46 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { ListPortalsCommand, ListPortalsCommandInput, ListPortalsCommandOutput } from "../commands/ListPortalsCommand"; import { WorkSpacesWebClient } from "../WorkSpacesWebClient"; import { WorkSpacesWebPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesWebClient, - input: ListPortalsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListPortalsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListPortals( +export const paginateListPortals: ( config: WorkSpacesWebPaginationConfiguration, input: ListPortalsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListPortalsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WorkSpacesWebClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpacesWeb | WorkSpacesWebClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesWebPaginationConfiguration, + ListPortalsCommandInput, + ListPortalsCommandOutput +>(WorkSpacesWebClient, ListPortalsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-workspaces-web/src/pagination/ListTrustStoreCertificatesPaginator.ts b/clients/client-workspaces-web/src/pagination/ListTrustStoreCertificatesPaginator.ts index 21fd6addc238..61f9bd7df4e4 100644 --- a/clients/client-workspaces-web/src/pagination/ListTrustStoreCertificatesPaginator.ts +++ b/clients/client-workspaces-web/src/pagination/ListTrustStoreCertificatesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkSpacesWebClient } from "../WorkSpacesWebClient"; import { WorkSpacesWebPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesWebClient, - input: ListTrustStoreCertificatesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTrustStoreCertificatesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTrustStoreCertificates( +export const paginateListTrustStoreCertificates: ( config: WorkSpacesWebPaginationConfiguration, input: ListTrustStoreCertificatesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTrustStoreCertificatesCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WorkSpacesWebClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpacesWeb | WorkSpacesWebClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesWebPaginationConfiguration, + ListTrustStoreCertificatesCommandInput, + ListTrustStoreCertificatesCommandOutput +>(WorkSpacesWebClient, ListTrustStoreCertificatesCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-workspaces-web/src/pagination/ListTrustStoresPaginator.ts b/clients/client-workspaces-web/src/pagination/ListTrustStoresPaginator.ts index 1dc93e287dfa..b3ba9f0db94c 100644 --- a/clients/client-workspaces-web/src/pagination/ListTrustStoresPaginator.ts +++ b/clients/client-workspaces-web/src/pagination/ListTrustStoresPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkSpacesWebClient } from "../WorkSpacesWebClient"; import { WorkSpacesWebPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesWebClient, - input: ListTrustStoresCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTrustStoresCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTrustStores( +export const paginateListTrustStores: ( config: WorkSpacesWebPaginationConfiguration, input: ListTrustStoresCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTrustStoresCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WorkSpacesWebClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpacesWeb | WorkSpacesWebClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesWebPaginationConfiguration, + ListTrustStoresCommandInput, + ListTrustStoresCommandOutput +>(WorkSpacesWebClient, ListTrustStoresCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-workspaces-web/src/pagination/ListUserAccessLoggingSettingsPaginator.ts b/clients/client-workspaces-web/src/pagination/ListUserAccessLoggingSettingsPaginator.ts index b4fd67e62c4c..ddd433da04b5 100644 --- a/clients/client-workspaces-web/src/pagination/ListUserAccessLoggingSettingsPaginator.ts +++ b/clients/client-workspaces-web/src/pagination/ListUserAccessLoggingSettingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkSpacesWebClient } from "../WorkSpacesWebClient"; import { WorkSpacesWebPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesWebClient, - input: ListUserAccessLoggingSettingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUserAccessLoggingSettingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUserAccessLoggingSettings( +export const paginateListUserAccessLoggingSettings: ( config: WorkSpacesWebPaginationConfiguration, input: ListUserAccessLoggingSettingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUserAccessLoggingSettingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WorkSpacesWebClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpacesWeb | WorkSpacesWebClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesWebPaginationConfiguration, + ListUserAccessLoggingSettingsCommandInput, + ListUserAccessLoggingSettingsCommandOutput +>(WorkSpacesWebClient, ListUserAccessLoggingSettingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-workspaces-web/src/pagination/ListUserSettingsPaginator.ts b/clients/client-workspaces-web/src/pagination/ListUserSettingsPaginator.ts index 482edfdfff1e..dae82c62020d 100644 --- a/clients/client-workspaces-web/src/pagination/ListUserSettingsPaginator.ts +++ b/clients/client-workspaces-web/src/pagination/ListUserSettingsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkSpacesWebClient } from "../WorkSpacesWebClient"; import { WorkSpacesWebPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesWebClient, - input: ListUserSettingsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListUserSettingsCommand(input), ...args); -}; /** * @public */ -export async function* paginateListUserSettings( +export const paginateListUserSettings: ( config: WorkSpacesWebPaginationConfiguration, input: ListUserSettingsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.nextToken - let token: typeof input.nextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListUserSettingsCommandOutput; - while (hasNext) { - input.nextToken = token; - input["maxResults"] = config.pageSize; - if (config.client instanceof WorkSpacesWebClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpacesWeb | WorkSpacesWebClient"); - } - yield page; - const prevToken = token; - token = page.nextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesWebPaginationConfiguration, + ListUserSettingsCommandInput, + ListUserSettingsCommandOutput +>(WorkSpacesWebClient, ListUserSettingsCommand, "nextToken", "nextToken", "maxResults"); diff --git a/clients/client-workspaces/package.json b/clients/client-workspaces/package.json index 304966e1dbce..dad010525414 100644 --- a/clients/client-workspaces/package.json +++ b/clients/client-workspaces/package.json @@ -34,6 +34,7 @@ "@aws-sdk/util-user-agent-browser": "*", "@aws-sdk/util-user-agent-node": "*", "@smithy/config-resolver": "^2.0.21", + "@smithy/core": "^1.2.0", "@smithy/fetch-http-handler": "^2.3.1", "@smithy/hash-node": "^2.0.17", "@smithy/invalid-dependency": "^2.0.15", diff --git a/clients/client-workspaces/src/pagination/DescribeApplicationAssociationsPaginator.ts b/clients/client-workspaces/src/pagination/DescribeApplicationAssociationsPaginator.ts index 32ef2a851f7e..b6549ae05f63 100644 --- a/clients/client-workspaces/src/pagination/DescribeApplicationAssociationsPaginator.ts +++ b/clients/client-workspaces/src/pagination/DescribeApplicationAssociationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkSpacesClient } from "../WorkSpacesClient"; import { WorkSpacesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesClient, - input: DescribeApplicationAssociationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeApplicationAssociationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeApplicationAssociations( +export const paginateDescribeApplicationAssociations: ( config: WorkSpacesPaginationConfiguration, input: DescribeApplicationAssociationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeApplicationAssociationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkSpacesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpaces | WorkSpacesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesPaginationConfiguration, + DescribeApplicationAssociationsCommandInput, + DescribeApplicationAssociationsCommandOutput +>(WorkSpacesClient, DescribeApplicationAssociationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workspaces/src/pagination/DescribeApplicationsPaginator.ts b/clients/client-workspaces/src/pagination/DescribeApplicationsPaginator.ts index becd8ef96e19..4a5debee1621 100644 --- a/clients/client-workspaces/src/pagination/DescribeApplicationsPaginator.ts +++ b/clients/client-workspaces/src/pagination/DescribeApplicationsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkSpacesClient } from "../WorkSpacesClient"; import { WorkSpacesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesClient, - input: DescribeApplicationsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeApplicationsCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeApplications( +export const paginateDescribeApplications: ( config: WorkSpacesPaginationConfiguration, input: DescribeApplicationsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeApplicationsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof WorkSpacesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpaces | WorkSpacesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesPaginationConfiguration, + DescribeApplicationsCommandInput, + DescribeApplicationsCommandOutput +>(WorkSpacesClient, DescribeApplicationsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-workspaces/src/pagination/DescribeWorkspaceBundlesPaginator.ts b/clients/client-workspaces/src/pagination/DescribeWorkspaceBundlesPaginator.ts index 9d3fdc0d66d2..226b1f2f5b90 100644 --- a/clients/client-workspaces/src/pagination/DescribeWorkspaceBundlesPaginator.ts +++ b/clients/client-workspaces/src/pagination/DescribeWorkspaceBundlesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { WorkSpacesClient } from "../WorkSpacesClient"; import { WorkSpacesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesClient, - input: DescribeWorkspaceBundlesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeWorkspaceBundlesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeWorkspaceBundles( +export const paginateDescribeWorkspaceBundles: ( config: WorkSpacesPaginationConfiguration, input: DescribeWorkspaceBundlesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeWorkspaceBundlesCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof WorkSpacesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpaces | WorkSpacesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesPaginationConfiguration, + DescribeWorkspaceBundlesCommandInput, + DescribeWorkspaceBundlesCommandOutput +>(WorkSpacesClient, DescribeWorkspaceBundlesCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-workspaces/src/pagination/DescribeWorkspaceDirectoriesPaginator.ts b/clients/client-workspaces/src/pagination/DescribeWorkspaceDirectoriesPaginator.ts index 4345d957eef7..867ac1d84011 100644 --- a/clients/client-workspaces/src/pagination/DescribeWorkspaceDirectoriesPaginator.ts +++ b/clients/client-workspaces/src/pagination/DescribeWorkspaceDirectoriesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { WorkSpacesClient } from "../WorkSpacesClient"; import { WorkSpacesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesClient, - input: DescribeWorkspaceDirectoriesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeWorkspaceDirectoriesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeWorkspaceDirectories( +export const paginateDescribeWorkspaceDirectories: ( config: WorkSpacesPaginationConfiguration, input: DescribeWorkspaceDirectoriesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeWorkspaceDirectoriesCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof WorkSpacesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpaces | WorkSpacesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesPaginationConfiguration, + DescribeWorkspaceDirectoriesCommandInput, + DescribeWorkspaceDirectoriesCommandOutput +>(WorkSpacesClient, DescribeWorkspaceDirectoriesCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-workspaces/src/pagination/DescribeWorkspacesPaginator.ts b/clients/client-workspaces/src/pagination/DescribeWorkspacesPaginator.ts index bc2119566cfc..a58cc5e3d217 100644 --- a/clients/client-workspaces/src/pagination/DescribeWorkspacesPaginator.ts +++ b/clients/client-workspaces/src/pagination/DescribeWorkspacesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { WorkSpacesClient } from "../WorkSpacesClient"; import { WorkSpacesPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: WorkSpacesClient, - input: DescribeWorkspacesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new DescribeWorkspacesCommand(input), ...args); -}; /** * @public */ -export async function* paginateDescribeWorkspaces( +export const paginateDescribeWorkspaces: ( config: WorkSpacesPaginationConfiguration, input: DescribeWorkspacesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: DescribeWorkspacesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["Limit"] = config.pageSize; - if (config.client instanceof WorkSpacesClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected WorkSpaces | WorkSpacesClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + WorkSpacesPaginationConfiguration, + DescribeWorkspacesCommandInput, + DescribeWorkspacesCommandOutput +>(WorkSpacesClient, DescribeWorkspacesCommand, "NextToken", "NextToken", "Limit"); diff --git a/clients/client-xray/src/pagination/BatchGetTracesPaginator.ts b/clients/client-xray/src/pagination/BatchGetTracesPaginator.ts index 5691982981e6..52d9ca7402af 100644 --- a/clients/client-xray/src/pagination/BatchGetTracesPaginator.ts +++ b/clients/client-xray/src/pagination/BatchGetTracesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { XRayClient } from "../XRayClient"; import { XRayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: XRayClient, - input: BatchGetTracesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new BatchGetTracesCommand(input), ...args); -}; /** * @public */ -export async function* paginateBatchGetTraces( +export const paginateBatchGetTraces: ( config: XRayPaginationConfiguration, input: BatchGetTracesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: BatchGetTracesCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof XRayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected XRay | XRayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + XRayPaginationConfiguration, + BatchGetTracesCommandInput, + BatchGetTracesCommandOutput +>(XRayClient, BatchGetTracesCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-xray/src/pagination/GetGroupsPaginator.ts b/clients/client-xray/src/pagination/GetGroupsPaginator.ts index 3ee8e4d7c09e..4c01aa82c4be 100644 --- a/clients/client-xray/src/pagination/GetGroupsPaginator.ts +++ b/clients/client-xray/src/pagination/GetGroupsPaginator.ts @@ -1,45 +1,20 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { GetGroupsCommand, GetGroupsCommandInput, GetGroupsCommandOutput } from "../commands/GetGroupsCommand"; import { XRayClient } from "../XRayClient"; import { XRayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: XRayClient, - input: GetGroupsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetGroupsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetGroups( +export const paginateGetGroups: ( config: XRayPaginationConfiguration, input: GetGroupsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetGroupsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof XRayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected XRay | XRayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + XRayPaginationConfiguration, + GetGroupsCommandInput, + GetGroupsCommandOutput +>(XRayClient, GetGroupsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-xray/src/pagination/GetInsightEventsPaginator.ts b/clients/client-xray/src/pagination/GetInsightEventsPaginator.ts index 425a8ce6ae10..016887559916 100644 --- a/clients/client-xray/src/pagination/GetInsightEventsPaginator.ts +++ b/clients/client-xray/src/pagination/GetInsightEventsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { XRayClient } from "../XRayClient"; import { XRayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: XRayClient, - input: GetInsightEventsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetInsightEventsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetInsightEvents( +export const paginateGetInsightEvents: ( config: XRayPaginationConfiguration, input: GetInsightEventsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetInsightEventsCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof XRayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected XRay | XRayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + XRayPaginationConfiguration, + GetInsightEventsCommandInput, + GetInsightEventsCommandOutput +>(XRayClient, GetInsightEventsCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-xray/src/pagination/GetInsightSummariesPaginator.ts b/clients/client-xray/src/pagination/GetInsightSummariesPaginator.ts index 697cb9b54eea..6fe8f98af50f 100644 --- a/clients/client-xray/src/pagination/GetInsightSummariesPaginator.ts +++ b/clients/client-xray/src/pagination/GetInsightSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,42 +10,15 @@ import { import { XRayClient } from "../XRayClient"; import { XRayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: XRayClient, - input: GetInsightSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetInsightSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetInsightSummaries( +export const paginateGetInsightSummaries: ( config: XRayPaginationConfiguration, input: GetInsightSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetInsightSummariesCommandOutput; - while (hasNext) { - input.NextToken = token; - input["MaxResults"] = config.pageSize; - if (config.client instanceof XRayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected XRay | XRayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + XRayPaginationConfiguration, + GetInsightSummariesCommandInput, + GetInsightSummariesCommandOutput +>(XRayClient, GetInsightSummariesCommand, "NextToken", "NextToken", "MaxResults"); diff --git a/clients/client-xray/src/pagination/GetSamplingRulesPaginator.ts b/clients/client-xray/src/pagination/GetSamplingRulesPaginator.ts index 83cb54f5ff37..1100f1a1e603 100644 --- a/clients/client-xray/src/pagination/GetSamplingRulesPaginator.ts +++ b/clients/client-xray/src/pagination/GetSamplingRulesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { XRayClient } from "../XRayClient"; import { XRayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: XRayClient, - input: GetSamplingRulesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetSamplingRulesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetSamplingRules( +export const paginateGetSamplingRules: ( config: XRayPaginationConfiguration, input: GetSamplingRulesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetSamplingRulesCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof XRayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected XRay | XRayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + XRayPaginationConfiguration, + GetSamplingRulesCommandInput, + GetSamplingRulesCommandOutput +>(XRayClient, GetSamplingRulesCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-xray/src/pagination/GetSamplingStatisticSummariesPaginator.ts b/clients/client-xray/src/pagination/GetSamplingStatisticSummariesPaginator.ts index 73cc4ea5b1aa..66836d65ac4f 100644 --- a/clients/client-xray/src/pagination/GetSamplingStatisticSummariesPaginator.ts +++ b/clients/client-xray/src/pagination/GetSamplingStatisticSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { XRayClient } from "../XRayClient"; import { XRayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: XRayClient, - input: GetSamplingStatisticSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetSamplingStatisticSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetSamplingStatisticSummaries( +export const paginateGetSamplingStatisticSummaries: ( config: XRayPaginationConfiguration, input: GetSamplingStatisticSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetSamplingStatisticSummariesCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof XRayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected XRay | XRayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + XRayPaginationConfiguration, + GetSamplingStatisticSummariesCommandInput, + GetSamplingStatisticSummariesCommandOutput +>(XRayClient, GetSamplingStatisticSummariesCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-xray/src/pagination/GetServiceGraphPaginator.ts b/clients/client-xray/src/pagination/GetServiceGraphPaginator.ts index c4b50d316b30..cb91ecfeba02 100644 --- a/clients/client-xray/src/pagination/GetServiceGraphPaginator.ts +++ b/clients/client-xray/src/pagination/GetServiceGraphPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { XRayClient } from "../XRayClient"; import { XRayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: XRayClient, - input: GetServiceGraphCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetServiceGraphCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetServiceGraph( +export const paginateGetServiceGraph: ( config: XRayPaginationConfiguration, input: GetServiceGraphCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetServiceGraphCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof XRayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected XRay | XRayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + XRayPaginationConfiguration, + GetServiceGraphCommandInput, + GetServiceGraphCommandOutput +>(XRayClient, GetServiceGraphCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-xray/src/pagination/GetTimeSeriesServiceStatisticsPaginator.ts b/clients/client-xray/src/pagination/GetTimeSeriesServiceStatisticsPaginator.ts index 9eebb3420441..83b83a3bcc61 100644 --- a/clients/client-xray/src/pagination/GetTimeSeriesServiceStatisticsPaginator.ts +++ b/clients/client-xray/src/pagination/GetTimeSeriesServiceStatisticsPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { XRayClient } from "../XRayClient"; import { XRayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: XRayClient, - input: GetTimeSeriesServiceStatisticsCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTimeSeriesServiceStatisticsCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTimeSeriesServiceStatistics( +export const paginateGetTimeSeriesServiceStatistics: ( config: XRayPaginationConfiguration, input: GetTimeSeriesServiceStatisticsCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTimeSeriesServiceStatisticsCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof XRayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected XRay | XRayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + XRayPaginationConfiguration, + GetTimeSeriesServiceStatisticsCommandInput, + GetTimeSeriesServiceStatisticsCommandOutput +>(XRayClient, GetTimeSeriesServiceStatisticsCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-xray/src/pagination/GetTraceGraphPaginator.ts b/clients/client-xray/src/pagination/GetTraceGraphPaginator.ts index 1b1ad69dd959..bbbde5fdda21 100644 --- a/clients/client-xray/src/pagination/GetTraceGraphPaginator.ts +++ b/clients/client-xray/src/pagination/GetTraceGraphPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { XRayClient } from "../XRayClient"; import { XRayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: XRayClient, - input: GetTraceGraphCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTraceGraphCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTraceGraph( +export const paginateGetTraceGraph: ( config: XRayPaginationConfiguration, input: GetTraceGraphCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTraceGraphCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof XRayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected XRay | XRayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + XRayPaginationConfiguration, + GetTraceGraphCommandInput, + GetTraceGraphCommandOutput +>(XRayClient, GetTraceGraphCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-xray/src/pagination/GetTraceSummariesPaginator.ts b/clients/client-xray/src/pagination/GetTraceSummariesPaginator.ts index 53775642bec2..1cca996999f6 100644 --- a/clients/client-xray/src/pagination/GetTraceSummariesPaginator.ts +++ b/clients/client-xray/src/pagination/GetTraceSummariesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { XRayClient } from "../XRayClient"; import { XRayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: XRayClient, - input: GetTraceSummariesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new GetTraceSummariesCommand(input), ...args); -}; /** * @public */ -export async function* paginateGetTraceSummaries( +export const paginateGetTraceSummaries: ( config: XRayPaginationConfiguration, input: GetTraceSummariesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: GetTraceSummariesCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof XRayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected XRay | XRayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + XRayPaginationConfiguration, + GetTraceSummariesCommandInput, + GetTraceSummariesCommandOutput +>(XRayClient, GetTraceSummariesCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-xray/src/pagination/ListResourcePoliciesPaginator.ts b/clients/client-xray/src/pagination/ListResourcePoliciesPaginator.ts index a3b9fe2bdf3e..c04c9409debc 100644 --- a/clients/client-xray/src/pagination/ListResourcePoliciesPaginator.ts +++ b/clients/client-xray/src/pagination/ListResourcePoliciesPaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { XRayClient } from "../XRayClient"; import { XRayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: XRayClient, - input: ListResourcePoliciesCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListResourcePoliciesCommand(input), ...args); -}; /** * @public */ -export async function* paginateListResourcePolicies( +export const paginateListResourcePolicies: ( config: XRayPaginationConfiguration, input: ListResourcePoliciesCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListResourcePoliciesCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof XRayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected XRay | XRayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + XRayPaginationConfiguration, + ListResourcePoliciesCommandInput, + ListResourcePoliciesCommandOutput +>(XRayClient, ListResourcePoliciesCommand, "NextToken", "NextToken", ""); diff --git a/clients/client-xray/src/pagination/ListTagsForResourcePaginator.ts b/clients/client-xray/src/pagination/ListTagsForResourcePaginator.ts index ce4022bf066a..8a97aee5c566 100644 --- a/clients/client-xray/src/pagination/ListTagsForResourcePaginator.ts +++ b/clients/client-xray/src/pagination/ListTagsForResourcePaginator.ts @@ -1,4 +1,5 @@ // smithy-typescript generated code +import { createPaginator } from "@smithy/core"; import { Paginator } from "@smithy/types"; import { @@ -9,41 +10,15 @@ import { import { XRayClient } from "../XRayClient"; import { XRayPaginationConfiguration } from "./Interfaces"; -/** - * @internal - */ -const makePagedClientRequest = async ( - client: XRayClient, - input: ListTagsForResourceCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.send(new ListTagsForResourceCommand(input), ...args); -}; /** * @public */ -export async function* paginateListTagsForResource( +export const paginateListTagsForResource: ( config: XRayPaginationConfiguration, input: ListTagsForResourceCommandInput, - ...additionalArguments: any -): Paginator { - // ToDo: replace with actual type instead of typeof input.NextToken - let token: typeof input.NextToken | undefined = config.startingToken || undefined; - let hasNext = true; - let page: ListTagsForResourceCommandOutput; - while (hasNext) { - input.NextToken = token; - if (config.client instanceof XRayClient) { - page = await makePagedClientRequest(config.client, input, ...additionalArguments); - } else { - throw new Error("Invalid client, expected XRay | XRayClient"); - } - yield page; - const prevToken = token; - token = page.NextToken; - hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken)); - } - // @ts-ignore - return undefined; -} + ...rest: any[] +) => Paginator = createPaginator< + XRayPaginationConfiguration, + ListTagsForResourceCommandInput, + ListTagsForResourceCommandOutput +>(XRayClient, ListTagsForResourceCommand, "NextToken", "NextToken", ""); diff --git a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/DocumentClientPaginationGenerator.java b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/DocumentClientPaginationGenerator.java index 0f21c4a7b66e..5c5d2e709620 100644 --- a/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/DocumentClientPaginationGenerator.java +++ b/codegen/smithy-aws-typescript-codegen/src/main/java/software/amazon/smithy/aws/typescript/codegen/DocumentClientPaginationGenerator.java @@ -86,10 +86,6 @@ public void run() { DocumentClientUtils.CLIENT_NAME, DocumentClientUtils.CLIENT_NAME, Paths.get(".", DocumentClientUtils.CLIENT_NAME).toString()); - writer.addImport( - DocumentClientUtils.CLIENT_FULL_NAME, - DocumentClientUtils.CLIENT_FULL_NAME, - Paths.get(".", DocumentClientUtils.CLIENT_FULL_NAME).toString()); // Import Pagination types writer.addImport("Paginator", "Paginator", TypeScriptDependency.SMITHY_TYPES); @@ -100,7 +96,6 @@ public void run() { writer.write("export { Paginator }"); writeCommandRequest(); - writeMethodRequest(); writePager(); } @@ -168,12 +163,7 @@ private void writePager() { writer.write("input[$S] = config.pageSize;", pageSize); } - writer.openBlock("if (config.client instanceof $L) {", "}", DocumentClientUtils.CLIENT_FULL_NAME, - () -> { - writer.write("page = await makePagedRequest(config.client, input, ...additionalArguments);"); - } - ); - writer.openBlock("else if (config.client instanceof $L) {", "}", DocumentClientUtils.CLIENT_NAME, + writer.openBlock("if (config.client instanceof $L) {", "}", DocumentClientUtils.CLIENT_NAME, () -> { writer.write( "page = await makePagedClientRequest(config.client, input, ...additionalArguments);"); @@ -196,21 +186,6 @@ private void writePager() { } - /** - * Paginated command that calls client.method({...}) under the hood. This is meant for server side environments and - * exposes the entire service. - */ - private void writeMethodRequest() { - writer.writeDocs("@internal"); - writer.openBlock( - "const makePagedRequest = async (client: $L, input: $L, ...args: any): Promise<$L> => {", - "}", DocumentClientUtils.CLIENT_FULL_NAME, inputTypeName, - outputTypeName, () -> { - writer.write("// @ts-ignore"); - writer.write("return await client.$L(input, ...args);", methodName); - }); - } - /** * Paginated command that calls CommandClient().send({...}) under the hood. This is meant for client side (browser) * environments and does not generally expose the entire service. diff --git a/lib/lib-dynamodb/src/pagination/QueryPaginator.ts b/lib/lib-dynamodb/src/pagination/QueryPaginator.ts index 8abf672bb31d..699a84949a0a 100644 --- a/lib/lib-dynamodb/src/pagination/QueryPaginator.ts +++ b/lib/lib-dynamodb/src/pagination/QueryPaginator.ts @@ -2,7 +2,6 @@ import { Paginator } from "@smithy/types"; import { QueryCommand, QueryCommandInput, QueryCommandOutput } from "../commands/QueryCommand"; -import { DynamoDBDocument } from "../DynamoDBDocument"; import { DynamoDBDocumentClient } from "../DynamoDBDocumentClient"; import { DynamoDBDocumentPaginationConfiguration } from "./Interfaces"; @@ -21,17 +20,6 @@ const makePagedClientRequest = async ( // @ts-ignore return await client.send(new QueryCommand(input), ...args); }; -/** - * @internal - */ -const makePagedRequest = async ( - client: DynamoDBDocument, - input: QueryCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.query(input, ...args); -}; /** * @public * @@ -51,9 +39,7 @@ export async function* paginateQuery( while (hasNext) { input.ExclusiveStartKey = token; input["Limit"] = config.pageSize; - if (config.client instanceof DynamoDBDocument) { - page = await makePagedRequest(config.client, input, ...additionalArguments); - } else if (config.client instanceof DynamoDBDocumentClient) { + if (config.client instanceof DynamoDBDocumentClient) { page = await makePagedClientRequest(config.client, input, ...additionalArguments); } else { throw new Error("Invalid client, expected DynamoDBDocument | DynamoDBDocumentClient"); diff --git a/lib/lib-dynamodb/src/pagination/ScanPaginator.ts b/lib/lib-dynamodb/src/pagination/ScanPaginator.ts index 12f4876b3a3a..fe67bc0f0cb5 100644 --- a/lib/lib-dynamodb/src/pagination/ScanPaginator.ts +++ b/lib/lib-dynamodb/src/pagination/ScanPaginator.ts @@ -2,7 +2,6 @@ import { Paginator } from "@smithy/types"; import { ScanCommand, ScanCommandInput, ScanCommandOutput } from "../commands/ScanCommand"; -import { DynamoDBDocument } from "../DynamoDBDocument"; import { DynamoDBDocumentClient } from "../DynamoDBDocumentClient"; import { DynamoDBDocumentPaginationConfiguration } from "./Interfaces"; @@ -21,17 +20,6 @@ const makePagedClientRequest = async ( // @ts-ignore return await client.send(new ScanCommand(input), ...args); }; -/** - * @internal - */ -const makePagedRequest = async ( - client: DynamoDBDocument, - input: ScanCommandInput, - ...args: any -): Promise => { - // @ts-ignore - return await client.scan(input, ...args); -}; /** * @public * @@ -51,9 +39,7 @@ export async function* paginateScan( while (hasNext) { input.ExclusiveStartKey = token; input["Limit"] = config.pageSize; - if (config.client instanceof DynamoDBDocument) { - page = await makePagedRequest(config.client, input, ...additionalArguments); - } else if (config.client instanceof DynamoDBDocumentClient) { + if (config.client instanceof DynamoDBDocumentClient) { page = await makePagedClientRequest(config.client, input, ...additionalArguments); } else { throw new Error("Invalid client, expected DynamoDBDocument | DynamoDBDocumentClient"); diff --git a/scripts/generate-clients/config.js b/scripts/generate-clients/config.js index 996af167ddec..fd08c178cbf2 100644 --- a/scripts/generate-clients/config.js +++ b/scripts/generate-clients/config.js @@ -1,5 +1,5 @@ // Update this commit when taking up new changes from smithy-typescript. module.exports = { // Use full commit hash as we explicitly fetch it. - SMITHY_TS_COMMIT: "9485a7319aefdc44ff8cdb06402a6e486450c78d", + SMITHY_TS_COMMIT: "f0ff3b7cdb93ce607c3873bab9a553566e0aec0b", };