@sparkrewards/sra-sdk 0.0.4 → 0.0.6

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.
@@ -1,7 +1,7 @@
1
1
  import { parseJsonBody as parseBody, } from "@aws-sdk/core";
2
2
  import { NotAcceptableException as __NotAcceptableException, SerializationException as __SerializationException, UnsupportedMediaTypeException as __UnsupportedMediaTypeException, acceptMatches as __acceptMatches, } from "@aws-smithy/server-common";
3
3
  import { HttpResponse as __HttpResponse, } from "@smithy/protocol-http";
4
- import { expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, serializeFloat as __serializeFloat, strictParseDouble as __strictParseDouble, strictParseInt32 as __strictParseInt32, collectBody, map, take, } from "@smithy/smithy-client";
4
+ import { expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, parseBoolean as __parseBoolean, serializeFloat as __serializeFloat, strictParseDouble as __strictParseDouble, strictParseInt32 as __strictParseInt32, collectBody, map, take, } from "@smithy/smithy-client";
5
5
  import { calculateBodyLength } from "@smithy/util-body-length-node";
6
6
  export const deserializeDeleteUserRequest = async (output, context) => {
7
7
  const contentTypeHeaderKey = Object.keys(output.headers).find(key => key.toLowerCase() === 'content-type');
@@ -179,20 +179,50 @@ export const deserializeFavoriteShopsRequest = async (output, context) => {
179
179
  }
180
180
  contents.page = __strictParseInt32(queryValue);
181
181
  }
