@sparkrewards/sra-sdk 0.0.1

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 (106) hide show
  1. package/LICENSE +201 -0
  2. package/dist-cjs/index.js +8 -0
  3. package/dist-cjs/models/index.js +4 -0
  4. package/dist-cjs/models/models_0.js +1901 -0
  5. package/dist-cjs/openapi.js +7 -0
  6. package/dist-cjs/openapi.json +2864 -0
  7. package/dist-cjs/protocols/Aws_restJson1.js +2939 -0
  8. package/dist-cjs/server/AppAPIService.js +371 -0
  9. package/dist-cjs/server/index.js +5 -0
  10. package/dist-cjs/server/operations/DeleteUser.js +121 -0
  11. package/dist-cjs/server/operations/FavoritePlans.js +125 -0
  12. package/dist-cjs/server/operations/FavoriteShops.js +122 -0
  13. package/dist-cjs/server/operations/GetShop.js +126 -0
  14. package/dist-cjs/server/operations/GetShopPublic.js +127 -0
  15. package/dist-cjs/server/operations/GetUser.js +121 -0
  16. package/dist-cjs/server/operations/LikeOrg.js +124 -0
  17. package/dist-cjs/server/operations/NearbyShops.js +121 -0
  18. package/dist-cjs/server/operations/NearbyShopsPublic.js +122 -0
  19. package/dist-cjs/server/operations/NearestShop.js +126 -0
  20. package/dist-cjs/server/operations/OnboardUser.js +122 -0
  21. package/dist-cjs/server/operations/PinnedShop.js +126 -0
  22. package/dist-cjs/server/operations/PinnedShopPublic.js +127 -0
  23. package/dist-cjs/server/operations/Plan.js +123 -0
  24. package/dist-cjs/server/operations/PlanPublic.js +124 -0
  25. package/dist-cjs/server/operations/Plans.js +124 -0
  26. package/dist-cjs/server/operations/PopularShops.js +122 -0
  27. package/dist-cjs/server/operations/PopularShopsPublic.js +123 -0
  28. package/dist-cjs/server/operations/RadiusShops.js +123 -0
  29. package/dist-cjs/server/operations/RecordVisit.js +129 -0
  30. package/dist-cjs/server/operations/RedeemFirstTimeReward.js +125 -0
  31. package/dist-cjs/server/operations/RedeemPointReward.js +126 -0
  32. package/dist-cjs/server/operations/RedeemVisitReward.js +125 -0
  33. package/dist-cjs/server/operations/SearchShopsPublic.js +125 -0
  34. package/dist-cjs/server/operations/SearchSuggestion.js +126 -0
  35. package/dist-cjs/server/operations/UpdateUser.js +121 -0
  36. package/dist-cjs/server/operations/index.js +29 -0
  37. package/dist-es/index.js +4 -0
  38. package/dist-es/models/index.js +1 -0
  39. package/dist-es/models/models_0.js +1893 -0
  40. package/dist-es/openapi.js +3 -0
  41. package/dist-es/openapi.json +2864 -0
  42. package/dist-es/protocols/Aws_restJson1.js +2878 -0
  43. package/dist-es/server/AppAPIService.js +366 -0
  44. package/dist-es/server/index.js +2 -0
  45. package/dist-es/server/operations/DeleteUser.js +115 -0
  46. package/dist-es/server/operations/FavoritePlans.js +119 -0
  47. package/dist-es/server/operations/FavoriteShops.js +116 -0
  48. package/dist-es/server/operations/GetShop.js +120 -0
  49. package/dist-es/server/operations/GetShopPublic.js +121 -0
  50. package/dist-es/server/operations/GetUser.js +115 -0
  51. package/dist-es/server/operations/LikeOrg.js +118 -0
  52. package/dist-es/server/operations/NearbyShops.js +115 -0
  53. package/dist-es/server/operations/NearbyShopsPublic.js +116 -0
  54. package/dist-es/server/operations/NearestShop.js +120 -0
  55. package/dist-es/server/operations/OnboardUser.js +116 -0
  56. package/dist-es/server/operations/PinnedShop.js +120 -0
  57. package/dist-es/server/operations/PinnedShopPublic.js +121 -0
  58. package/dist-es/server/operations/Plan.js +117 -0
  59. package/dist-es/server/operations/PlanPublic.js +118 -0
  60. package/dist-es/server/operations/Plans.js +118 -0
  61. package/dist-es/server/operations/PopularShops.js +116 -0
  62. package/dist-es/server/operations/PopularShopsPublic.js +117 -0
  63. package/dist-es/server/operations/RadiusShops.js +117 -0
  64. package/dist-es/server/operations/RecordVisit.js +123 -0
  65. package/dist-es/server/operations/RedeemFirstTimeReward.js +119 -0
  66. package/dist-es/server/operations/RedeemPointReward.js +120 -0
  67. package/dist-es/server/operations/RedeemVisitReward.js +119 -0
  68. package/dist-es/server/operations/SearchShopsPublic.js +119 -0
  69. package/dist-es/server/operations/SearchSuggestion.js +120 -0
  70. package/dist-es/server/operations/UpdateUser.js +115 -0
  71. package/dist-es/server/operations/index.js +26 -0
  72. package/dist-types/index.d.ts +9 -0
  73. package/dist-types/models/index.d.ts +1 -0
  74. package/dist-types/models/models_0.d.ts +832 -0
  75. package/dist-types/openapi.d.ts +7 -0
  76. package/dist-types/protocols/Aws_restJson1.d.ts +87 -0
  77. package/dist-types/server/AppAPIService.d.ts +76 -0
  78. package/dist-types/server/index.d.ts +2 -0
  79. package/dist-types/server/operations/DeleteUser.d.ts +41 -0
  80. package/dist-types/server/operations/FavoritePlans.d.ts +41 -0
  81. package/dist-types/server/operations/FavoriteShops.d.ts +41 -0
  82. package/dist-types/server/operations/GetShop.d.ts +41 -0
  83. package/dist-types/server/operations/GetShopPublic.d.ts +41 -0
  84. package/dist-types/server/operations/GetUser.d.ts +41 -0
  85. package/dist-types/server/operations/LikeOrg.d.ts +41 -0
  86. package/dist-types/server/operations/NearbyShops.d.ts +41 -0
  87. package/dist-types/server/operations/NearbyShopsPublic.d.ts +41 -0
  88. package/dist-types/server/operations/NearestShop.d.ts +41 -0
  89. package/dist-types/server/operations/OnboardUser.d.ts +41 -0
  90. package/dist-types/server/operations/PinnedShop.d.ts +41 -0
  91. package/dist-types/server/operations/PinnedShopPublic.d.ts +41 -0
  92. package/dist-types/server/operations/Plan.d.ts +41 -0
  93. package/dist-types/server/operations/PlanPublic.d.ts +41 -0
  94. package/dist-types/server/operations/Plans.d.ts +41 -0
  95. package/dist-types/server/operations/PopularShops.d.ts +41 -0
  96. package/dist-types/server/operations/PopularShopsPublic.d.ts +41 -0
  97. package/dist-types/server/operations/RadiusShops.d.ts +41 -0
  98. package/dist-types/server/operations/RecordVisit.d.ts +41 -0
  99. package/dist-types/server/operations/RedeemFirstTimeReward.d.ts +41 -0
  100. package/dist-types/server/operations/RedeemPointReward.d.ts +41 -0
  101. package/dist-types/server/operations/RedeemVisitReward.d.ts +41 -0
  102. package/dist-types/server/operations/SearchShopsPublic.d.ts +41 -0
  103. package/dist-types/server/operations/SearchSuggestion.d.ts +41 -0
  104. package/dist-types/server/operations/UpdateUser.d.ts +41 -0
  105. package/dist-types/server/operations/index.d.ts +26 -0
  106. package/package.json +66 -0
