Skip to content

Commit

Permalink
feat(types): add pagination stopOnSameToken option (#3524)
Browse files Browse the repository at this point in the history
* feat(types): add pagination stopOnSameToken option

* feat(types): pagination, update client codegen
  • Loading branch information
kuhe committed Apr 25, 2022
1 parent e017377 commit 9bf73e8
Show file tree
Hide file tree
Showing 1,947 changed files with 3,900 additions and 1,946 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListAccessPreviewFindings(
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListAccessPreviews(
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListAnalyzedResources(
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListAnalyzers(
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListArchiveRules(
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListFindings(
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListPolicyGenerations(
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateValidatePolicy(
throw new Error("Invalid client, expected AccessAnalyzer | AccessAnalyzerClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListCertificateAuthorities(
throw new Error("Invalid client, expected ACMPCA | ACMPCAClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListPermissions(
throw new Error("Invalid client, expected ACMPCA | ACMPCAClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
3 changes: 2 additions & 1 deletion clients/client-acm-pca/src/pagination/ListTagsPaginator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ export async function* paginateListTags(
throw new Error("Invalid client, expected ACMPCA | ACMPCAClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListCertificates(
throw new Error("Invalid client, expected ACM | ACMClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListBusinessReportSchedules(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListConferenceProviders(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListDeviceEvents(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListGatewayGroups(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListGateways(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ export async function* paginateListSkills(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListSkillsStoreCategories(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListSkillsStoreSkillsByCategory(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListSmartHomeAppliances(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ export async function* paginateListTags(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateSearchAddressBooks(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateSearchContacts(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateSearchDevices(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateSearchNetworkProfiles(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateSearchProfiles(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ export async function* paginateSearchRooms(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateSearchSkillGroups(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ export async function* paginateSearchUsers(
throw new Error("Invalid client, expected AlexaForBusiness | AlexaForBusinessClient");
}
yield page;
const prevToken = token;
token = page.NextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListRuleGroupsNamespaces(
throw new Error("Invalid client, expected Amp | AmpClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
3 changes: 2 additions & 1 deletion clients/client-amp/src/pagination/ListWorkspacesPaginator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListWorkspaces(
throw new Error("Invalid client, expected Amp | AmpClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ export async function* paginateExportComponents(
throw new Error("Invalid client, expected AmplifyUIBuilder | AmplifyUIBuilderClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ export async function* paginateExportThemes(
throw new Error("Invalid client, expected AmplifyUIBuilder | AmplifyUIBuilderClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export async function* paginateListComponents(
throw new Error("Invalid client, expected AmplifyUIBuilder | AmplifyUIBuilderClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ export async function* paginateListThemes(
throw new Error("Invalid client, expected AmplifyUIBuilder | AmplifyUIBuilderClient");
}
yield page;
const prevToken = token;
token = page.nextToken;
hasNext = !!token;
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
}
// @ts-ignore
return undefined;
Expand Down
Loading

0 comments on commit 9bf73e8

Please sign in to comment.