182
- if (query["filters"] !== undefined) {
182
+ if (query["open_now"] !== undefined) {
183
183
  let queryValue;
184
- if (Array.isArray(query["filters"])) {
185
- if (query["filters"].length === 1) {
186
- queryValue = query["filters"][0];
184
+ if (Array.isArray(query["open_now"])) {
185
+ if (query["open_now"].length === 1) {
186
+ queryValue = query["open_now"][0];
187
187
  }
188
188
  else {
189
189
  throw new __SerializationException();
190
190
  }
191
191
  }
192
192
  else {
193
- queryValue = query["filters"];
193
+ queryValue = query["open_now"];
194
+ }
195
+ contents.open_now = __parseBoolean(queryValue);
196
+ }
197
+ if (query["timezone"] !== undefined) {
198
+ let queryValue;
199
+ if (Array.isArray(query["timezone"])) {
200
+ if (query["timezone"].length === 1) {
201
+ queryValue = query["timezone"][0];
202
+ }
203
+ else {
204
+ throw new __SerializationException();
205
+ }
206
+ }
207
+ else {
208
+ queryValue = query["timezone"];
194
209
  }
195
- contents.filters = queryValue;
210
+ contents.timezone = queryValue;
211
+ }
212
+ if (query["categories"] !== undefined) {
213
+ let queryValue;
214
+ if (Array.isArray(query["categories"])) {
215
+ if (query["categories"].length === 1) {
216
+ queryValue = query["categories"][0];
217
+ }
218
+ else {
219
+ throw new __SerializationException();
220
+ }
221
+ }
222
+ else {
223
+ queryValue = query["categories"];
224
+ }
225
+ contents.categories = queryValue;
196
226
  }
197
227
  }
198
228
  await collectBody(output.body, context);
@@ -385,20 +415,50 @@ export const deserializeNearbyShopsRequest = async (output, context) => {
385
415
  }
386
416
  contents.page = __strictParseInt32(queryValue);
387
417
  }
388
- if (query["filters"] !== undefined) {
418
+ if (query["open_now"] !== undefined) {
389
419
  let queryValue;
390
- if (Array.isArray(query["filters"])) {
391
- if (query["filters"].length === 1) {
392
- queryValue = query["filters"][0];
420
+ if (Array.isArray(query["open_now"])) {
421
+ if (query["open_now"].length === 1) {
422
+ queryValue = query["open_now"][0];
393
423
  }
394
424
  else {
395
425
  throw new __SerializationException();
396
426
  }
397
427
  }
398
428
  else {
399
- queryValue = query["filters"];
429
+ queryValue = query["open_now"];
400
430
  }
401
- contents.filters = queryValue;
431
+ contents.open_now = __parseBoolean(queryValue);
432
+ }
433
+ if (query["timezone"] !== undefined) {
434
+ let queryValue;
435
+ if (Array.isArray(query["timezone"])) {
436
+ if (query["timezone"].length === 1) {
437
+ queryValue = query["timezone"][0];
438
+ }
439
+ else {
440
+ throw new __SerializationException();
441
+ }
442
+ }
443
+ else {
444
+ queryValue = query["timezone"];
445
+ }
446
+ contents.timezone = queryValue;
447
+ }
448
+ if (query["categories"] !== undefined) {
449
+ let queryValue;
450
+ if (Array.isArray(query["categories"])) {
451
+ if (query["categories"].length === 1) {
452
+ queryValue = query["categories"][0];
453
+ }
454
+ else {
455
+ throw new __SerializationException();
456
+ }
457
+ }
458
+ else {
459
+ queryValue = query["categories"];
460
+ }
461
+ contents.categories = queryValue;
402
462
  }
403
463
  }
404
464
  await collectBody(output.body, context);
@@ -471,20 +531,50 @@ export const deserializeNearbyShopsPublicRequest = async (output, context) => {
471
531
  }
472
532
  contents.page = __strictParseInt32(queryValue);
473
533
  }
474
- if (query["filters"] !== undefined) {
534
+ if (query["open_now"] !== undefined) {
475
535
  let queryValue;
476
- if (Array.isArray(query["filters"])) {
477
- if (query["filters"].length === 1) {
478
- queryValue = query["filters"][0];
536
+ if (Array.isArray(query["open_now"])) {
537
+ if (query["open_now"].length === 1) {
538
+ queryValue = query["open_now"][0];
479
539
  }
480
540
  else {
481
541
  throw new __SerializationException();
482
542
  }
483
543
  }
484
544
  else {
485
- queryValue = query["filters"];
545
+ queryValue = query["open_now"];
546
+ }
547
+ contents.open_now = __parseBoolean(queryValue);
548
+ }
549
+ if (query["timezone"] !== undefined) {
550
+ let queryValue;
551
+ if (Array.isArray(query["timezone"])) {
552
+ if (query["timezone"].length === 1) {
553
+ queryValue = query["timezone"][0];
554
+ }
555
+ else {
556
+ throw new __SerializationException();
557
+ }
558
+ }
559
+ else {
560
+ queryValue = query["timezone"];
561
+ }
562
+ contents.timezone = queryValue;
563
+ }
564
+ if (query["categories"] !== undefined) {
565
+ let queryValue;
566
+ if (Array.isArray(query["categories"])) {
567
+ if (query["categories"].length === 1) {
568
+ queryValue = query["categories"][0];
569
+ }
570
+ else {
571
+ throw new __SerializationException();
572
+ }
573
+ }
574
+ else {
575
+ queryValue = query["categories"];
486
576
  }
487
- contents.filters = queryValue;
577
+ contents.categories = queryValue;
488
578
  }
489
579
  }
490
580
  await collectBody(output.body, context);
@@ -961,20 +1051,50 @@ export const deserializePopularShopsRequest = async (output, context) => {
961
1051
  }
962
1052
  contents.page = __strictParseInt32(queryValue);
963
1053
  }
964
- if (query["filters"] !== undefined) {
1054
+ if (query["open_now"] !== undefined) {
965
1055
  let queryValue;
966
- if (Array.isArray(query["filters"])) {
967
- if (query["filters"].length === 1) {
968
- queryValue = query["filters"][0];
1056
+ if (Array.isArray(query["open_now"])) {
1057
+ if (query["open_now"].length === 1) {
1058
+ queryValue = query["open_now"][0];
969
1059
  }
970
1060
  else {
971
1061
  throw new __SerializationException();
972
1062
  }
973
1063
  }
974
1064
  else {
975
- queryValue = query["filters"];
1065
+ queryValue = query["open_now"];
1066
+ }
1067
+ contents.open_now = __parseBoolean(queryValue);
1068
+ }
1069
+ if (query["timezone"] !== undefined) {
1070
+ let queryValue;
1071
+ if (Array.isArray(query["timezone"])) {
1072
+ if (query["timezone"].length === 1) {
1073
+ queryValue = query["timezone"][0];
1074
+ }
1075
+ else {
1076
+ throw new __SerializationException();
1077
+ }
1078
+ }
1079
+ else {
1080
+ queryValue = query["timezone"];
976
1081
  }
977
- contents.filters = queryValue;
1082
+ contents.timezone = queryValue;
1083
+ }
1084
+ if (query["categories"] !== undefined) {
1085
+ let queryValue;
1086
+ if (Array.isArray(query["categories"])) {
1087
+ if (query["categories"].length === 1) {
1088
+ queryValue = query["categories"][0];
1089
+ }
1090
+ else {
1091
+ throw new __SerializationException();
1092
+ }
1093
+ }
1094
+ else {
1095
+ queryValue = query["categories"];
1096
+ }
1097
+ contents.categories = queryValue;
978
1098
  }
979
1099
  }
980
1100
  await collectBody(output.body, context);
@@ -1047,20 +1167,50 @@ export const deserializePopularShopsPublicRequest = async (output, context) => {
1047
1167
  }
1048
1168
  contents.page = __strictParseInt32(queryValue);
1049
1169
  }
1050
- if (query["filters"] !== undefined) {
1170
+ if (query["open_now"] !== undefined) {
1051
1171
  let queryValue;
1052
- if (Array.isArray(query["filters"])) {
1053
- if (query["filters"].length === 1) {
1054
- queryValue = query["filters"][0];
1172
+ if (Array.isArray(query["open_now"])) {
1173
+ if (query["open_now"].length === 1) {
1174
+ queryValue = query["open_now"][0];
1055
1175
  }
1056
1176
  else {
1057
1177
  throw new __SerializationException();
1058
1178
  }
1059
1179
  }
1060
1180
  else {
1061
- queryValue = query["filters"];
1181
+ queryValue = query["open_now"];
1062
1182
  }
1063
- contents.filters = queryValue;
1183
+ contents.open_now = __parseBoolean(queryValue);
1184
+ }
1185
+ if (query["timezone"] !== undefined) {
1186
+ let queryValue;
1187
+ if (Array.isArray(query["timezone"])) {
1188
+ if (query["timezone"].length === 1) {
1189
+ queryValue = query["timezone"][0];
1190
+ }
1191
+ else {
1192
+ throw new __SerializationException();
1193
+ }
1194
+ }
1195
+ else {
1196
+ queryValue = query["timezone"];
1197
+ }
1198
+ contents.timezone = queryValue;
1199
+ }
1200
+ if (query["categories"] !== undefined) {
1201
+ let queryValue;
1202
+ if (Array.isArray(query["categories"])) {
1203
+ if (query["categories"].length === 1) {
1204
+ queryValue = query["categories"][0];
1205
+ }
1206
+ else {
1207
+ throw new __SerializationException();
1208
+ }
1209
+ }
1210
+ else {
1211
+ queryValue = query["categories"];
1212
+ }
1213
+ contents.categories = queryValue;
1064
1214
  }
1065
1215
  }
1066
1216
  await collectBody(output.body, context);
@@ -1133,20 +1283,50 @@ export const deserializeRadiusShopsRequest = async (output, context) => {
1133
1283
  }
1134
1284
  contents.page = __strictParseInt32(queryValue);
1135
1285
  }
1136
- if (query["filters"] !== undefined) {
1286
+ if (query["open_now"] !== undefined) {
1137
1287
  let queryValue;
1138
- if (Array.isArray(query["filters"])) {
1139
- if (query["filters"].length === 1) {
1140
- queryValue = query["filters"][0];
1288
+ if (Array.isArray(query["open_now"])) {
1289
+ if (query["open_now"].length === 1) {
1290
+ queryValue = query["open_now"][0];
1141
1291
  }
1142
1292
  else {
1143
1293
  throw new __SerializationException();
1144
1294
  }
1145
1295
  }
1146
1296
  else {
1147
- queryValue = query["filters"];
1297
+ queryValue = query["open_now"];
1298
+ }
1299
+ contents.open_now = __parseBoolean(queryValue);
1300
+ }
1301
+ if (query["timezone"] !== undefined) {
1302
+ let queryValue;
1303
+ if (Array.isArray(query["timezone"])) {
1304
+ if (query["timezone"].length === 1) {
1305
+ queryValue = query["timezone"][0];
1306
+ }
1307
+ else {
1308
+ throw new __SerializationException();
1309
+ }
1310
+ }
1311
+ else {
1312
+ queryValue = query["timezone"];
1313
+ }
1314
+ contents.timezone = queryValue;
1315
+ }
1316
+ if (query["categories"] !== undefined) {
1317
+ let queryValue;
1318
+ if (Array.isArray(query["categories"])) {
1319
+ if (query["categories"].length === 1) {
1320
+ queryValue = query["categories"][0];
1321
+ }
1322
+ else {
1323
+ throw new __SerializationException();
1324
+ }
1325
+ }
1326
+ else {
1327
+ queryValue = query["categories"];
1148
1328
  }
1149
- contents.filters = queryValue;
1329
+ contents.categories = queryValue;
1150
1330
  }
1151
1331
  }
1152
1332
  await collectBody(output.body, context);
@@ -1486,7 +1666,7 @@ export const deserializeSearchShopsPublicRequest = async (output, context) => {
1486
1666
  else {
1487
1667
  queryValue = query["filters"];
1488
1668
  }
1489
- contents.filters = queryValue;
1669
+ contents.tags = queryValue;
1490
1670
  }
1491
1671
  }
1492
1672
  await collectBody(output.body, context);
@@ -181,7 +181,10 @@ export const getAppAPIServiceHandler = (service) => {
181
181
  new httpbinding.UriSpec('GET', [
182
182
  { type: 'path_literal', value: "shops" },
183
183
  { type: 'path_literal', value: "favorite" },
184
- ], [], { service: "AppAPI", operation: "FavoriteShops" }),
184
+ ], [
185
+ { type: 'query', key: "lat" },
186
+ { type: 'query', key: "lon" },
187
+ ], { service: "AppAPI", operation: "FavoriteShops" }),
185
188
  new httpbinding.UriSpec('GET', [
186
189
  { type: 'path_literal', value: "shops" },
187
190
  { type: 'path_literal', value: "shop" },
@@ -204,11 +207,17 @@ export const getAppAPIServiceHandler = (service) => {
204
207
  ], { service: "AppAPI", operation: "LikeOrg" }),
205
208
  new httpbinding.UriSpec('GET', [
206
209
  { type: 'path_literal', value: "shops" },
207
- ], [], { service: "AppAPI", operation: "NearbyShops" }),
210
+ ], [
211
+ { type: 'query', key: "lat" },
212
+ { type: 'query', key: "lon" },
213
+ ], { service: "AppAPI", operation: "NearbyShops" }),
208
214
  new httpbinding.UriSpec('GET', [
209
215
  { type: 'path_literal', value: "public" },
210
216
  { type: 'path_literal', value: "shops" },
211
- ], [], { service: "AppAPI", operation: "NearbyShopsPublic" }),
217
+ ], [
218
+ { type: 'query', key: "lat" },
219
+ { type: 'query', key: "lon" },
220
+ ], { service: "AppAPI", operation: "NearbyShopsPublic" }),
212
221
  new httpbinding.UriSpec('GET', [
213
222
  { type: 'path_literal', value: "shops" },
214
223
  { type: 'path_literal', value: "nearest" },
@@ -258,17 +267,26 @@ export const getAppAPIServiceHandler = (service) => {
258
267
  new httpbinding.UriSpec('GET', [
259
268
  { type: 'path_literal', value: "shops" },
260
269
  { type: 'path_literal', value: "popular" },
261
- ], [], { service: "AppAPI", operation: "PopularShops" }),
270
+ ], [
271
+ { type: 'query', key: "lat" },
272
+ { type: 'query', key: "lon" },
273
+ ], { service: "AppAPI", operation: "PopularShops" }),
262
274
  new httpbinding.UriSpec('GET', [
263
275
  { type: 'path_literal', value: "public" },
264
276
  { type: 'path_literal', value: "shops" },
265
277
  { type: 'path_literal', value: "popular" },
266
- ], [], { service: "AppAPI", operation: "PopularShopsPublic" }),
278
+ ], [
279
+ { type: 'query', key: "lat" },
280
+ { type: 'query', key: "lon" },
281
+ ], { service: "AppAPI", operation: "PopularShopsPublic" }),
267
282
  new httpbinding.UriSpec('GET', [
268
283
  { type: 'path_literal', value: "public" },
269
284
  { type: 'path_literal', value: "shops" },
270
285
  { type: 'path_literal', value: "radius" },
271
- ], [], { service: "AppAPI", operation: "RadiusShops" }),
286
+ ], [
287
+ { type: 'query', key: "lat" },
288
+ { type: 'query', key: "lon" },
289
+ ], { service: "AppAPI", operation: "RadiusShops" }),
272
290
  new httpbinding.UriSpec('POST', [
273
291
  { type: 'path_literal', value: "visit" },
274
292
  ], [
@@ -37,7 +37,10 @@ export const getFavoriteShopsHandler = (operation) => {
37
37
  new httpbinding.UriSpec('GET', [
38
38
  { type: 'path_literal', value: "shops" },
39
39
  { type: 'path_literal', value: "favorite" },
40
- ], [], { service: "AppAPI", operation: "FavoriteShops" }),
40
+ ], [
41
+ { type: 'query', key: "lat" },
42
+ { type: 'query', key: "lon" },
43
+ ], { service: "AppAPI", operation: "FavoriteShops" }),
41
44
  ]);
