@aws-sdk/client-sns 3.180.0 → 3.183.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist-cjs/protocols/Aws_query.js +270 -262
  3. package/dist-es/SNS.js +170 -177
  4. package/dist-es/SNSClient.js +22 -28
  5. package/dist-es/commands/AddPermissionCommand.js +22 -29
  6. package/dist-es/commands/CheckIfPhoneNumberIsOptedOutCommand.js +21 -28
  7. package/dist-es/commands/ConfirmSubscriptionCommand.js +21 -28
  8. package/dist-es/commands/CreatePlatformApplicationCommand.js +21 -28
  9. package/dist-es/commands/CreatePlatformEndpointCommand.js +21 -28
  10. package/dist-es/commands/CreateSMSSandboxPhoneNumberCommand.js +21 -28
  11. package/dist-es/commands/CreateTopicCommand.js +21 -28
  12. package/dist-es/commands/DeleteEndpointCommand.js +22 -29
  13. package/dist-es/commands/DeletePlatformApplicationCommand.js +22 -29
  14. package/dist-es/commands/DeleteSMSSandboxPhoneNumberCommand.js +21 -28
  15. package/dist-es/commands/DeleteTopicCommand.js +22 -29
  16. package/dist-es/commands/GetDataProtectionPolicyCommand.js +21 -28
  17. package/dist-es/commands/GetEndpointAttributesCommand.js +21 -28
  18. package/dist-es/commands/GetPlatformApplicationAttributesCommand.js +21 -28
  19. package/dist-es/commands/GetSMSAttributesCommand.js +21 -28
  20. package/dist-es/commands/GetSMSSandboxAccountStatusCommand.js +21 -28
  21. package/dist-es/commands/GetSubscriptionAttributesCommand.js +21 -28
  22. package/dist-es/commands/GetTopicAttributesCommand.js +21 -28
  23. package/dist-es/commands/ListEndpointsByPlatformApplicationCommand.js +21 -28
  24. package/dist-es/commands/ListOriginationNumbersCommand.js +21 -28
  25. package/dist-es/commands/ListPhoneNumbersOptedOutCommand.js +21 -28
  26. package/dist-es/commands/ListPlatformApplicationsCommand.js +21 -28
  27. package/dist-es/commands/ListSMSSandboxPhoneNumbersCommand.js +21 -28
  28. package/dist-es/commands/ListSubscriptionsByTopicCommand.js +21 -28
  29. package/dist-es/commands/ListSubscriptionsCommand.js +21 -28
  30. package/dist-es/commands/ListTagsForResourceCommand.js +21 -28
  31. package/dist-es/commands/ListTopicsCommand.js +21 -28
  32. package/dist-es/commands/OptInPhoneNumberCommand.js +21 -28
  33. package/dist-es/commands/PublishBatchCommand.js +21 -28
  34. package/dist-es/commands/PublishCommand.js +21 -28
  35. package/dist-es/commands/PutDataProtectionPolicyCommand.js +22 -29
  36. package/dist-es/commands/RemovePermissionCommand.js +22 -29
  37. package/dist-es/commands/SetEndpointAttributesCommand.js +22 -29
  38. package/dist-es/commands/SetPlatformApplicationAttributesCommand.js +22 -29
  39. package/dist-es/commands/SetSMSAttributesCommand.js +21 -28
  40. package/dist-es/commands/SetSubscriptionAttributesCommand.js +22 -29
  41. package/dist-es/commands/SetTopicAttributesCommand.js +22 -29
  42. package/dist-es/commands/SubscribeCommand.js +21 -28
  43. package/dist-es/commands/TagResourceCommand.js +21 -28
  44. package/dist-es/commands/UnsubscribeCommand.js +22 -29
  45. package/dist-es/commands/UntagResourceCommand.js +21 -28
  46. package/dist-es/commands/VerifySMSSandboxPhoneNumberCommand.js +21 -28
  47. package/dist-es/endpoints.js +8 -8
  48. package/dist-es/models/SNSServiceException.js +5 -10
  49. package/dist-es/models/models_0.js +639 -472
  50. package/dist-es/pagination/ListEndpointsByPlatformApplicationPaginator.js +24 -67
  51. package/dist-es/pagination/ListOriginationNumbersPaginator.js +25 -68
  52. package/dist-es/pagination/ListPhoneNumbersOptedOutPaginator.js +24 -67
  53. package/dist-es/pagination/ListPlatformApplicationsPaginator.js +24 -67
  54. package/dist-es/pagination/ListSMSSandboxPhoneNumbersPaginator.js +25 -68
  55. package/dist-es/pagination/ListSubscriptionsByTopicPaginator.js +24 -67
  56. package/dist-es/pagination/ListSubscriptionsPaginator.js +24 -67
  57. package/dist-es/pagination/ListTopicsPaginator.js +24 -67
  58. package/dist-es/protocols/Aws_query.js +3114 -4092
  59. package/dist-es/runtimeConfig.browser.js +26 -12
  60. package/dist-es/runtimeConfig.js +30 -12
  61. package/dist-es/runtimeConfig.native.js +8 -5
  62. package/dist-es/runtimeConfig.shared.js +8 -11
  63. package/package.json +33 -33