@@ -0,0 +1,119 @@
1
+ import { RedeemVisitRewardInput, } from "../../models/models_0";
2
+ import { deserializeRedeemVisitRewardRequest, serializeFrameworkException, serializeRedeemVisitRewardResponse, serializeRuntimeErrorError, serializeValidationExceptionError, } from "../../protocols/Aws_restJson1";
3
+ import { InternalFailureException as __InternalFailureException, SerializationException as __SerializationException, generateValidationMessage as __generateValidationMessage, generateValidationSummary as __generateValidationSummary, isFrameworkException as __isFrameworkException, httpbinding, } from "@aws-smithy/server-common";
4
+ import { NodeHttpHandler, streamCollector, } from "@smithy/node-http-handler";
5
+ import { fromBase64, toBase64, } from "@smithy/util-base64";
6
+ import { fromUtf8, toUtf8, } from "@smithy/util-utf8";
7
+ export var RedeemVisitRewardServerInput;
8
+ (function (RedeemVisitRewardServerInput) {
9
+ RedeemVisitRewardServerInput.validate = RedeemVisitRewardInput.validate;
10
+ })(RedeemVisitRewardServerInput || (RedeemVisitRewardServerInput = {}));
11
+ export class RedeemVisitRewardSerializer {
12
+ constructor() {
13
+ this.serialize = serializeRedeemVisitRewardResponse;
14
+ this.deserialize = deserializeRedeemVisitRewardRequest;
15
+ }
16
+ isOperationError(error) {
17
+ const names = ["ValidationException", "RuntimeError"];
18
+ return names.includes(error.name);
19
+ }
20
+ ;
21
+ serializeError(error, ctx) {
22
+ switch (error.name) {
23
+ case "ValidationException": {
24
+ return serializeValidationExceptionError(error, ctx);
25
+ }
26
+ case "RuntimeError": {
27
+ return serializeRuntimeErrorError(error, ctx);
28
+ }
29
+ default: {
30
+ throw error;
31
+ }
32
+ }
33
+ }
34
+ }
35
+ export const getRedeemVisitRewardHandler = (operation) => {
36
+ const mux = new httpbinding.HttpBindingMux([
37
+ new httpbinding.UriSpec('PUT', [
38
+ { type: 'path_literal', value: "rewards" },
39
+ { type: 'path_literal', value: "redeem" },
40
+ { type: 'path_literal', value: "visit" },
41
+ ], [
42
+ { type: 'query', key: "reward_id" },
43
+ ], { service: "AppAPI", operation: "RedeemVisitReward" }),
44
+ ]);
45
+ const customizer = (ctx, failures) => {
46
+ if (!failures) {
47
+ return undefined;
48
+ }
49
+ return {
50
+ name: "ValidationException",
51
+ $fault: "client",
52
+ message: __generateValidationSummary(failures),
53
+ fieldList: failures.map(failure => ({
54
+ path: failure.path,
55
+ message: __generateValidationMessage(failure)
56
+ }))
57
+ };
58
+ };
59
+ return new RedeemVisitRewardHandler(operation, mux, new RedeemVisitRewardSerializer(), serializeFrameworkException, customizer);
60
+ };
61
+ const serdeContextBase = {
62
+ base64Encoder: toBase64,
63
+ base64Decoder: fromBase64,
64
+ utf8Encoder: toUtf8,
65
+ utf8Decoder: fromUtf8,
66
+ streamCollector: streamCollector,
67
+ requestHandler: new NodeHttpHandler(),
68
+ disableHostPrefix: true
69
+ };
70
+ async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
71
+ let input;
72
+ try {
73
+ input = await serializer.deserialize(request, {
74
+ endpoint: () => Promise.resolve(request), ...serdeContextBase
75
+ });
76
+ }
77
+ catch (error) {
78
+ if (__isFrameworkException(error)) {
79
+ return serializeFrameworkException(error, serdeContextBase);
80
+ }
81
+ ;
82
+ return serializeFrameworkException(new __SerializationException(), serdeContextBase);
83
+ }
84
+ try {
85
+ let validationFailures = validationFn(input);
86
+ if (validationFailures && validationFailures.length > 0) {
87
+ let validationException = validationCustomizer({ operation: operationName }, validationFailures);
88
+ if (validationException) {
89
+ return serializer.serializeError(validationException, serdeContextBase);
90
+ }
91
+ }
92
+ let output = await operation(input, context);
93
+ return serializer.serialize(output, serdeContextBase);
94
+ }
95
+ catch (error) {
96
+ if (serializer.isOperationError(error)) {
97
+ return serializer.serializeError(error, serdeContextBase);
98
+ }
99
+ console.log('Received an unexpected error', error);
100
+ return serializeFrameworkException(new __InternalFailureException(), serdeContextBase);
101
+ }
102
+ }
103
+ export class RedeemVisitRewardHandler {
104
+ constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
105
+ this.operation = operation;
106
+ this.mux = mux;
107
+ this.serializer = serializer;
108
+ this.serializeFrameworkException = serializeFrameworkException;
109
+ this.validationCustomizer = validationCustomizer;
110
+ }
111
+ async handle(request, context) {
112
+ const target = this.mux.match(request);
113
+ if (target === undefined) {
114
+ console.log('Received a request that did not match software.amazon.smithy.app#AppAPI.RedeemVisitReward. This indicates a misconfiguration.');
115
+ return this.serializeFrameworkException(new __InternalFailureException(), serdeContextBase);
116
+ }
117
+ return handle(request, context, "RedeemVisitReward", this.serializer, this.operation, this.serializeFrameworkException, RedeemVisitRewardServerInput.validate, this.validationCustomizer);
118
+ }
119
+ }
@@ -0,0 +1,119 @@
1
+ import { SearchShopsInput, } from "../../models/models_0";
2
+ import { deserializeSearchShopsPublicRequest, serializeFrameworkException, serializeRuntimeErrorError, serializeSearchShopsPublicResponse, serializeValidationExceptionError, } from "../../protocols/Aws_restJson1";
3
+ import { InternalFailureException as __InternalFailureException, SerializationException as __SerializationException, generateValidationMessage as __generateValidationMessage, generateValidationSummary as __generateValidationSummary, isFrameworkException as __isFrameworkException, httpbinding, } from "@aws-smithy/server-common";
4
+ import { NodeHttpHandler, streamCollector, } from "@smithy/node-http-handler";
5
+ import { fromBase64, toBase64, } from "@smithy/util-base64";
6
+ import { fromUtf8, toUtf8, } from "@smithy/util-utf8";
7
+ export var SearchShopsPublicServerInput;
8
+ (function (SearchShopsPublicServerInput) {
9
+ SearchShopsPublicServerInput.validate = SearchShopsInput.validate;
10
+ })(SearchShopsPublicServerInput || (SearchShopsPublicServerInput = {}));
11
+ export class SearchShopsPublicSerializer {
12
+ constructor() {
13
+ this.serialize = serializeSearchShopsPublicResponse;
14
+ this.deserialize = deserializeSearchShopsPublicRequest;
15
+ }
16
+ isOperationError(error) {
17
+ const names = ["ValidationException", "RuntimeError"];
18
+ return names.includes(error.name);
19
+ }
20
+ ;
21
+ serializeError(error, ctx) {
22
+ switch (error.name) {
23
+ case "ValidationException": {
24
+ return serializeValidationExceptionError(error, ctx);
25
+ }
26
+ case "RuntimeError": {
27
+ return serializeRuntimeErrorError(error, ctx);
28
+ }
29
+ default: {
30
+ throw error;
31
+ }
32
+ }
33
+ }
34
+ }
35
+ export const getSearchShopsPublicHandler = (operation) => {
36
+ const mux = new httpbinding.HttpBindingMux([
37
+ new httpbinding.UriSpec('GET', [
38
+ { type: 'path_literal', value: "public" },
39
+ { type: 'path_literal', value: "shops" },
40
+ { type: 'path_literal', value: "search" },
41
+ ], [
42
+ { type: 'query', key: "q" },
43
+ ], { service: "AppAPI", operation: "SearchShopsPublic" }),
44
+ ]);
45
+ const customizer = (ctx, failures) => {
46
+ if (!failures) {
47
+ return undefined;
48
+ }
49
+ return {
50
+ name: "ValidationException",
51
+ $fault: "client",
52
+ message: __generateValidationSummary(failures),
53
+ fieldList: failures.map(failure => ({
54
+ path: failure.path,
55
+ message: __generateValidationMessage(failure)
56
+ }))
57
+ };
58
+ };
59
+ return new SearchShopsPublicHandler(operation, mux, new SearchShopsPublicSerializer(), serializeFrameworkException, customizer);
60
+ };
61
+ const serdeContextBase = {
62
+ base64Encoder: toBase64,
63
+ base64Decoder: fromBase64,
64
+ utf8Encoder: toUtf8,
65
+ utf8Decoder: fromUtf8,
66
+ streamCollector: streamCollector,
67
+ requestHandler: new NodeHttpHandler(),
68
+ disableHostPrefix: true
69
+ };
70
+ async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
71
+ let input;
72
+ try {
73
+ input = await serializer.deserialize(request, {
74
+ endpoint: () => Promise.resolve(request), ...serdeContextBase
75
+ });
76
+ }
77
+ catch (error) {
78
+ if (__isFrameworkException(error)) {
79
+ return serializeFrameworkException(error, serdeContextBase);
80
+ }
81
+ ;
82
+ return serializeFrameworkException(new __SerializationException(), serdeContextBase);
83
+ }
84
+ try {
85
+ let validationFailures = validationFn(input);
86
+ if (validationFailures && validationFailures.length > 0) {
87
+ let validationException = validationCustomizer({ operation: operationName }, validationFailures);
88
+ if (validationException) {
89
+ return serializer.serializeError(validationException, serdeContextBase);
90
+ }
91
+ }
92
+ let output = await operation(input, context);
93
+ return serializer.serialize(output, serdeContextBase);
94
+ }
95
+ catch (error) {
96
+ if (serializer.isOperationError(error)) {
97
+ return serializer.serializeError(error, serdeContextBase);
98
+ }
99
+ console.log('Received an unexpected error', error);
100
+ return serializeFrameworkException(new __InternalFailureException(), serdeContextBase);
101
+ }
102
+ }
103
+ export class SearchShopsPublicHandler {
104
+ constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
105
+ this.operation = operation;
106
+ this.mux = mux;
107
+ this.serializer = serializer;
108
+ this.serializeFrameworkException = serializeFrameworkException;
109
+ this.validationCustomizer = validationCustomizer;
110
+ }
111
+ async handle(request, context) {
112
+ const target = this.mux.match(request);
113
+ if (target === undefined) {
114
+ console.log('Received a request that did not match software.amazon.smithy.app#AppAPI.SearchShopsPublic. This indicates a misconfiguration.');
115
+ return this.serializeFrameworkException(new __InternalFailureException(), serdeContextBase);
116
+ }
117
+ return handle(request, context, "SearchShopsPublic", this.serializer, this.operation, this.serializeFrameworkException, SearchShopsPublicServerInput.validate, this.validationCustomizer);
118
+ }
119
+ }
@@ -0,0 +1,120 @@
1
+ import { SearchSuggestionInput, } from "../../models/models_0";
2
+ import { deserializeSearchSuggestionRequest, serializeFrameworkException, serializeRuntimeErrorError, serializeSearchSuggestionResponse, serializeValidationExceptionError, } from "../../protocols/Aws_restJson1";
3
+ import { InternalFailureException as __InternalFailureException, SerializationException as __SerializationException, generateValidationMessage as __generateValidationMessage, generateValidationSummary as __generateValidationSummary, isFrameworkException as __isFrameworkException, httpbinding, } from "@aws-smithy/server-common";
4
+ import { NodeHttpHandler, streamCollector, } from "@smithy/node-http-handler";
5
+ import { fromBase64, toBase64, } from "@smithy/util-base64";
6
+ import { fromUtf8, toUtf8, } from "@smithy/util-utf8";
7
+ export var SearchSuggestionServerInput;
8
+ (function (SearchSuggestionServerInput) {
9
+ SearchSuggestionServerInput.validate = SearchSuggestionInput.validate;
10
+ })(SearchSuggestionServerInput || (SearchSuggestionServerInput = {}));
11
+ export class SearchSuggestionSerializer {
12
+ constructor() {
13
+ this.serialize = serializeSearchSuggestionResponse;
14
+ this.deserialize = deserializeSearchSuggestionRequest;
15
+ }
16
+ isOperationError(error) {
17
+ const names = ["ValidationException", "RuntimeError"];
18
+ return names.includes(error.name);
19
+ }
20
+ ;
21
+ serializeError(error, ctx) {
22
+ switch (error.name) {
23
+ case "ValidationException": {
24
+ return serializeValidationExceptionError(error, ctx);
25
+ }
26
+ case "RuntimeError": {
27
+ return serializeRuntimeErrorError(error, ctx);
28
+ }
29
+ default: {
30
+ throw error;
31
+ }
32
+ }
33
+ }
34
+ }
35
+ export const getSearchSuggestionHandler = (operation) => {
36
+ const mux = new httpbinding.HttpBindingMux([
37
+ new httpbinding.UriSpec('GET', [
38
+ { type: 'path_literal', value: "public" },
39
+ { type: 'path_literal', value: "shops" },
40
+ { type: 'path_literal', value: "search" },
41
+ { type: 'path_literal', value: "suggestion" },
42
+ ], [
43
+ { type: 'query', key: "q" },
44
+ ], { service: "AppAPI", operation: "SearchSuggestion" }),
45
+ ]);
46
+ const customizer = (ctx, failures) => {
47
+ if (!failures) {
48
+ return undefined;
49
+ }
50
+ return {
51
+ name: "ValidationException",
52
+ $fault: "client",
53
+ message: __generateValidationSummary(failures),
54
+ fieldList: failures.map(failure => ({
55
+ path: failure.path,
56
+ message: __generateValidationMessage(failure)
57
+ }))
58
+ };
59
+ };
60
+ return new SearchSuggestionHandler(operation, mux, new SearchSuggestionSerializer(), serializeFrameworkException, customizer);
61
+ };
62
+ const serdeContextBase = {
63
+ base64Encoder: toBase64,
64
+ base64Decoder: fromBase64,
65
+ utf8Encoder: toUtf8,
66
+ utf8Decoder: fromUtf8,
67
+ streamCollector: streamCollector,
68
+ requestHandler: new NodeHttpHandler(),
69
+ disableHostPrefix: true
70
+ };
71
+ async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
72
+ let input;
73
+ try {
74
+ input = await serializer.deserialize(request, {
75
+ endpoint: () => Promise.resolve(request), ...serdeContextBase
76
+ });
77
+ }
78
+ catch (error) {
79
+ if (__isFrameworkException(error)) {
80
+ return serializeFrameworkException(error, serdeContextBase);
81
+ }
82
+ ;
83
+ return serializeFrameworkException(new __SerializationException(), serdeContextBase);
84
+ }
85
+ try {
86
+ let validationFailures = validationFn(input);
87
+ if (validationFailures && validationFailures.length > 0) {
88
+ let validationException = validationCustomizer({ operation: operationName }, validationFailures);
89
+ if (validationException) {
90
+ return serializer.serializeError(validationException, serdeContextBase);
91
+ }
92
+ }
93
+ let output = await operation(input, context);
94
+ return serializer.serialize(output, serdeContextBase);
95
+ }
96
+ catch (error) {
97
+ if (serializer.isOperationError(error)) {
98
+ return serializer.serializeError(error, serdeContextBase);
99
+ }
100
+ console.log('Received an unexpected error', error);
101
+ return serializeFrameworkException(new __InternalFailureException(), serdeContextBase);
102
+ }
103
+ }
104
+ export class SearchSuggestionHandler {
105
+ constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
106
+ this.operation = operation;
107
+ this.mux = mux;
108
+ this.serializer = serializer;
109
+ this.serializeFrameworkException = serializeFrameworkException;
110
+ this.validationCustomizer = validationCustomizer;
111
+ }
112
+ async handle(request, context) {
113
+ const target = this.mux.match(request);
114
+ if (target === undefined) {
115
+ console.log('Received a request that did not match software.amazon.smithy.app#AppAPI.SearchSuggestion. This indicates a misconfiguration.');
116
+ return this.serializeFrameworkException(new __InternalFailureException(), serdeContextBase);
117
+ }
118
+ return handle(request, context, "SearchSuggestion", this.serializer, this.operation, this.serializeFrameworkException, SearchSuggestionServerInput.validate, this.validationCustomizer);
119
+ }
120
+ }
@@ -0,0 +1,115 @@
1
+ import { UpdateUserInput, } from "../../models/models_0";
2
+ import { deserializeUpdateUserRequest, serializeFrameworkException, serializeRuntimeErrorError, serializeUpdateUserResponse, serializeValidationExceptionError, } from "../../protocols/Aws_restJson1";
3
+ import { InternalFailureException as __InternalFailureException, SerializationException as __SerializationException, generateValidationMessage as __generateValidationMessage, generateValidationSummary as __generateValidationSummary, isFrameworkException as __isFrameworkException, httpbinding, } from "@aws-smithy/server-common";
4
+ import { NodeHttpHandler, streamCollector, } from "@smithy/node-http-handler";
5
+ import { fromBase64, toBase64, } from "@smithy/util-base64";
6
+ import { fromUtf8, toUtf8, } from "@smithy/util-utf8";
7
+ export var UpdateUserServerInput;
8
+ (function (UpdateUserServerInput) {
9
+ UpdateUserServerInput.validate = UpdateUserInput.validate;
10
+ })(UpdateUserServerInput || (UpdateUserServerInput = {}));
11
+ export class UpdateUserSerializer {
12
+ constructor() {
13
+ this.serialize = serializeUpdateUserResponse;
14
+ this.deserialize = deserializeUpdateUserRequest;
15
+ }
16
+ isOperationError(error) {
17
+ const names = ["ValidationException", "RuntimeError"];
18
+ return names.includes(error.name);
19
+ }
20
+ ;
21
+ serializeError(error, ctx) {
22
+ switch (error.name) {
23
+ case "ValidationException": {
24
+ return serializeValidationExceptionError(error, ctx);
25
+ }
26
+ case "RuntimeError": {
27
+ return serializeRuntimeErrorError(error, ctx);
28
+ }
29
+ default: {
30
+ throw error;
31
+ }
32
+ }
33
+ }
34
+ }
35
+ export const getUpdateUserHandler = (operation) => {
36
+ const mux = new httpbinding.HttpBindingMux([
37
+ new httpbinding.UriSpec('PUT', [
38
+ { type: 'path_literal', value: "user" },
39
+ ], [], { service: "AppAPI", operation: "UpdateUser" }),
40
+ ]);
41
+ const customizer = (ctx, failures) => {
42
+ if (!failures) {
43
+ return undefined;
44
+ }
45
+ return {
46
+ name: "ValidationException",
47
+ $fault: "client",
48
+ message: __generateValidationSummary(failures),
49
+ fieldList: failures.map(failure => ({
50
+ path: failure.path,
51
+ message: __generateValidationMessage(failure)
52
+ }))
53
+ };
54
+ };
55
+ return new UpdateUserHandler(operation, mux, new UpdateUserSerializer(), serializeFrameworkException, customizer);
56
+ };
57
+ const serdeContextBase = {
58
+ base64Encoder: toBase64,
59
+ base64Decoder: fromBase64,
60
+ utf8Encoder: toUtf8,
61
+ utf8Decoder: fromUtf8,
62
+ streamCollector: streamCollector,
63
+ requestHandler: new NodeHttpHandler(),
64
+ disableHostPrefix: true
65
+ };
66
+ async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
67
+ let input;
68
+ try {
69
+ input = await serializer.deserialize(request, {
70
+ endpoint: () => Promise.resolve(request), ...serdeContextBase
71
+ });
72
+ }
73
+ catch (error) {
74
+ if (__isFrameworkException(error)) {
75
+ return serializeFrameworkException(error, serdeContextBase);
76
+ }
77
+ ;
78
+ return serializeFrameworkException(new __SerializationException(), serdeContextBase);
79
+ }
80
+ try {
81
+ let validationFailures = validationFn(input);
82
+ if (validationFailures && validationFailures.length > 0) {
83
+ let validationException = validationCustomizer({ operation: operationName }, validationFailures);
84
+ if (validationException) {
85
+ return serializer.serializeError(validationException, serdeContextBase);
86
+ }
87
+ }
88
+ let output = await operation(input, context);
89
+ return serializer.serialize(output, serdeContextBase);
90
+ }
91
+ catch (error) {
92
+ if (serializer.isOperationError(error)) {
93
+ return serializer.serializeError(error, serdeContextBase);
94
+ }
95
+ console.log('Received an unexpected error', error);
96
+ return serializeFrameworkException(new __InternalFailureException(), serdeContextBase);
97
+ }
98
+ }
99
+ export class UpdateUserHandler {
100
+ constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
101
+ this.operation = operation;
102
+ this.mux = mux;
103
+ this.serializer = serializer;
104
+ this.serializeFrameworkException = serializeFrameworkException;
105
+ this.validationCustomizer = validationCustomizer;
106
+ }
107
+ async handle(request, context) {
108
+ const target = this.mux.match(request);
109
+ if (target === undefined) {
110
+ console.log('Received a request that did not match software.amazon.smithy.app#AppAPI.UpdateUser. This indicates a misconfiguration.');
111
+ return this.serializeFrameworkException(new __InternalFailureException(), serdeContextBase);
112
+ }
113
+ return handle(request, context, "UpdateUser", this.serializer, this.operation, this.serializeFrameworkException, UpdateUserServerInput.validate, this.validationCustomizer);
114
+ }
115
+ }
@@ -0,0 +1,26 @@
1
+ export * from "./DeleteUser";
2
+ export * from "./FavoritePlans";
3
+ export * from "./FavoriteShops";
4
+ export * from "./GetShop";
5
+ export * from "./GetShopPublic";
6
+ export * from "./GetUser";
7
+ export * from "./LikeOrg";
8
+ export * from "./NearbyShops";
9
+ export * from "./NearbyShopsPublic";
10
+ export * from "./NearestShop";
11
+ export * from "./OnboardUser";
12
+ export * from "./PinnedShop";
13
+ export * from "./PinnedShopPublic";
14
+ export * from "./Plan";
15
+ export * from "./PlanPublic";
16
+ export * from "./Plans";
17
+ export * from "./PopularShops";
18
+ export * from "./PopularShopsPublic";
19
+ export * from "./RadiusShops";
20
+ export * from "./RecordVisit";
21
+ export * from "./RedeemFirstTimeReward";
22
+ export * from "./RedeemPointReward";
23
+ export * from "./RedeemVisitReward";
24
+ export * from "./SearchShopsPublic";
25
+ export * from "./SearchSuggestion";
26
+ export * from "./UpdateUser";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Spark Rewards APP API Service
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export * as Aws_restJson1 from "./protocols/Aws_restJson1";
7
+ export * from "./server/index";
8
+ export * from "./models";
9
+ export * from "./openapi";
@@ -0,0 +1 @@
1
+ export * from "./models_0";