42
45
  const customizer = (ctx, failures) => {
43
46
  if (!failures) {
@@ -36,7 +36,10 @@ export const getNearbyShopsHandler = (operation) => {
36
36
  const mux = new httpbinding.HttpBindingMux([
37
37
  new httpbinding.UriSpec('GET', [
38
38
  { type: 'path_literal', value: "shops" },
39
- ], [], { service: "AppAPI", operation: "NearbyShops" }),
39
+ ], [
40
+ { type: 'query', key: "lat" },
41
+ { type: 'query', key: "lon" },
42
+ ], { service: "AppAPI", operation: "NearbyShops" }),
40
43
  ]);
41
44
  const customizer = (ctx, failures) => {
42
45
  if (!failures) {
@@ -37,7 +37,10 @@ export const getNearbyShopsPublicHandler = (operation) => {
37
37
  new httpbinding.UriSpec('GET', [
38
38
  { type: 'path_literal', value: "public" },
39
39
  { type: 'path_literal', value: "shops" },
40
- ], [], { service: "AppAPI", operation: "NearbyShopsPublic" }),
40
+ ], [
41
+ { type: 'query', key: "lat" },
42
+ { type: 'query', key: "lon" },
43
+ ], { service: "AppAPI", operation: "NearbyShopsPublic" }),
41
44
  ]);
