@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,371 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAppAPIServiceHandler = exports.AppAPIServiceHandler = void 0;
4
+ const Aws_restJson1_1 = require("../protocols/Aws_restJson1");
5
+ const DeleteUser_1 = require("./operations/DeleteUser");
6
+ const FavoritePlans_1 = require("./operations/FavoritePlans");
7
+ const FavoriteShops_1 = require("./operations/FavoriteShops");
8
+ const GetShop_1 = require("./operations/GetShop");
9
+ const GetShopPublic_1 = require("./operations/GetShopPublic");
10
+ const GetUser_1 = require("./operations/GetUser");
11
+ const LikeOrg_1 = require("./operations/LikeOrg");
12
+ const NearbyShops_1 = require("./operations/NearbyShops");
13
+ const NearbyShopsPublic_1 = require("./operations/NearbyShopsPublic");
14
+ const NearestShop_1 = require("./operations/NearestShop");
15
+ const OnboardUser_1 = require("./operations/OnboardUser");
16
+ const PinnedShop_1 = require("./operations/PinnedShop");
17
+ const PinnedShopPublic_1 = require("./operations/PinnedShopPublic");
18
+ const Plan_1 = require("./operations/Plan");
19
+ const PlanPublic_1 = require("./operations/PlanPublic");
20
+ const Plans_1 = require("./operations/Plans");
21
+ const PopularShops_1 = require("./operations/PopularShops");
22
+ const PopularShopsPublic_1 = require("./operations/PopularShopsPublic");
23
+ const RadiusShops_1 = require("./operations/RadiusShops");
24
+ const RecordVisit_1 = require("./operations/RecordVisit");
25
+ const RedeemFirstTimeReward_1 = require("./operations/RedeemFirstTimeReward");
26
+ const RedeemPointReward_1 = require("./operations/RedeemPointReward");
27
+ const RedeemVisitReward_1 = require("./operations/RedeemVisitReward");
28
+ const SearchShopsPublic_1 = require("./operations/SearchShopsPublic");
29
+ const SearchSuggestion_1 = require("./operations/SearchSuggestion");
30
+ const UpdateUser_1 = require("./operations/UpdateUser");
31
+ const server_common_1 = require("@aws-smithy/server-common");
32
+ const node_http_handler_1 = require("@smithy/node-http-handler");
33
+ const util_base64_1 = require("@smithy/util-base64");
34
+ const util_utf8_1 = require("@smithy/util-utf8");
35
+ const serdeContextBase = {
36
+ base64Encoder: util_base64_1.toBase64,
37
+ base64Decoder: util_base64_1.fromBase64,
38
+ utf8Encoder: util_utf8_1.toUtf8,
39
+ utf8Decoder: util_utf8_1.fromUtf8,
40
+ streamCollector: node_http_handler_1.streamCollector,
41
+ requestHandler: new node_http_handler_1.NodeHttpHandler(),
42
+ disableHostPrefix: true
43
+ };
44
+ async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
45
+ let input;
46
+ try {
47
+ input = await serializer.deserialize(request, {
48
+ endpoint: () => Promise.resolve(request), ...serdeContextBase
49
+ });
50
+ }
51
+ catch (error) {
52
+ if ((0, server_common_1.isFrameworkException)(error)) {
53
+ return serializeFrameworkException(error, serdeContextBase);
54
+ }
55
+ ;
56
+ return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
57
+ }
58
+ try {
59
+ let validationFailures = validationFn(input);
60
+ if (validationFailures && validationFailures.length > 0) {
61
+ let validationException = validationCustomizer({ operation: operationName }, validationFailures);
62
+ if (validationException) {
63
+ return serializer.serializeError(validationException, serdeContextBase);
64
+ }
65
+ }
66
+ let output = await operation(input, context);
67
+ return serializer.serialize(output, serdeContextBase);
68
+ }
69
+ catch (error) {
70
+ if (serializer.isOperationError(error)) {
71
+ return serializer.serializeError(error, serdeContextBase);
72
+ }
73
+ console.log('Received an unexpected error', error);
74
+ return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
75
+ }
76
+ }
77
+ class AppAPIServiceHandler {
78
+ constructor(service, mux, serializerFactory, serializeFrameworkException, validationCustomizer) {
79
+ this.service = service;
80
+ this.mux = mux;
81
+ this.serializerFactory = serializerFactory;
82
+ this.serializeFrameworkException = serializeFrameworkException;
83
+ this.validationCustomizer = validationCustomizer;
84
+ }
85
+ async handle(request, context) {
86
+ const target = this.mux.match(request);
87
+ if (target === undefined) {
88
+ return this.serializeFrameworkException(new server_common_1.UnknownOperationException(), serdeContextBase);
89
+ }
90
+ switch (target.operation) {
91
+ case "DeleteUser": {
92
+ return handle(request, context, "DeleteUser", this.serializerFactory("DeleteUser"), this.service.DeleteUser, this.serializeFrameworkException, DeleteUser_1.DeleteUserServerInput.validate, this.validationCustomizer);
93
+ }
94
+ case "FavoritePlans": {
95
+ return handle(request, context, "FavoritePlans", this.serializerFactory("FavoritePlans"), this.service.FavoritePlans, this.serializeFrameworkException, FavoritePlans_1.FavoritePlansServerInput.validate, this.validationCustomizer);
96
+ }
97
+ case "FavoriteShops": {
98
+ return handle(request, context, "FavoriteShops", this.serializerFactory("FavoriteShops"), this.service.FavoriteShops, this.serializeFrameworkException, FavoriteShops_1.FavoriteShopsServerInput.validate, this.validationCustomizer);
99
+ }
100
+ case "GetShop": {
101
+ return handle(request, context, "GetShop", this.serializerFactory("GetShop"), this.service.GetShop, this.serializeFrameworkException, GetShop_1.GetShopServerInput.validate, this.validationCustomizer);
102
+ }
103
+ case "GetShopPublic": {
104
+ return handle(request, context, "GetShopPublic", this.serializerFactory("GetShopPublic"), this.service.GetShopPublic, this.serializeFrameworkException, GetShopPublic_1.GetShopPublicServerInput.validate, this.validationCustomizer);
105
+ }
106
+ case "GetUser": {
107
+ return handle(request, context, "GetUser", this.serializerFactory("GetUser"), this.service.GetUser, this.serializeFrameworkException, GetUser_1.GetUserServerInput.validate, this.validationCustomizer);
108
+ }
109
+ case "LikeOrg": {
110
+ return handle(request, context, "LikeOrg", this.serializerFactory("LikeOrg"), this.service.LikeOrg, this.serializeFrameworkException, LikeOrg_1.LikeOrgServerInput.validate, this.validationCustomizer);
111
+ }
112
+ case "NearbyShops": {
113
+ return handle(request, context, "NearbyShops", this.serializerFactory("NearbyShops"), this.service.NearbyShops, this.serializeFrameworkException, NearbyShops_1.NearbyShopsServerInput.validate, this.validationCustomizer);
114
+ }
115
+ case "NearbyShopsPublic": {
116
+ return handle(request, context, "NearbyShopsPublic", this.serializerFactory("NearbyShopsPublic"), this.service.NearbyShopsPublic, this.serializeFrameworkException, NearbyShopsPublic_1.NearbyShopsPublicServerInput.validate, this.validationCustomizer);
117
+ }
118
+ case "NearestShop": {
119
+ return handle(request, context, "NearestShop", this.serializerFactory("NearestShop"), this.service.NearestShop, this.serializeFrameworkException, NearestShop_1.NearestShopServerInput.validate, this.validationCustomizer);
120
+ }
121
+ case "OnboardUser": {
122
+ return handle(request, context, "OnboardUser", this.serializerFactory("OnboardUser"), this.service.OnboardUser, this.serializeFrameworkException, OnboardUser_1.OnboardUserServerInput.validate, this.validationCustomizer);
123
+ }
124
+ case "PinnedShop": {
125
+ return handle(request, context, "PinnedShop", this.serializerFactory("PinnedShop"), this.service.PinnedShop, this.serializeFrameworkException, PinnedShop_1.PinnedShopServerInput.validate, this.validationCustomizer);
126
+ }
127
+ case "PinnedShopPublic": {
128
+ return handle(request, context, "PinnedShopPublic", this.serializerFactory("PinnedShopPublic"), this.service.PinnedShopPublic, this.serializeFrameworkException, PinnedShopPublic_1.PinnedShopPublicServerInput.validate, this.validationCustomizer);
129
+ }
130
+ case "Plan": {
131
+ return handle(request, context, "Plan", this.serializerFactory("Plan"), this.service.Plan, this.serializeFrameworkException, Plan_1.PlanServerInput.validate, this.validationCustomizer);
132
+ }
133
+ case "PlanPublic": {
134
+ return handle(request, context, "PlanPublic", this.serializerFactory("PlanPublic"), this.service.PlanPublic, this.serializeFrameworkException, PlanPublic_1.PlanPublicServerInput.validate, this.validationCustomizer);
135
+ }
136
+ case "Plans": {
137
+ return handle(request, context, "Plans", this.serializerFactory("Plans"), this.service.Plans, this.serializeFrameworkException, Plans_1.PlansServerInput.validate, this.validationCustomizer);
138
+ }
139
+ case "PopularShops": {
140
+ return handle(request, context, "PopularShops", this.serializerFactory("PopularShops"), this.service.PopularShops, this.serializeFrameworkException, PopularShops_1.PopularShopsServerInput.validate, this.validationCustomizer);
141
+ }
142
+ case "PopularShopsPublic": {
143
+ return handle(request, context, "PopularShopsPublic", this.serializerFactory("PopularShopsPublic"), this.service.PopularShopsPublic, this.serializeFrameworkException, PopularShopsPublic_1.PopularShopsPublicServerInput.validate, this.validationCustomizer);
144
+ }
145
+ case "RadiusShops": {
146
+ return handle(request, context, "RadiusShops", this.serializerFactory("RadiusShops"), this.service.RadiusShops, this.serializeFrameworkException, RadiusShops_1.RadiusShopsServerInput.validate, this.validationCustomizer);
147
+ }
148
+ case "RecordVisit": {
149
+ return handle(request, context, "RecordVisit", this.serializerFactory("RecordVisit"), this.service.RecordVisit, this.serializeFrameworkException, RecordVisit_1.RecordVisitServerInput.validate, this.validationCustomizer);
150
+ }
151
+ case "RedeemFirstTimeReward": {
152
+ return handle(request, context, "RedeemFirstTimeReward", this.serializerFactory("RedeemFirstTimeReward"), this.service.RedeemFirstTimeReward, this.serializeFrameworkException, RedeemFirstTimeReward_1.RedeemFirstTimeRewardServerInput.validate, this.validationCustomizer);
153
+ }
154
+ case "RedeemPointReward": {
155
+ return handle(request, context, "RedeemPointReward", this.serializerFactory("RedeemPointReward"), this.service.RedeemPointReward, this.serializeFrameworkException, RedeemPointReward_1.RedeemPointRewardServerInput.validate, this.validationCustomizer);
156
+ }
157
+ case "RedeemVisitReward": {
158
+ return handle(request, context, "RedeemVisitReward", this.serializerFactory("RedeemVisitReward"), this.service.RedeemVisitReward, this.serializeFrameworkException, RedeemVisitReward_1.RedeemVisitRewardServerInput.validate, this.validationCustomizer);
159
+ }
160
+ case "SearchShopsPublic": {
161
+ return handle(request, context, "SearchShopsPublic", this.serializerFactory("SearchShopsPublic"), this.service.SearchShopsPublic, this.serializeFrameworkException, SearchShopsPublic_1.SearchShopsPublicServerInput.validate, this.validationCustomizer);
162
+ }
163
+ case "SearchSuggestion": {
164
+ return handle(request, context, "SearchSuggestion", this.serializerFactory("SearchSuggestion"), this.service.SearchSuggestion, this.serializeFrameworkException, SearchSuggestion_1.SearchSuggestionServerInput.validate, this.validationCustomizer);
165
+ }
166
+ case "UpdateUser": {
167
+ return handle(request, context, "UpdateUser", this.serializerFactory("UpdateUser"), this.service.UpdateUser, this.serializeFrameworkException, UpdateUser_1.UpdateUserServerInput.validate, this.validationCustomizer);
168
+ }
169
+ }
170
+ }
171
+ }
172
+ exports.AppAPIServiceHandler = AppAPIServiceHandler;
173
+ const getAppAPIServiceHandler = (service) => {
174
+ const mux = new server_common_1.httpbinding.HttpBindingMux([
175
+ new server_common_1.httpbinding.UriSpec('DELETE', [
176
+ { type: 'path_literal', value: "user" },
177
+ ], [], { service: "AppAPI", operation: "DeleteUser" }),
178
+ new server_common_1.httpbinding.UriSpec('GET', [
179
+ { type: 'path_literal', value: "plans" },
180
+ { type: 'path_literal', value: "favorite" },
181
+ ], [
182
+ { type: 'query', key: "lat" },
183
+ { type: 'query', key: "lon" },
184
+ ], { service: "AppAPI", operation: "FavoritePlans" }),
185
+ new server_common_1.httpbinding.UriSpec('GET', [
186
+ { type: 'path_literal', value: "shops" },
187
+ { type: 'path_literal', value: "favorite" },
188
+ ], [], { service: "AppAPI", operation: "FavoriteShops" }),
189
+ new server_common_1.httpbinding.UriSpec('GET', [
190
+ { type: 'path_literal', value: "shops" },
191
+ { type: 'path_literal', value: "shop" },
192
+ { type: 'path' },
193
+ ], [], { service: "AppAPI", operation: "GetShop" }),
194
+ new server_common_1.httpbinding.UriSpec('GET', [
195
+ { type: 'path_literal', value: "public" },
196
+ { type: 'path_literal', value: "shops" },
197
+ { type: 'path_literal', value: "shop" },
198
+ { type: 'path' },
199
+ ], [], { service: "AppAPI", operation: "GetShopPublic" }),
200
+ new server_common_1.httpbinding.UriSpec('GET', [
201
+ { type: 'path_literal', value: "user" },
202
+ ], [], { service: "AppAPI", operation: "GetUser" }),
203
+ new server_common_1.httpbinding.UriSpec('PUT', [
204
+ { type: 'path_literal', value: "user" },
205
+ { type: 'path_literal', value: "like" },
206
+ ], [
207
+ { type: 'query', key: "org_id" },
208
+ ], { service: "AppAPI", operation: "LikeOrg" }),
209
+ new server_common_1.httpbinding.UriSpec('GET', [
210
+ { type: 'path_literal', value: "shops" },
211
+ ], [], { service: "AppAPI", operation: "NearbyShops" }),
212
+ new server_common_1.httpbinding.UriSpec('GET', [
213
+ { type: 'path_literal', value: "public" },
214
+ { type: 'path_literal', value: "shops" },
215
+ ], [], { service: "AppAPI", operation: "NearbyShopsPublic" }),
216
+ new server_common_1.httpbinding.UriSpec('GET', [
217
+ { type: 'path_literal', value: "shops" },
218
+ { type: 'path_literal', value: "nearest" },
219
+ ], [
220
+ { type: 'query', key: "shop_name" },
221
+ { type: 'query', key: "lat" },
222
+ { type: 'query', key: "lon" },
223
+ ], { service: "AppAPI", operation: "NearestShop" }),
224
+ new server_common_1.httpbinding.UriSpec('PUT', [
225
+ { type: 'path_literal', value: "user" },
226
+ { type: 'path_literal', value: "onboard" },
227
+ ], [], { service: "AppAPI", operation: "OnboardUser" }),
228
+ new server_common_1.httpbinding.UriSpec('GET', [
229
+ { type: 'path_literal', value: "shops" },
230
+ { type: 'path_literal', value: "pinned" },
231
+ ], [
232
+ { type: 'query', key: "shop_id" },
233
+ { type: 'query', key: "lat" },
234
+ { type: 'query', key: "lon" },
235
+ ], { service: "AppAPI", operation: "PinnedShop" }),
236
+ new server_common_1.httpbinding.UriSpec('GET', [
237
+ { type: 'path_literal', value: "public" },
238
+ { type: 'path_literal', value: "shops" },
239
+ { type: 'path_literal', value: "pinned" },
240
+ ], [
241
+ { type: 'query', key: "shop_id" },
242
+ { type: 'query', key: "lat" },
243
+ { type: 'query', key: "lon" },
244
+ ], { service: "AppAPI", operation: "PinnedShopPublic" }),
245
+ new server_common_1.httpbinding.UriSpec('GET', [
246
+ { type: 'path_literal', value: "plan" },
247
+ ], [
248
+ { type: 'query', key: "org_id" },
249
+ ], { service: "AppAPI", operation: "Plan" }),
250
+ new server_common_1.httpbinding.UriSpec('GET', [
251
+ { type: 'path_literal', value: "public" },
252
+ { type: 'path_literal', value: "plan" },
253
+ ], [
254
+ { type: 'query', key: "org_id" },
255
+ ], { service: "AppAPI", operation: "PlanPublic" }),
256
+ new server_common_1.httpbinding.UriSpec('GET', [
257
+ { type: 'path_literal', value: "plans" },
258
+ ], [
259
+ { type: 'query', key: "lat" },
260
+ { type: 'query', key: "lon" },
261
+ ], { service: "AppAPI", operation: "Plans" }),
262
+ new server_common_1.httpbinding.UriSpec('GET', [
263
+ { type: 'path_literal', value: "shops" },
264
+ { type: 'path_literal', value: "popular" },
265
+ ], [], { service: "AppAPI", operation: "PopularShops" }),
266
+ new server_common_1.httpbinding.UriSpec('GET', [
267
+ { type: 'path_literal', value: "public" },
268
+ { type: 'path_literal', value: "shops" },
269
+ { type: 'path_literal', value: "popular" },
270
+ ], [], { service: "AppAPI", operation: "PopularShopsPublic" }),
271
+ new server_common_1.httpbinding.UriSpec('GET', [
272
+ { type: 'path_literal', value: "public" },
273
+ { type: 'path_literal', value: "shops" },
274
+ { type: 'path_literal', value: "radius" },
275
+ ], [], { service: "AppAPI", operation: "RadiusShops" }),
276
+ new server_common_1.httpbinding.UriSpec('POST', [
277
+ { type: 'path_literal', value: "visit" },
278
+ ], [
279
+ { type: 'query', key: "shop_id" },
280
+ { type: 'query', key: "timestamp" },
281
+ { type: 'query', key: "lat" },
282
+ { type: 'query', key: "lon" },
283
+ ], { service: "AppAPI", operation: "RecordVisit" }),
284
+ new server_common_1.httpbinding.UriSpec('PUT', [
285
+ { type: 'path_literal', value: "rewards" },
286
+ { type: 'path_literal', value: "redeem" },
287
+ { type: 'path_literal', value: "first-time" },
288
+ ], [
289
+ { type: 'query', key: "org_id" },
290
+ ], { service: "AppAPI", operation: "RedeemFirstTimeReward" }),
291
+ new server_common_1.httpbinding.UriSpec('PUT', [
292
+ { type: 'path_literal', value: "rewards" },
293
+ { type: 'path_literal', value: "redeem" },
294
+ { type: 'path_literal', value: "point" },
295
+ ], [
296
+ { type: 'query', key: "org_id" },
297
+ { type: 'query', key: "reward_id" },
298
+ ], { service: "AppAPI", operation: "RedeemPointReward" }),
299
+ new server_common_1.httpbinding.UriSpec('PUT', [
300
+ { type: 'path_literal', value: "rewards" },
301
+ { type: 'path_literal', value: "redeem" },
302
+ { type: 'path_literal', value: "visit" },
303
+ ], [
304
+ { type: 'query', key: "reward_id" },
305
+ ], { service: "AppAPI", operation: "RedeemVisitReward" }),
306
+ new server_common_1.httpbinding.UriSpec('GET', [
307
+ { type: 'path_literal', value: "public" },
308
+ { type: 'path_literal', value: "shops" },
309
+ { type: 'path_literal', value: "search" },
310
+ ], [
311
+ { type: 'query', key: "q" },
312
+ ], { service: "AppAPI", operation: "SearchShopsPublic" }),
313
+ new server_common_1.httpbinding.UriSpec('GET', [
314
+ { type: 'path_literal', value: "public" },
315
+ { type: 'path_literal', value: "shops" },
316
+ { type: 'path_literal', value: "search" },
317
+ { type: 'path_literal', value: "suggestion" },
318
+ ], [
319
+ { type: 'query', key: "q" },
320
+ ], { service: "AppAPI", operation: "SearchSuggestion" }),
321
+ new server_common_1.httpbinding.UriSpec('PUT', [
322
+ { type: 'path_literal', value: "user" },
323
+ ], [], { service: "AppAPI", operation: "UpdateUser" }),
324
+ ]);
325
+ const serFn = (op) => {
326
+ switch (op) {
327
+ case "DeleteUser": return new DeleteUser_1.DeleteUserSerializer();
328
+ case "FavoritePlans": return new FavoritePlans_1.FavoritePlansSerializer();
329
+ case "FavoriteShops": return new FavoriteShops_1.FavoriteShopsSerializer();
330
+ case "GetShop": return new GetShop_1.GetShopSerializer();
331
+ case "GetShopPublic": return new GetShopPublic_1.GetShopPublicSerializer();
332
+ case "GetUser": return new GetUser_1.GetUserSerializer();
333
+ case "LikeOrg": return new LikeOrg_1.LikeOrgSerializer();
334
+ case "NearbyShops": return new NearbyShops_1.NearbyShopsSerializer();
335
+ case "NearbyShopsPublic": return new NearbyShopsPublic_1.NearbyShopsPublicSerializer();
336
+ case "NearestShop": return new NearestShop_1.NearestShopSerializer();
337
+ case "OnboardUser": return new OnboardUser_1.OnboardUserSerializer();
338
+ case "PinnedShop": return new PinnedShop_1.PinnedShopSerializer();
339
+ case "PinnedShopPublic": return new PinnedShopPublic_1.PinnedShopPublicSerializer();
340
+ case "Plan": return new Plan_1.PlanSerializer();
341
+ case "PlanPublic": return new PlanPublic_1.PlanPublicSerializer();
342
+ case "Plans": return new Plans_1.PlansSerializer();
343
+ case "PopularShops": return new PopularShops_1.PopularShopsSerializer();
344
+ case "PopularShopsPublic": return new PopularShopsPublic_1.PopularShopsPublicSerializer();
345
+ case "RadiusShops": return new RadiusShops_1.RadiusShopsSerializer();
346
+ case "RecordVisit": return new RecordVisit_1.RecordVisitSerializer();
347
+ case "RedeemFirstTimeReward": return new RedeemFirstTimeReward_1.RedeemFirstTimeRewardSerializer();
348
+ case "RedeemPointReward": return new RedeemPointReward_1.RedeemPointRewardSerializer();
349
+ case "RedeemVisitReward": return new RedeemVisitReward_1.RedeemVisitRewardSerializer();
350
+ case "SearchShopsPublic": return new SearchShopsPublic_1.SearchShopsPublicSerializer();
351
+ case "SearchSuggestion": return new SearchSuggestion_1.SearchSuggestionSerializer();
352
+ case "UpdateUser": return new UpdateUser_1.UpdateUserSerializer();
353
+ }
354
+ };
355
+ const customizer = (ctx, failures) => {
356
+ if (!failures) {
357
+ return undefined;
358
+ }
359
+ return {
360
+ name: "ValidationException",
361
+ $fault: "client",
362
+ message: (0, server_common_1.generateValidationSummary)(failures),
363
+ fieldList: failures.map(failure => ({
364
+ path: failure.path,
365
+ message: (0, server_common_1.generateValidationMessage)(failure)
366
+ }))
367
+ };
368
+ };
369
+ return new AppAPIServiceHandler(service, mux, serFn, Aws_restJson1_1.serializeFrameworkException, customizer);
370
+ };
371
+ exports.getAppAPIServiceHandler = getAppAPIServiceHandler;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./operations"), exports);
5
+ tslib_1.__exportStar(require("./AppAPIService"), exports);
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteUserHandler = exports.getDeleteUserHandler = exports.DeleteUserSerializer = exports.DeleteUserServerInput = void 0;
4
+ const models_0_1 = require("../../models/models_0");
5
+ const Aws_restJson1_1 = require("../../protocols/Aws_restJson1");
6
+ const server_common_1 = require("@aws-smithy/server-common");
7
+ const node_http_handler_1 = require("@smithy/node-http-handler");
8
+ const util_base64_1 = require("@smithy/util-base64");
9
+ const util_utf8_1 = require("@smithy/util-utf8");
10
+ var DeleteUserServerInput;
11
+ (function (DeleteUserServerInput) {
12
+ DeleteUserServerInput.validate = models_0_1.DeleteUserInput.validate;
13
+ })(DeleteUserServerInput = exports.DeleteUserServerInput || (exports.DeleteUserServerInput = {}));
14
+ class DeleteUserSerializer {
15
+ constructor() {
16
+ this.serialize = Aws_restJson1_1.serializeDeleteUserResponse;
17
+ this.deserialize = Aws_restJson1_1.deserializeDeleteUserRequest;
18
+ }
19
+ isOperationError(error) {
20
+ const names = ["ValidationException", "RuntimeError"];
21
+ return names.includes(error.name);
22
+ }
23
+ ;
24
+ serializeError(error, ctx) {
25
+ switch (error.name) {
26
+ case "ValidationException": {
27
+ return (0, Aws_restJson1_1.serializeValidationExceptionError)(error, ctx);
28
+ }
29
+ case "RuntimeError": {
30
+ return (0, Aws_restJson1_1.serializeRuntimeErrorError)(error, ctx);
31
+ }
32
+ default: {
33
+ throw error;
34
+ }
35
+ }
36
+ }
37
+ }
38
+ exports.DeleteUserSerializer = DeleteUserSerializer;
39
+ const getDeleteUserHandler = (operation) => {
40
+ const mux = new server_common_1.httpbinding.HttpBindingMux([
41
+ new server_common_1.httpbinding.UriSpec('DELETE', [
42
+ { type: 'path_literal', value: "user" },
43
+ ], [], { service: "AppAPI", operation: "DeleteUser" }),
44
+ ]);
45
+ const customizer = (ctx, failures) => {
46
+ if (!failures) {
47
+ return undefined;
48
+ }
49
+ return {
50
+ name: "ValidationException",
51
+ $fault: "client",
52
+ message: (0, server_common_1.generateValidationSummary)(failures),
53
+ fieldList: failures.map(failure => ({
54
+ path: failure.path,
55
+ message: (0, server_common_1.generateValidationMessage)(failure)
56
+ }))
57
+ };
58
+ };
59
+ return new DeleteUserHandler(operation, mux, new DeleteUserSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
60
+ };
61
+ exports.getDeleteUserHandler = getDeleteUserHandler;
62
+ const serdeContextBase = {
63
+ base64Encoder: util_base64_1.toBase64,
64
+ base64Decoder: util_base64_1.fromBase64,
65
+ utf8Encoder: util_utf8_1.toUtf8,
66
+ utf8Decoder: util_utf8_1.fromUtf8,
67
+ streamCollector: node_http_handler_1.streamCollector,
68
+ requestHandler: new node_http_handler_1.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 ((0, server_common_1.isFrameworkException)(error)) {
80
+ return serializeFrameworkException(error, serdeContextBase);
81
+ }
82
+ ;
83
+ return serializeFrameworkException(new server_common_1.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 server_common_1.InternalFailureException(), serdeContextBase);
102
+ }
103
+ }
104
+ class DeleteUserHandler {
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.DeleteUser. This indicates a misconfiguration.');
116
+ return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
117
+ }
118
+ return handle(request, context, "DeleteUser", this.serializer, this.operation, this.serializeFrameworkException, DeleteUserServerInput.validate, this.validationCustomizer);
119
+ }
120
+ }
121
+ exports.DeleteUserHandler = DeleteUserHandler;
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FavoritePlansHandler = exports.getFavoritePlansHandler = exports.FavoritePlansSerializer = exports.FavoritePlansServerInput = void 0;
4
+ const models_0_1 = require("../../models/models_0");
5
+ const Aws_restJson1_1 = require("../../protocols/Aws_restJson1");
6
+ const server_common_1 = require("@aws-smithy/server-common");
7
+ const node_http_handler_1 = require("@smithy/node-http-handler");
8
+ const util_base64_1 = require("@smithy/util-base64");
9
+ const util_utf8_1 = require("@smithy/util-utf8");
10
+ var FavoritePlansServerInput;
11
+ (function (FavoritePlansServerInput) {
12
+ FavoritePlansServerInput.validate = models_0_1.PlansListInput.validate;
13
+ })(FavoritePlansServerInput = exports.FavoritePlansServerInput || (exports.FavoritePlansServerInput = {}));
14
+ class FavoritePlansSerializer {
15
+ constructor() {
16
+ this.serialize = Aws_restJson1_1.serializeFavoritePlansResponse;
17
+ this.deserialize = Aws_restJson1_1.deserializeFavoritePlansRequest;
18
+ }
19
+ isOperationError(error) {
20
+ const names = ["ValidationException", "RuntimeError"];
21
+ return names.includes(error.name);
22
+ }
23
+ ;
24
+ serializeError(error, ctx) {
25
+ switch (error.name) {
26
+ case "ValidationException": {
27
+ return (0, Aws_restJson1_1.serializeValidationExceptionError)(error, ctx);
28
+ }
29
+ case "RuntimeError": {
30
+ return (0, Aws_restJson1_1.serializeRuntimeErrorError)(error, ctx);
31
+ }
32
+ default: {
33
+ throw error;
34
+ }
35
+ }
36
+ }
37
+ }
38
+ exports.FavoritePlansSerializer = FavoritePlansSerializer;
39
+ const getFavoritePlansHandler = (operation) => {
40
+ const mux = new server_common_1.httpbinding.HttpBindingMux([
41
+ new server_common_1.httpbinding.UriSpec('GET', [
42
+ { type: 'path_literal', value: "plans" },
43
+ { type: 'path_literal', value: "favorite" },
44
+ ], [
45
+ { type: 'query', key: "lat" },
46
+ { type: 'query', key: "lon" },
47
+ ], { service: "AppAPI", operation: "FavoritePlans" }),
48
+ ]);
49
+ const customizer = (ctx, failures) => {
50
+ if (!failures) {
51
+ return undefined;
52
+ }
53
+ return {
54
+ name: "ValidationException",
55
+ $fault: "client",
56
+ message: (0, server_common_1.generateValidationSummary)(failures),
57
+ fieldList: failures.map(failure => ({
58
+ path: failure.path,
59
+ message: (0, server_common_1.generateValidationMessage)(failure)
60
+ }))
61
+ };
62
+ };
63
+ return new FavoritePlansHandler(operation, mux, new FavoritePlansSerializer(), Aws_restJson1_1.serializeFrameworkException, customizer);
64
+ };
65
+ exports.getFavoritePlansHandler = getFavoritePlansHandler;
66
+ const serdeContextBase = {
67
+ base64Encoder: util_base64_1.toBase64,
68
+ base64Decoder: util_base64_1.fromBase64,
69
+ utf8Encoder: util_utf8_1.toUtf8,
70
+ utf8Decoder: util_utf8_1.fromUtf8,
71
+ streamCollector: node_http_handler_1.streamCollector,
72
+ requestHandler: new node_http_handler_1.NodeHttpHandler(),
73
+ disableHostPrefix: true
74
+ };
75
+ async function handle(request, context, operationName, serializer, operation, serializeFrameworkException, validationFn, validationCustomizer) {
76
+ let input;
77
+ try {
78
+ input = await serializer.deserialize(request, {
79
+ endpoint: () => Promise.resolve(request), ...serdeContextBase
80
+ });
81
+ }
82
+ catch (error) {
83
+ if ((0, server_common_1.isFrameworkException)(error)) {
84
+ return serializeFrameworkException(error, serdeContextBase);
85
+ }
86
+ ;
87
+ return serializeFrameworkException(new server_common_1.SerializationException(), serdeContextBase);
88
+ }
89
+ try {
90
+ let validationFailures = validationFn(input);
91
+ if (validationFailures && validationFailures.length > 0) {
92
+ let validationException = validationCustomizer({ operation: operationName }, validationFailures);
93
+ if (validationException) {
94
+ return serializer.serializeError(validationException, serdeContextBase);
95
+ }
96
+ }
97
+ let output = await operation(input, context);
98
+ return serializer.serialize(output, serdeContextBase);
99
+ }
100
+ catch (error) {
101
+ if (serializer.isOperationError(error)) {
102
+ return serializer.serializeError(error, serdeContextBase);
103
+ }
104
+ console.log('Received an unexpected error', error);
105
+ return serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
106
+ }
107
+ }
108
+ class FavoritePlansHandler {
109
+ constructor(operation, mux, serializer, serializeFrameworkException, validationCustomizer) {
110
+ this.operation = operation;
111
+ this.mux = mux;
112
+ this.serializer = serializer;
113
+ this.serializeFrameworkException = serializeFrameworkException;
114
+ this.validationCustomizer = validationCustomizer;
115
+ }
116
+ async handle(request, context) {
117
+ const target = this.mux.match(request);
118
+ if (target === undefined) {
119
+ console.log('Received a request that did not match software.amazon.smithy.app#AppAPI.FavoritePlans. This indicates a misconfiguration.');
120
+ return this.serializeFrameworkException(new server_common_1.InternalFailureException(), serdeContextBase);
121
+ }
122
+ return handle(request, context, "FavoritePlans", this.serializer, this.operation, this.serializeFrameworkException, FavoritePlansServerInput.validate, this.validationCustomizer);
123
+ }
124
+ }
125
+ exports.FavoritePlansHandler = FavoritePlansHandler;