@@ -1,74 +1,31 @@
1
- import { __asyncGenerator, __await, __awaiter, __generator, __read, __spreadArray } from "tslib";
2
1
  import { ListEndpointsByPlatformApplicationCommand, } from "../commands/ListEndpointsByPlatformApplicationCommand";
3
2
  import { SNS } from "../SNS";
4
3
  import { SNSClient } from "../SNSClient";
5
- var makePagedClientRequest = function (client, input) {
6
- var args = [];
7
- for (var _i = 2; _i < arguments.length; _i++) {
8
- args[_i - 2] = arguments[_i];
9
- }
10
- return __awaiter(void 0, void 0, void 0, function () {
11
- return __generator(this, function (_a) {
12
- switch (_a.label) {
13
- case 0: return [4, client.send.apply(client, __spreadArray([new ListEndpointsByPlatformApplicationCommand(input)], __read(args), false))];
14
- case 1: return [2, _a.sent()];
15
- }
16
- });
17
- });
4
+ const makePagedClientRequest = async (client, input, ...args) => {
5
+ return await client.send(new ListEndpointsByPlatformApplicationCommand(input), ...args);
18
6
  };
19
- var makePagedRequest = function (client, input) {
20
- var args = [];
21
- for (var _i = 2; _i < arguments.length; _i++) {
22
- args[_i - 2] = arguments[_i];
23
- }
24
- return __awaiter(void 0, void 0, void 0, function () {
25
- return __generator(this, function (_a) {
26
- switch (_a.label) {
27
- case 0: return [4, client.listEndpointsByPlatformApplication.apply(client, __spreadArray([input], __read(args), false))];
28
- case 1: return [2, _a.sent()];
29
- }
30
- });
31
- });
7
+ const makePagedRequest = async (client, input, ...args) => {
8
+ return await client.listEndpointsByPlatformApplication(input, ...args);
32
9
  };
33
- export function paginateListEndpointsByPlatformApplication(config, input) {
34
- var additionalArguments = [];
35
- for (var _i = 2; _i < arguments.length; _i++) {
36
- additionalArguments[_i - 2] = arguments[_i];
10
+ export async function* paginateListEndpointsByPlatformApplication(config, input, ...additionalArguments) {
11
+ let token = config.startingToken || undefined;
12
+ let hasNext = true;
13
+ let page;
14
+ while (hasNext) {
15
+ input.NextToken = token;
16
+ if (config.client instanceof SNS) {
17
+ page = await makePagedRequest(config.client, input, ...additionalArguments);
18
+ }
19
+ else if (config.client instanceof SNSClient) {
20
+ page = await makePagedClientRequest(config.client, input, ...additionalArguments);
21
+ }
22
+ else {
23
+ throw new Error("Invalid client, expected SNS | SNSClient");
24
+ }
25
+ yield page;
26
+ const prevToken = token;
27
+ token = page.NextToken;
28
+ hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
37
29
  }
38
- return __asyncGenerator(this, arguments, function paginateListEndpointsByPlatformApplication_1() {
39
- var token, hasNext, page, prevToken;
40
- return __generator(this, function (_a) {
41
- switch (_a.label) {
42
- case 0:
43
- token = config.startingToken || undefined;
44
- hasNext = true;
45
- _a.label = 1;
46
- case 1:
47
- if (!hasNext) return [3, 9];
48
- input.NextToken = token;
49
- if (!(config.client instanceof SNS)) return [3, 3];
50
- return [4, __await(makePagedRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
51
- case 2:
52
- page = _a.sent();
53
- return [3, 6];
54
- case 3:
55
- if (!(config.client instanceof SNSClient)) return [3, 5];
56
- return [4, __await(makePagedClientRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
57
- case 4:
58
- page = _a.sent();
59
- return [3, 6];
60
- case 5: throw new Error("Invalid client, expected SNS | SNSClient");
61
- case 6: return [4, __await(page)];
62
- case 7: return [4, _a.sent()];
63
- case 8:
64
- _a.sent();
65
- prevToken = token;
66
- token = page.NextToken;
67
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
68
- return [3, 1];
69
- case 9: return [4, __await(undefined)];
70
- case 10: return [2, _a.sent()];
71
- }
72
- });
73
- });
30
+ return undefined;
74
31
  }
@@ -1,75 +1,32 @@
1
- import { __asyncGenerator, __await, __awaiter, __generator, __read, __spreadArray } from "tslib";
2
1
  import { ListOriginationNumbersCommand, } from "../commands/ListOriginationNumbersCommand";
3
2
  import { SNS } from "../SNS";
4
3
  import { SNSClient } from "../SNSClient";
5
- var makePagedClientRequest = function (client, input) {
6
- var args = [];
7
- for (var _i = 2; _i < arguments.length; _i++) {
8
- args[_i - 2] = arguments[_i];
9
- }
10
- return __awaiter(void 0, void 0, void 0, function () {
11
- return __generator(this, function (_a) {
12
- switch (_a.label) {
13
- case 0: return [4, client.send.apply(client, __spreadArray([new ListOriginationNumbersCommand(input)], __read(args), false))];
14
- case 1: return [2, _a.sent()];
15
- }
16
- });
17
- });
4
+ const makePagedClientRequest = async (client, input, ...args) => {
5
+ return await client.send(new ListOriginationNumbersCommand(input), ...args);
18
6
  };
19
- var makePagedRequest = function (client, input) {
20
- var args = [];
21
- for (var _i = 2; _i < arguments.length; _i++) {
22
- args[_i - 2] = arguments[_i];
23
- }
24
- return __awaiter(void 0, void 0, void 0, function () {
25
- return __generator(this, function (_a) {
26
- switch (_a.label) {
27
- case 0: return [4, client.listOriginationNumbers.apply(client, __spreadArray([input], __read(args), false))];
28
- case 1: return [2, _a.sent()];
29
- }
30
- });
31
- });
7
+ const makePagedRequest = async (client, input, ...args) => {
8
+ return await client.listOriginationNumbers(input, ...args);
32
9
  };
33
- export function paginateListOriginationNumbers(config, input) {
34
- var additionalArguments = [];
35
- for (var _i = 2; _i < arguments.length; _i++) {
36
- additionalArguments[_i - 2] = arguments[_i];
10
+ export async function* paginateListOriginationNumbers(config, input, ...additionalArguments) {
11
+ let token = config.startingToken || undefined;
12
+ let hasNext = true;
13
+ let page;
14
+ while (hasNext) {
15
+ input.NextToken = token;
16
+ input["MaxResults"] = config.pageSize;
17
+ if (config.client instanceof SNS) {
18
+ page = await makePagedRequest(config.client, input, ...additionalArguments);
19
+ }
20
+ else if (config.client instanceof SNSClient) {
21
+ page = await makePagedClientRequest(config.client, input, ...additionalArguments);
22
+ }
23
+ else {
24
+ throw new Error("Invalid client, expected SNS | SNSClient");
25
+ }
26
+ yield page;
27
+ const prevToken = token;
28
+ token = page.NextToken;
29
+ hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
37
30
  }
38
- return __asyncGenerator(this, arguments, function paginateListOriginationNumbers_1() {
39
- var token, hasNext, page, prevToken;
40
- return __generator(this, function (_a) {
41
- switch (_a.label) {
42
- case 0:
43
- token = config.startingToken || undefined;
44
- hasNext = true;
45
- _a.label = 1;
46
- case 1:
47
- if (!hasNext) return [3, 9];
48
- input.NextToken = token;
49
- input["MaxResults"] = config.pageSize;
50
- if (!(config.client instanceof SNS)) return [3, 3];
51
- return [4, __await(makePagedRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
52
- case 2:
53
- page = _a.sent();
54
- return [3, 6];
55
- case 3:
56
- if (!(config.client instanceof SNSClient)) return [3, 5];
57
- return [4, __await(makePagedClientRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
58
- case 4:
59
- page = _a.sent();
60
- return [3, 6];
61
- case 5: throw new Error("Invalid client, expected SNS | SNSClient");
62
- case 6: return [4, __await(page)];
63
- case 7: return [4, _a.sent()];
64
- case 8:
65
- _a.sent();
66
- prevToken = token;
67
- token = page.NextToken;
68
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
69
- return [3, 1];
70
- case 9: return [4, __await(undefined)];
71
- case 10: return [2, _a.sent()];
72
- }
73
- });
74
- });
31
+ return undefined;
75
32
  }
@@ -1,74 +1,31 @@
1
- import { __asyncGenerator, __await, __awaiter, __generator, __read, __spreadArray } from "tslib";
2
1
  import { ListPhoneNumbersOptedOutCommand, } from "../commands/ListPhoneNumbersOptedOutCommand";
3
2
  import { SNS } from "../SNS";
4
3
  import { SNSClient } from "../SNSClient";
5
- var makePagedClientRequest = function (client, input) {
6
- var args = [];
7
- for (var _i = 2; _i < arguments.length; _i++) {
8
- args[_i - 2] = arguments[_i];
9
- }
10
- return __awaiter(void 0, void 0, void 0, function () {
11
- return __generator(this, function (_a) {
12
- switch (_a.label) {
13
- case 0: return [4, client.send.apply(client, __spreadArray([new ListPhoneNumbersOptedOutCommand(input)], __read(args), false))];
14
- case 1: return [2, _a.sent()];
15
- }
16
- });
17
- });
4
+ const makePagedClientRequest = async (client, input, ...args) => {
5
+ return await client.send(new ListPhoneNumbersOptedOutCommand(input), ...args);
18
6
  };
19
- var makePagedRequest = function (client, input) {
20
- var args = [];
21
- for (var _i = 2; _i < arguments.length; _i++) {
22
- args[_i - 2] = arguments[_i];
23
- }
24
- return __awaiter(void 0, void 0, void 0, function () {
25
- return __generator(this, function (_a) {
26
- switch (_a.label) {
27
- case 0: return [4, client.listPhoneNumbersOptedOut.apply(client, __spreadArray([input], __read(args), false))];
28
- case 1: return [2, _a.sent()];
29
- }
30
- });
31
- });
7
+ const makePagedRequest = async (client, input, ...args) => {
8
+ return await client.listPhoneNumbersOptedOut(input, ...args);
32
9
  };
33
- export function paginateListPhoneNumbersOptedOut(config, input) {
34
- var additionalArguments = [];
35
- for (var _i = 2; _i < arguments.length; _i++) {
36
- additionalArguments[_i - 2] = arguments[_i];
10
+ export async function* paginateListPhoneNumbersOptedOut(config, input, ...additionalArguments) {
11
+ let token = config.startingToken || undefined;
12
+ let hasNext = true;
13
+ let page;
14
+ while (hasNext) {
15
+ input.nextToken = token;
16
+ if (config.client instanceof SNS) {
17
+ page = await makePagedRequest(config.client, input, ...additionalArguments);
18
+ }
19
+ else if (config.client instanceof SNSClient) {
20
+ page = await makePagedClientRequest(config.client, input, ...additionalArguments);
21
+ }
22
+ else {
23
+ throw new Error("Invalid client, expected SNS | SNSClient");
24
+ }
25
+ yield page;
26
+ const prevToken = token;
27
+ token = page.nextToken;
28
+ hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
37
29
  }
38
- return __asyncGenerator(this, arguments, function paginateListPhoneNumbersOptedOut_1() {
39
- var token, hasNext, page, prevToken;
40
- return __generator(this, function (_a) {
41
- switch (_a.label) {
42
- case 0:
43
- token = config.startingToken || undefined;
44
- hasNext = true;
45
- _a.label = 1;
46
- case 1:
47
- if (!hasNext) return [3, 9];
48
- input.nextToken = token;
49
- if (!(config.client instanceof SNS)) return [3, 3];
50
- return [4, __await(makePagedRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
51
- case 2:
52
- page = _a.sent();
53
- return [3, 6];
54
- case 3:
55
- if (!(config.client instanceof SNSClient)) return [3, 5];
56
- return [4, __await(makePagedClientRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
57
- case 4:
58
- page = _a.sent();
59
- return [3, 6];
60
- case 5: throw new Error("Invalid client, expected SNS | SNSClient");
61
- case 6: return [4, __await(page)];
62
- case 7: return [4, _a.sent()];
63
- case 8:
64
- _a.sent();
65
- prevToken = token;
66
- token = page.nextToken;
67
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
68
- return [3, 1];
69
- case 9: return [4, __await(undefined)];
70
- case 10: return [2, _a.sent()];
71
- }
72
- });
73
- });
30
+ return undefined;
74
31
  }
@@ -1,74 +1,31 @@
1
- import { __asyncGenerator, __await, __awaiter, __generator, __read, __spreadArray } from "tslib";
2
1
  import { ListPlatformApplicationsCommand, } from "../commands/ListPlatformApplicationsCommand";
3
2
  import { SNS } from "../SNS";
4
3
  import { SNSClient } from "../SNSClient";
5
- var makePagedClientRequest = function (client, input) {
6
- var args = [];
7
- for (var _i = 2; _i < arguments.length; _i++) {
8
- args[_i - 2] = arguments[_i];
9
- }
10
- return __awaiter(void 0, void 0, void 0, function () {
11
- return __generator(this, function (_a) {
12
- switch (_a.label) {
13
- case 0: return [4, client.send.apply(client, __spreadArray([new ListPlatformApplicationsCommand(input)], __read(args), false))];
14
- case 1: return [2, _a.sent()];
15
- }
16
- });
17
- });
4
+ const makePagedClientRequest = async (client, input, ...args) => {
5
+ return await client.send(new ListPlatformApplicationsCommand(input), ...args);
18
6
  };
19
- var makePagedRequest = function (client, input) {
20
- var args = [];
21
- for (var _i = 2; _i < arguments.length; _i++) {
22
- args[_i - 2] = arguments[_i];
23
- }
24
- return __awaiter(void 0, void 0, void 0, function () {
25
- return __generator(this, function (_a) {
26
- switch (_a.label) {
27
- case 0: return [4, client.listPlatformApplications.apply(client, __spreadArray([input], __read(args), false))];
28
- case 1: return [2, _a.sent()];
29
- }
30
- });
31
- });
7
+ const makePagedRequest = async (client, input, ...args) => {
8
+ return await client.listPlatformApplications(input, ...args);
32
9
  };
33
- export function paginateListPlatformApplications(config, input) {
34
- var additionalArguments = [];
35
- for (var _i = 2; _i < arguments.length; _i++) {
36
- additionalArguments[_i - 2] = arguments[_i];
10
+ export async function* paginateListPlatformApplications(config, input, ...additionalArguments) {
11
+ let token = config.startingToken || undefined;
12
+ let hasNext = true;
13
+ let page;
14
+ while (hasNext) {
15
+ input.NextToken = token;
16
+ if (config.client instanceof SNS) {
17
+ page = await makePagedRequest(config.client, input, ...additionalArguments);
18
+ }
19
+ else if (config.client instanceof SNSClient) {
20
+ page = await makePagedClientRequest(config.client, input, ...additionalArguments);
21
+ }
22
+ else {
23
+ throw new Error("Invalid client, expected SNS | SNSClient");
24
+ }
25
+ yield page;
26
+ const prevToken = token;
27
+ token = page.NextToken;
28
+ hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
37
29
  }
38
- return __asyncGenerator(this, arguments, function paginateListPlatformApplications_1() {
39
- var token, hasNext, page, prevToken;
40
- return __generator(this, function (_a) {
41
- switch (_a.label) {
42
- case 0:
43
- token = config.startingToken || undefined;
44
- hasNext = true;
45
- _a.label = 1;
46
- case 1:
47
- if (!hasNext) return [3, 9];
48
- input.NextToken = token;
49
- if (!(config.client instanceof SNS)) return [3, 3];
50
- return [4, __await(makePagedRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
51
- case 2:
52
- page = _a.sent();
53
- return [3, 6];
54
- case 3:
55
- if (!(config.client instanceof SNSClient)) return [3, 5];
56
- return [4, __await(makePagedClientRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
57
- case 4:
58
- page = _a.sent();
59
- return [3, 6];
60
- case 5: throw new Error("Invalid client, expected SNS | SNSClient");
61
- case 6: return [4, __await(page)];
62
- case 7: return [4, _a.sent()];
63
- case 8:
64
- _a.sent();
65
- prevToken = token;
66
- token = page.NextToken;
67
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
68
- return [3, 1];
69
- case 9: return [4, __await(undefined)];
70
- case 10: return [2, _a.sent()];
71
- }
72
- });
73
- });
30
+ return undefined;
74
31
  }
@@ -1,75 +1,32 @@
1
- import { __asyncGenerator, __await, __awaiter, __generator, __read, __spreadArray } from "tslib";
2
1
  import { ListSMSSandboxPhoneNumbersCommand, } from "../commands/ListSMSSandboxPhoneNumbersCommand";
3
2
  import { SNS } from "../SNS";
4
3
  import { SNSClient } from "../SNSClient";
5
- var makePagedClientRequest = function (client, input) {
6
- var args = [];
7
- for (var _i = 2; _i < arguments.length; _i++) {
8
- args[_i - 2] = arguments[_i];
9
- }
10
- return __awaiter(void 0, void 0, void 0, function () {
11
- return __generator(this, function (_a) {
12
- switch (_a.label) {
13
- case 0: return [4, client.send.apply(client, __spreadArray([new ListSMSSandboxPhoneNumbersCommand(input)], __read(args), false))];
14
- case 1: return [2, _a.sent()];
15
- }
16
- });
17
- });
4
+ const makePagedClientRequest = async (client, input, ...args) => {
5
+ return await client.send(new ListSMSSandboxPhoneNumbersCommand(input), ...args);
18
6
  };
19
- var makePagedRequest = function (client, input) {
20
- var args = [];
21
- for (var _i = 2; _i < arguments.length; _i++) {
22
- args[_i - 2] = arguments[_i];
23
- }
24
- return __awaiter(void 0, void 0, void 0, function () {
25
- return __generator(this, function (_a) {
26
- switch (_a.label) {
27
- case 0: return [4, client.listSMSSandboxPhoneNumbers.apply(client, __spreadArray([input], __read(args), false))];
28
- case 1: return [2, _a.sent()];
29
- }
30
- });
31
- });
7
+ const makePagedRequest = async (client, input, ...args) => {
8
+ return await client.listSMSSandboxPhoneNumbers(input, ...args);
32
9
  };
33
- export function paginateListSMSSandboxPhoneNumbers(config, input) {
34
- var additionalArguments = [];
35
- for (var _i = 2; _i < arguments.length; _i++) {
36
- additionalArguments[_i - 2] = arguments[_i];
10
+ export async function* paginateListSMSSandboxPhoneNumbers(config, input, ...additionalArguments) {
11
+ let token = config.startingToken || undefined;
12
+ let hasNext = true;
13
+ let page;
14
+ while (hasNext) {
15
+ input.NextToken = token;
16
+ input["MaxResults"] = config.pageSize;
17
+ if (config.client instanceof SNS) {
18
+ page = await makePagedRequest(config.client, input, ...additionalArguments);
19
+ }
20
+ else if (config.client instanceof SNSClient) {
21
+ page = await makePagedClientRequest(config.client, input, ...additionalArguments);
22
+ }
23
+ else {
24
+ throw new Error("Invalid client, expected SNS | SNSClient");
25
+ }
26
+ yield page;
27
+ const prevToken = token;
28
+ token = page.NextToken;
29
+ hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
37
30
  }
38
- return __asyncGenerator(this, arguments, function paginateListSMSSandboxPhoneNumbers_1() {
39
- var token, hasNext, page, prevToken;
40
- return __generator(this, function (_a) {
41
- switch (_a.label) {
42
- case 0:
43
- token = config.startingToken || undefined;
44
- hasNext = true;
45
- _a.label = 1;
46
- case 1:
47
- if (!hasNext) return [3, 9];
48
- input.NextToken = token;
49
- input["MaxResults"] = config.pageSize;
50
- if (!(config.client instanceof SNS)) return [3, 3];
51
- return [4, __await(makePagedRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
52
- case 2:
53
- page = _a.sent();
54
- return [3, 6];
55
- case 3:
56
- if (!(config.client instanceof SNSClient)) return [3, 5];
57
- return [4, __await(makePagedClientRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
58
- case 4:
59
- page = _a.sent();
60
- return [3, 6];
61
- case 5: throw new Error("Invalid client, expected SNS | SNSClient");
62
- case 6: return [4, __await(page)];
63
- case 7: return [4, _a.sent()];
64
- case 8:
65
- _a.sent();
66
- prevToken = token;
67
- token = page.NextToken;
68
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
69
- return [3, 1];
70
- case 9: return [4, __await(undefined)];
71
- case 10: return [2, _a.sent()];
72
- }
73
- });
74
- });
31
+ return undefined;
75
32
  }
@@ -1,74 +1,31 @@
1
- import { __asyncGenerator, __await, __awaiter, __generator, __read, __spreadArray } from "tslib";
2
1
  import { ListSubscriptionsByTopicCommand, } from "../commands/ListSubscriptionsByTopicCommand";
3
2
  import { SNS } from "../SNS";
4
3
  import { SNSClient } from "../SNSClient";
5
- var makePagedClientRequest = function (client, input) {
6
- var args = [];
7
- for (var _i = 2; _i < arguments.length; _i++) {
8
- args[_i - 2] = arguments[_i];
9
- }
10
- return __awaiter(void 0, void 0, void 0, function () {
11
- return __generator(this, function (_a) {
12
- switch (_a.label) {
13
- case 0: return [4, client.send.apply(client, __spreadArray([new ListSubscriptionsByTopicCommand(input)], __read(args), false))];
14
- case 1: return [2, _a.sent()];
15
- }
16
- });
17
- });
4
+ const makePagedClientRequest = async (client, input, ...args) => {
5
+ return await client.send(new ListSubscriptionsByTopicCommand(input), ...args);
18
6
  };
19
- var makePagedRequest = function (client, input) {
20
- var args = [];
21
- for (var _i = 2; _i < arguments.length; _i++) {
22
- args[_i - 2] = arguments[_i];
23
- }
24
- return __awaiter(void 0, void 0, void 0, function () {
25
- return __generator(this, function (_a) {
26
- switch (_a.label) {
27
- case 0: return [4, client.listSubscriptionsByTopic.apply(client, __spreadArray([input], __read(args), false))];
28
- case 1: return [2, _a.sent()];
29
- }
30
- });
31
- });
7
+ const makePagedRequest = async (client, input, ...args) => {
8
+ return await client.listSubscriptionsByTopic(input, ...args);
32
9
  };
33
- export function paginateListSubscriptionsByTopic(config, input) {
34
- var additionalArguments = [];
35
- for (var _i = 2; _i < arguments.length; _i++) {
36
- additionalArguments[_i - 2] = arguments[_i];
10
+ export async function* paginateListSubscriptionsByTopic(config, input, ...additionalArguments) {
11
+ let token = config.startingToken || undefined;
12
+ let hasNext = true;
13
+ let page;
14
+ while (hasNext) {
15
+ input.NextToken = token;
16
+ if (config.client instanceof SNS) {
17
+ page = await makePagedRequest(config.client, input, ...additionalArguments);
18
+ }
19
+ else if (config.client instanceof SNSClient) {
20
+ page = await makePagedClientRequest(config.client, input, ...additionalArguments);
21
+ }
22
+ else {
23
+ throw new Error("Invalid client, expected SNS | SNSClient");
24
+ }
25
+ yield page;
26
+ const prevToken = token;
27
+ token = page.NextToken;
28
+ hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
37
29
  }
38
- return __asyncGenerator(this, arguments, function paginateListSubscriptionsByTopic_1() {
39
- var token, hasNext, page, prevToken;
40
- return __generator(this, function (_a) {
41
- switch (_a.label) {
42
- case 0:
43
- token = config.startingToken || undefined;
44
- hasNext = true;
45
- _a.label = 1;
46
- case 1:
47
- if (!hasNext) return [3, 9];
48
- input.NextToken = token;
49
- if (!(config.client instanceof SNS)) return [3, 3];
50
- return [4, __await(makePagedRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
51
- case 2:
52
- page = _a.sent();
53
- return [3, 6];
54
- case 3:
55
- if (!(config.client instanceof SNSClient)) return [3, 5];
56
- return [4, __await(makePagedClientRequest.apply(void 0, __spreadArray([config.client, input], __read(additionalArguments), false)))];
57
- case 4:
58
- page = _a.sent();
59
- return [3, 6];
60
- case 5: throw new Error("Invalid client, expected SNS | SNSClient");
61
- case 6: return [4, __await(page)];
62
- case 7: return [4, _a.sent()];
63
- case 8:
64
- _a.sent();
65
- prevToken = token;
66
- token = page.NextToken;
67
- hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
68
- return [3, 1];
69
- case 9: return [4, __await(undefined)];
70
- case 10: return [2, _a.sent()];
71
- }
72
- });
73
- });
30
+ return undefined;
74
31
  }