42
45
  const customizer = (ctx, failures) => {
43
46
  if (!failures) {
@@ -37,7 +37,10 @@ export const getPopularShopsHandler = (operation) => {
37
37
  new httpbinding.UriSpec('GET', [
38
38
  { type: 'path_literal', value: "shops" },
39
39
  { type: 'path_literal', value: "popular" },
40
- ], [], { service: "AppAPI", operation: "PopularShops" }),
40
+ ], [
41
+ { type: 'query', key: "lat" },
42
+ { type: 'query', key: "lon" },
43
+ ], { service: "AppAPI", operation: "PopularShops" }),
41
44
  ]);
42
45
  const customizer = (ctx, failures) => {
43
46
  if (!failures) {
@@ -38,7 +38,10 @@ export const getPopularShopsPublicHandler = (operation) => {
38
38
  { type: 'path_literal', value: "public" },
39
39
  { type: 'path_literal', value: "shops" },
40
40
  { type: 'path_literal', value: "popular" },
41
- ], [], { service: "AppAPI", operation: "PopularShopsPublic" }),
41
+ ], [
42
+ { type: 'query', key: "lat" },
43
+ { type: 'query', key: "lon" },
44
+ ], { service: "AppAPI", operation: "PopularShopsPublic" }),
42
45
  ]);
43
46
  const customizer = (ctx, failures) => {
44
47
  if (!failures) {
@@ -38,7 +38,10 @@ export const getRadiusShopsHandler = (operation) => {
38
38
  { type: 'path_literal', value: "public" },
39
39
  { type: 'path_literal', value: "shops" },
40
40
  { type: 'path_literal', value: "radius" },
41
- ], [], { service: "AppAPI", operation: "RadiusShops" }),
41
+ ], [
42
+ { type: 'query', key: "lat" },
43
+ { type: 'query', key: "lon" },
44
+ ], { service: "AppAPI", operation: "RadiusShops" }),
42
45
  ]);
43
46
  const customizer = (ctx, failures) => {
44
47
  if (!failures) {
@@ -213,14 +213,15 @@ export declare namespace PlansOutput {
213
213
  const validate: (obj: PlansOutput, path?: string) => __ValidationFailure[];
214
214
  }
215
215
  /**
216
- * Input for shop list operations that require location and pagination
217
216
  * @public
218
217
  */
219
218
  export interface ShopListInput {
220
- lat?: number;
221
- lon?: number;
219
+ lat: number | undefined;
220
+ lon: number | undefined;
222
221
  page?: number;
223
- filters?: string;
222
+ open_now?: boolean;
223
+ timezone?: string;
224
+ categories?: string;
224
225
  }
225
226
  export declare namespace ShopListInput {
226
227
  /**
@@ -725,7 +726,7 @@ export interface SearchShopsInput {
725
726
  lat?: number;
726
727
  lon?: number;
727
728
  page?: number;
728
- filters?: string;
729
+ tags?: string;
729
730
  }
730
731
  export declare namespace SearchShopsInput {
731
732
  /**
@@ -734,7 +735,6 @@ export declare namespace SearchShopsInput {
734
735
  const validate: (obj: SearchShopsInput, path?: string) => __ValidationFailure[];
735
736
  }
736
737
  /**
737
- * Note: FilterShopsInput is the same as ShopListInput - reuse ShopListInput
738
738
  * Input for search suggestions
739
739
  * @public
740
740
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sparkrewards/sra-sdk",
3
3
  "description": "@sparkrewards/sra-sdk server",
4
- "version": "0.0.4",
4
+ "version": "0.0.6",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",