btrz-api-client 8.75.1 → 9.1.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 (252) hide show
  1. package/.babelrc +2 -1
  2. package/eslint.config.mjs +48 -0
  3. package/lib/client-standalone-min.js +19 -5
  4. package/lib/client.js +1363 -473
  5. package/lib/constants.js +1 -4
  6. package/lib/endpoints/accounts/accounts.js +36 -33
  7. package/lib/endpoints/accounts/agencies.js +53 -43
  8. package/lib/endpoints/accounts/agency-types.js +78 -59
  9. package/lib/endpoints/accounts/application-settings.js +84 -61
  10. package/lib/endpoints/accounts/application.js +19 -19
  11. package/lib/endpoints/accounts/applications.js +35 -30
  12. package/lib/endpoints/accounts/control-classes-settings.js +30 -27
  13. package/lib/endpoints/accounts/current-shifts.js +20 -22
  14. package/lib/endpoints/accounts/customers.js +119 -90
  15. package/lib/endpoints/accounts/docs.js +4 -8
  16. package/lib/endpoints/accounts/domains.js +46 -38
  17. package/lib/endpoints/accounts/dynamic-forms.js +176 -130
  18. package/lib/endpoints/accounts/email-settings.js +79 -61
  19. package/lib/endpoints/accounts/email-templates.js +126 -92
  20. package/lib/endpoints/accounts/exchange-rates.js +36 -32
  21. package/lib/endpoints/accounts/exchange-receipts.js +33 -28
  22. package/lib/endpoints/accounts/external-customers.js +61 -47
  23. package/lib/endpoints/accounts/goal-settings.js +32 -29
  24. package/lib/endpoints/accounts/images.js +59 -50
  25. package/lib/endpoints/accounts/interline.js +131 -102
  26. package/lib/endpoints/accounts/journey-prices-settings.js +30 -27
  27. package/lib/endpoints/accounts/lexicons.js +160 -124
  28. package/lib/endpoints/accounts/market-pricing-settings.js +30 -27
  29. package/lib/endpoints/accounts/multiproduct-sales-settings.js +33 -28
  30. package/lib/endpoints/accounts/network.js +97 -80
  31. package/lib/endpoints/accounts/operation-settings.js +32 -29
  32. package/lib/endpoints/accounts/people-lookups.js +94 -72
  33. package/lib/endpoints/accounts/point-to-point-settings.js +30 -27
  34. package/lib/endpoints/accounts/print-settings.js +32 -29
  35. package/lib/endpoints/accounts/print-templates.js +89 -75
  36. package/lib/endpoints/accounts/printers.js +20 -20
  37. package/lib/endpoints/accounts/rms-settings.js +30 -27
  38. package/lib/endpoints/accounts/s3buckets.js +49 -39
  39. package/lib/endpoints/accounts/salesforce-settings.js +32 -29
  40. package/lib/endpoints/accounts/shift-settings.js +32 -29
  41. package/lib/endpoints/accounts/shifts.js +431 -317
  42. package/lib/endpoints/accounts/sms-templates.js +126 -92
  43. package/lib/endpoints/accounts/sub-print-templates.js +19 -20
  44. package/lib/endpoints/accounts/system-model-settings.js +51 -45
  45. package/lib/endpoints/accounts/ticket-movement-settings.js +30 -27
  46. package/lib/endpoints/accounts/tokens.js +34 -29
  47. package/lib/endpoints/accounts/transport-regulation-settings.js +30 -27
  48. package/lib/endpoints/accounts/travellers.js +82 -66
  49. package/lib/endpoints/accounts/trusted-machines.js +48 -39
  50. package/lib/endpoints/accounts/twilio-settings.js +32 -29
  51. package/lib/endpoints/accounts/users.js +262 -184
  52. package/lib/endpoints/accounts/verified-emails.js +64 -50
  53. package/lib/endpoints/accounts/websales-config.js +35 -31
  54. package/lib/endpoints/bpes/configuration.js +51 -37
  55. package/lib/endpoints/btrzpay/adyen.js +34 -31
  56. package/lib/endpoints/btrzpay/cardpointe.js +84 -62
  57. package/lib/endpoints/btrzpay/customerCards.js +73 -56
  58. package/lib/endpoints/btrzpay/customers.js +55 -43
  59. package/lib/endpoints/btrzpay/cybersource3ds.js +59 -44
  60. package/lib/endpoints/btrzpay/datalogic.js +84 -69
  61. package/lib/endpoints/btrzpay/docs.js +4 -8
  62. package/lib/endpoints/btrzpay/oxxo.js +66 -59
  63. package/lib/endpoints/btrzpay/payment-methods.js +141 -96
  64. package/lib/endpoints/btrzpay/payments.js +37 -30
  65. package/lib/endpoints/btrzpay/prismaTerminals.js +203 -160
  66. package/lib/endpoints/btrzpay/reference-numbers.js +23 -21
  67. package/lib/endpoints/btrzpay/referenced-payments.js +41 -36
  68. package/lib/endpoints/btrzpay/square.js +39 -36
  69. package/lib/endpoints/btrzpay/stripe-terminals.js +36 -31
  70. package/lib/endpoints/btrzpay/stripe3ds.js +25 -22
  71. package/lib/endpoints/btrzpay/terminalPayments.js +58 -52
  72. package/lib/endpoints/coltrane/docs.js +4 -8
  73. package/lib/endpoints/coltrane/healthcheck.js +7 -12
  74. package/lib/endpoints/coltrane/info.js +7 -12
  75. package/lib/endpoints/coltrane/merged-fare-tables.js +22 -22
  76. package/lib/endpoints/coltrane/paths.js +18 -20
  77. package/lib/endpoints/endpoints_helpers.js +14 -30
  78. package/lib/endpoints/gps/scanner-app-location.js +16 -19
  79. package/lib/endpoints/inventory/amenities.js +65 -50
  80. package/lib/endpoints/inventory/amenity-groups.js +65 -50
  81. package/lib/endpoints/inventory/banks.js +78 -59
  82. package/lib/endpoints/inventory/bare-routes.js +31 -30
  83. package/lib/endpoints/inventory/brands.js +68 -50
  84. package/lib/endpoints/inventory/bundle-fares.js +21 -23
  85. package/lib/endpoints/inventory/bundles.js +34 -30
  86. package/lib/endpoints/inventory/change-requests.js +109 -86
  87. package/lib/endpoints/inventory/companies.js +20 -21
  88. package/lib/endpoints/inventory/control-classes.js +112 -85
  89. package/lib/endpoints/inventory/countries.js +35 -32
  90. package/lib/endpoints/inventory/custom-content.js +76 -58
  91. package/lib/endpoints/inventory/custom-fields.js +82 -60
  92. package/lib/endpoints/inventory/docs.js +4 -8
  93. package/lib/endpoints/inventory/document-types.js +96 -69
  94. package/lib/endpoints/inventory/external-passes.js +34 -30
  95. package/lib/endpoints/inventory/external-wallets.js +133 -90
  96. package/lib/endpoints/inventory/fallback-codes.js +66 -49
  97. package/lib/endpoints/inventory/fare-classes.js +54 -41
  98. package/lib/endpoints/inventory/fare-type-modifiers.js +78 -59
  99. package/lib/endpoints/inventory/fares.js +95 -72
  100. package/lib/endpoints/inventory/fees.js +68 -50
  101. package/lib/endpoints/inventory/filtered-trips-v2.js +23 -21
  102. package/lib/endpoints/inventory/filtered-trips.js +50 -39
  103. package/lib/endpoints/inventory/financing-costs.js +78 -61
  104. package/lib/endpoints/inventory/garages.js +72 -59
  105. package/lib/endpoints/inventory/getnet-terminals.js +78 -60
  106. package/lib/endpoints/inventory/gift-certificate-definitions.js +84 -66
  107. package/lib/endpoints/inventory/healthcheck.js +4 -8
  108. package/lib/endpoints/inventory/holidays.js +83 -61
  109. package/lib/endpoints/inventory/insurances.js +68 -57
  110. package/lib/endpoints/inventory/insurancesCost.js +24 -24
  111. package/lib/endpoints/inventory/items.js +86 -64
  112. package/lib/endpoints/inventory/journey-prices.js +83 -61
  113. package/lib/endpoints/inventory/labels.js +83 -61
  114. package/lib/endpoints/inventory/marital-status.js +82 -67
  115. package/lib/endpoints/inventory/marketplace-modifiers.js +74 -57
  116. package/lib/endpoints/inventory/mit-terminal-settings.js +78 -59
  117. package/lib/endpoints/inventory/mit-terminals.js +74 -57
  118. package/lib/endpoints/inventory/operating-companies.js +126 -91
  119. package/lib/endpoints/inventory/operation-messages.js +85 -63
  120. package/lib/endpoints/inventory/operation-reasons.js +86 -67
  121. package/lib/endpoints/inventory/parcel-zones.js +52 -40
  122. package/lib/endpoints/inventory/pay-on-accounts.js +22 -24
  123. package/lib/endpoints/inventory/payment-terminals.js +74 -57
  124. package/lib/endpoints/inventory/prisma-terminals.js +78 -59
  125. package/lib/endpoints/inventory/products.js +90 -70
  126. package/lib/endpoints/inventory/promos.js +138 -95
  127. package/lib/endpoints/inventory/regions.js +78 -59
  128. package/lib/endpoints/inventory/routes.js +323 -262
  129. package/lib/endpoints/inventory/schedule-groups.js +69 -52
  130. package/lib/endpoints/inventory/schedules.js +171 -143
  131. package/lib/endpoints/inventory/seatclasses.js +82 -67
  132. package/lib/endpoints/inventory/seatfees.js +60 -48
  133. package/lib/endpoints/inventory/seatmaps.js +108 -84
  134. package/lib/endpoints/inventory/segments-information-tables.js +22 -23
  135. package/lib/endpoints/inventory/segments-information.js +78 -59
  136. package/lib/endpoints/inventory/service-numbers.js +64 -50
  137. package/lib/endpoints/inventory/service-types.js +74 -57
  138. package/lib/endpoints/inventory/ssrs.js +18 -20
  139. package/lib/endpoints/inventory/station-classes.js +79 -61
  140. package/lib/endpoints/inventory/station-groups.js +18 -20
  141. package/lib/endpoints/inventory/stations-provinces.js +18 -20
  142. package/lib/endpoints/inventory/stations-zones.js +18 -20
  143. package/lib/endpoints/inventory/stations.js +61 -47
  144. package/lib/endpoints/inventory/taxes.js +137 -98
  145. package/lib/endpoints/inventory/travel-routes.js +64 -50
  146. package/lib/endpoints/inventory/traveller-card-providers-types.js +19 -19
  147. package/lib/endpoints/inventory/traveller-card-providers.js +68 -50
  148. package/lib/endpoints/inventory/traveller-card-types.js +82 -59
  149. package/lib/endpoints/inventory/trip-ids.js +21 -21
  150. package/lib/endpoints/inventory/trips.js +48 -41
  151. package/lib/endpoints/inventory/vehicle-types.js +19 -19
  152. package/lib/endpoints/inventory/vehicles.js +111 -83
  153. package/lib/endpoints/inventory/zone-price-overages.js +74 -57
  154. package/lib/endpoints/inventory/zone-prices.js +74 -57
  155. package/lib/endpoints/invoices/dlink.js +37 -34
  156. package/lib/endpoints/invoices/docs.js +4 -8
  157. package/lib/endpoints/invoices/emails.js +22 -23
  158. package/lib/endpoints/invoices/gti.js +37 -34
  159. package/lib/endpoints/invoices/infile.js +37 -34
  160. package/lib/endpoints/invoices/infileJson.js +37 -34
  161. package/lib/endpoints/invoices/invoices.js +78 -63
  162. package/lib/endpoints/invoices/pdfs.js +22 -24
  163. package/lib/endpoints/invoices/providers.js +82 -67
  164. package/lib/endpoints/invoices/providersSequences.js +89 -74
  165. package/lib/endpoints/invoices/system.js +37 -34
  166. package/lib/endpoints/invoices/tax-ids.js +20 -21
  167. package/lib/endpoints/loyalty/movements.js +55 -49
  168. package/lib/endpoints/loyalty/programs.js +50 -41
  169. package/lib/endpoints/notifications/customers.js +33 -31
  170. package/lib/endpoints/notifications/email.js +20 -21
  171. package/lib/endpoints/notifications/external-customers.js +35 -30
  172. package/lib/endpoints/notifications/manifest-notifications.js +31 -33
  173. package/lib/endpoints/notifications/notify.js +112 -81
  174. package/lib/endpoints/notifications/orders-rules-validations.js +22 -22
  175. package/lib/endpoints/notifications/pdf-data.js +56 -64
  176. package/lib/endpoints/notifications/pdfs.js +48 -55
  177. package/lib/endpoints/notifications/printed-tickets.js +31 -27
  178. package/lib/endpoints/notifications/salesforce.js +19 -19
  179. package/lib/endpoints/notifications/short-urls.js +38 -33
  180. package/lib/endpoints/notifications/twilio.js +57 -46
  181. package/lib/endpoints/operations/accounting_items.js +30 -36
  182. package/lib/endpoints/operations/applied_insurance.js +25 -20
  183. package/lib/endpoints/operations/calendar_entries.js +18 -20
  184. package/lib/endpoints/operations/cancellation_settings.js +33 -28
  185. package/lib/endpoints/operations/docs.js +5 -9
  186. package/lib/endpoints/operations/external-bookings.js +35 -31
  187. package/lib/endpoints/operations/flexpasses.js +22 -22
  188. package/lib/endpoints/operations/gift-certificates.js +25 -23
  189. package/lib/endpoints/operations/loans.js +30 -36
  190. package/lib/endpoints/operations/manifest.js +469 -372
  191. package/lib/endpoints/operations/manifest_leg_for_tickets.js +23 -23
  192. package/lib/endpoints/operations/movements.js +21 -22
  193. package/lib/endpoints/operations/outlook-trips.js +20 -21
  194. package/lib/endpoints/operations/pago-express.js +55 -39
  195. package/lib/endpoints/operations/parcels.js +96 -67
  196. package/lib/endpoints/operations/parcels_manifests.js +102 -81
  197. package/lib/endpoints/operations/passenger_check_in_info.js +66 -52
  198. package/lib/endpoints/operations/redemption.js +52 -40
  199. package/lib/endpoints/operations/rms.js +35 -33
  200. package/lib/endpoints/operations/scheduled_notifications.js +80 -61
  201. package/lib/endpoints/operations/segments.js +24 -24
  202. package/lib/endpoints/operations/sold-items-fulfillment.js +20 -21
  203. package/lib/endpoints/operations/sold-items.js +35 -30
  204. package/lib/endpoints/operations/tickets.js +109 -78
  205. package/lib/endpoints/operations/transaction.js +22 -22
  206. package/lib/endpoints/operations/transactions.js +178 -135
  207. package/lib/endpoints/operations/transport_regulations.js +22 -22
  208. package/lib/endpoints/operations/trip_change_info.js +23 -23
  209. package/lib/endpoints/operations/vehicle_assignments.js +60 -48
  210. package/lib/endpoints/operations/vouchers.js +32 -35
  211. package/lib/endpoints/operations/waitlists.js +62 -47
  212. package/lib/endpoints/ratality/auth.js +10 -14
  213. package/lib/endpoints/ratality/clients.js +30 -28
  214. package/lib/endpoints/ratality/integrations.js +43 -36
  215. package/lib/endpoints/reports/custom-reports.js +50 -39
  216. package/lib/endpoints/reports/email.js +20 -19
  217. package/lib/endpoints/reports/report-types.js +35 -30
  218. package/lib/endpoints/reports/trip-manifests.js +20 -21
  219. package/lib/endpoints/sales/bundles.js +18 -20
  220. package/lib/endpoints/sales/cancellations.js +48 -34
  221. package/lib/endpoints/sales/cart-promo.js +37 -34
  222. package/lib/endpoints/sales/cart.js +258 -166
  223. package/lib/endpoints/sales/check-in-info.js +22 -23
  224. package/lib/endpoints/sales/custom-fields.js +18 -20
  225. package/lib/endpoints/sales/docs.js +4 -8
  226. package/lib/endpoints/sales/flexpasses.js +21 -21
  227. package/lib/endpoints/sales/gift-certificates.js +20 -22
  228. package/lib/endpoints/sales/order.js +66 -53
  229. package/lib/endpoints/sales/parcel-quotes.js +20 -20
  230. package/lib/endpoints/sales/payment-providers.js +20 -21
  231. package/lib/endpoints/sales/redeemable-items.js +32 -31
  232. package/lib/endpoints/sales/sync-entry.js +21 -21
  233. package/lib/endpoints/sales/voucher.js +19 -20
  234. package/lib/endpoints/seatmaps/access-ticket.js +19 -19
  235. package/lib/endpoints/seatmaps/seat.js +21 -21
  236. package/lib/endpoints/uploads/files.js +26 -24
  237. package/lib/endpoints/uploads/images.js +26 -24
  238. package/lib/endpoints/webhooks/events.js +24 -24
  239. package/lib/endpoints/webhooks/subscriptions.js +80 -60
  240. package/lib/endpoints/webhooks/undelivered.js +103 -73
  241. package/lib/endpoints/webhooks/webhooks.js +20 -20
  242. package/lib/initializedClient.js +3 -5
  243. package/lib/productionDefaults.js +6 -8
  244. package/package.json +18 -18
  245. package/src/client.js +1 -1
  246. package/src/endpoints/operations/transactions.js +1 -1
  247. package/src/endpoints/sales/cart.js +31 -1
  248. package/test/endpoints/sales/cart.test.js +6 -0
  249. package/tools/build-standalone.mjs +15 -0
  250. package/.eslint-report.json +0 -1
  251. package/.eslintignore +0 -2
  252. package/.eslintrc.js +0 -3
@@ -1,8 +1,7 @@
1
- "use strict";
2
-
3
1
  /* eslint-disable max-len */
4
- var _require = require("./../endpoints_helpers.js"),
5
- authorizationHeaders = _require.authorizationHeaders;
2
+ const {
3
+ authorizationHeaders
4
+ } = require("./../endpoints_helpers.js");
6
5
 
7
6
  /**
8
7
  * Factory for Coltrane merged fare tables API (btrz-api-coltrane).
@@ -11,12 +10,10 @@ var _require = require("./../endpoints_helpers.js"),
11
10
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
12
11
  * @returns {{ get: function }}
13
12
  */
14
-
15
-
16
- function mergedFareTablesFactory(_ref) {
17
- var client = _ref.client,
18
- internalAuthTokenProvider = _ref.internalAuthTokenProvider;
19
-
13
+ function mergedFareTablesFactory({
14
+ client,
15
+ internalAuthTokenProvider
16
+ }) {
20
17
  /**
21
18
  * GET /coltrane/routes/:routeId/merged-fare-tables/:productId - get merged fare table. API does not accept query params.
22
19
  * @param {Object} opts
@@ -27,22 +24,25 @@ function mergedFareTablesFactory(_ref) {
27
24
  * @param {Object} [opts.headers] - Optional headers
28
25
  * @returns {Promise<import("axios").AxiosResponse>}
29
26
  */
30
- function get(_ref2) {
31
- var token = _ref2.token,
32
- jwtToken = _ref2.jwtToken,
33
- routeId = _ref2.routeId,
34
- productId = _ref2.productId,
35
- headers = _ref2.headers;
36
-
27
+ function get({
28
+ token,
29
+ jwtToken,
30
+ routeId,
31
+ productId,
32
+ headers
33
+ }) {
37
34
  return client({
38
- url: "/coltrane/routes/" + routeId + "/merged-fare-tables/" + productId,
39
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
35
+ url: `/coltrane/routes/${routeId}/merged-fare-tables/${productId}`,
36
+ headers: authorizationHeaders({
37
+ token,
38
+ jwtToken,
39
+ internalAuthTokenProvider,
40
+ headers
41
+ })
40
42
  });
41
43
  }
42
-
43
44
  return {
44
- get: get
45
+ get
45
46
  };
46
47
  }
47
-
48
48
  module.exports = mergedFareTablesFactory;
@@ -1,8 +1,7 @@
1
- "use strict";
2
-
3
1
  /* eslint-disable max-len */
4
- var _require = require("./../endpoints_helpers.js"),
5
- authorizationHeaders = _require.authorizationHeaders;
2
+ const {
3
+ authorizationHeaders
4
+ } = require("./../endpoints_helpers.js");
6
5
 
7
6
  /**
8
7
  * Query params for GET /paths (btrz-api-coltrane). All except metrics and preferredAlgorithm are required by the API.
@@ -24,12 +23,10 @@ var _require = require("./../endpoints_helpers.js"),
24
23
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
25
24
  * @returns {{ all: function }}
26
25
  */
27
-
28
-
29
- function coltraneFactory(_ref) {
30
- var client = _ref.client,
31
- internalAuthTokenProvider = _ref.internalAuthTokenProvider;
32
-
26
+ function coltraneFactory({
27
+ client,
28
+ internalAuthTokenProvider
29
+ }) {
33
30
  /**
34
31
  * GET /paths — search for travel paths between two stations in a departure time interval.
35
32
  * @param {Object} opts
@@ -41,22 +38,23 @@ function coltraneFactory(_ref) {
41
38
  * @throws {import("axios").AxiosError} 401 Unauthorized
42
39
  * @throws {import("axios").AxiosError} 500 Internal server error
43
40
  */
44
- function all(_ref2) {
45
- var token = _ref2.token,
46
- _ref2$query = _ref2.query,
47
- query = _ref2$query === undefined ? {} : _ref2$query,
48
- headers = _ref2.headers;
49
-
41
+ function all({
42
+ token,
43
+ query = {},
44
+ headers
45
+ }) {
50
46
  return client({
51
47
  url: "/paths",
52
48
  params: query,
53
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
49
+ headers: authorizationHeaders({
50
+ token,
51
+ internalAuthTokenProvider,
52
+ headers
53
+ })
54
54
  });
55
55
  }
56
-
57
56
  return {
58
- all: all
57
+ all
59
58
  };
60
59
  }
61
-
62
60
  module.exports = coltraneFactory;
@@ -1,11 +1,5 @@
1
- "use strict";
2
-
3
- var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
4
-
5
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
6
-
7
1
  /* eslint-disable max-len */
8
- var constants = require("../constants.js");
2
+ const constants = require("../constants.js");
9
3
 
10
4
  /**
11
5
  * Builds authorization and forwarding headers for API requests.
@@ -16,38 +10,30 @@ var constants = require("../constants.js");
16
10
  * @param {Object} [opts.headers] - Optional request headers; x-amzn-trace-id and x-elevation-token are forwarded when present; cookie with "btrz-trusted" is forwarded for trusted machine
17
11
  * @returns {Object} Headers object suitable for axios (x-api-key, Authorization, cookie, x-amzn-trace-id, x-elevation-token as applicable)
18
12
  */
19
- function authorizationHeaders(_ref) {
20
- var token = _ref.token,
21
- jwtToken = _ref.jwtToken,
22
- internalAuthTokenProvider = _ref.internalAuthTokenProvider,
23
- headers = _ref.headers;
24
-
25
- var _headers = {};
26
-
13
+ function authorizationHeaders({
14
+ token,
15
+ jwtToken,
16
+ internalAuthTokenProvider,
17
+ headers
18
+ }) {
19
+ const _headers = {};
27
20
  if (token) {
28
- _headers["x-api-key"] = "" + token;
21
+ _headers["x-api-key"] = `${token}`;
29
22
  }
30
-
31
23
  if (headers && headers.cookie && headers.cookie.includes("btrz-trusted")) {
32
24
  _headers.cookie = headers.cookie;
33
25
  }
34
-
35
26
  if (jwtToken && jwtToken === constants.INTERNAL_AUTH_TOKEN_SYMBOL) {
36
27
  if (!internalAuthTokenProvider || typeof internalAuthTokenProvider.getToken !== "function") {
37
28
  throw new Error("Tried to make an internal API request, but no 'internalAuthTokenProvider' with a 'getToken' function " + "was supplied to the API client");
38
29
  }
39
- _headers.authorization = "Bearer " + internalAuthTokenProvider.getToken();
30
+ _headers.authorization = `Bearer ${internalAuthTokenProvider.getToken()}`;
40
31
  } else if (jwtToken) {
41
- _headers.authorization = "Bearer " + jwtToken;
32
+ _headers.authorization = `Bearer ${jwtToken}`;
42
33
  }
43
-
44
34
  try {
45
- if (headers && (typeof headers === "undefined" ? "undefined" : _typeof(headers)) === "object" && !Array.isArray(headers)) {
46
- Object.entries(headers).forEach(function (_ref2) {
47
- var _ref3 = _slicedToArray(_ref2, 2),
48
- key = _ref3[0],
49
- value = _ref3[1];
50
-
35
+ if (headers && typeof headers === "object" && !Array.isArray(headers)) {
36
+ Object.entries(headers).forEach(([key, value]) => {
51
37
  if (_headers[key]) {
52
38
  return;
53
39
  }
@@ -61,10 +47,8 @@ function authorizationHeaders(_ref) {
61
47
  } catch (e) {
62
48
  console.log(e);
63
49
  }
64
-
65
50
  return _headers;
66
51
  }
67
-
68
52
  module.exports = {
69
- authorizationHeaders: authorizationHeaders
53
+ authorizationHeaders
70
54
  };
@@ -1,7 +1,6 @@
1
- "use strict";
2
-
3
- var _require = require("./../endpoints_helpers.js"),
4
- authorizationHeaders = _require.authorizationHeaders;
1
+ const {
2
+ authorizationHeaders
3
+ } = require("./../endpoints_helpers.js");
5
4
 
6
5
  /**
7
6
  * Query params for GET /scanner-app-location (GPS API). API is external (not in workspace);
@@ -20,11 +19,9 @@ var _require = require("./../endpoints_helpers.js"),
20
19
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
21
20
  * @returns {{ get: function }}
22
21
  */
23
-
24
-
25
- function scannerAppLocationFactory(_ref) {
26
- var client = _ref.client;
27
-
22
+ function scannerAppLocationFactory({
23
+ client
24
+ }) {
28
25
  /**
29
26
  * GET /scanner-app-location - get scanner app location.
30
27
  * @param {Object} opts
@@ -33,22 +30,22 @@ function scannerAppLocationFactory(_ref) {
33
30
  * @param {Object} [opts.headers] - Optional headers
34
31
  * @returns {Promise<import("axios").AxiosResponse>} response.data may contain location
35
32
  */
36
- function get(_ref2) {
37
- var token = _ref2.token,
38
- _ref2$query = _ref2.query,
39
- query = _ref2$query === undefined ? {} : _ref2$query,
40
- headers = _ref2.headers;
41
-
33
+ function get({
34
+ token,
35
+ query = {},
36
+ headers
37
+ }) {
42
38
  return client({
43
39
  url: "/scanner-app-location",
44
- headers: authorizationHeaders({ token: token, headers: headers }),
40
+ headers: authorizationHeaders({
41
+ token,
42
+ headers
43
+ }),
45
44
  params: query
46
45
  });
47
46
  }
48
-
49
47
  return {
50
- get: get
48
+ get
51
49
  };
52
50
  }
53
-
54
51
  module.exports = scannerAppLocationFactory;
@@ -1,7 +1,6 @@
1
- "use strict";
2
-
3
- var _require = require("./../endpoints_helpers.js"),
4
- authorizationHeaders = _require.authorizationHeaders;
1
+ const {
2
+ authorizationHeaders
3
+ } = require("./../endpoints_helpers.js");
5
4
 
6
5
  /**
7
6
  * Query params for GET /amenities (btrz-api-inventory). See get-amenities getSpec().
@@ -19,12 +18,10 @@ var _require = require("./../endpoints_helpers.js"),
19
18
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
20
19
  * @returns {{ all: function, get: function, create: function, update: function }}
21
20
  */
22
-
23
-
24
- function amenitiesFactory(_ref) {
25
- var client = _ref.client,
26
- internalAuthTokenProvider = _ref.internalAuthTokenProvider;
27
-
21
+ function amenitiesFactory({
22
+ client,
23
+ internalAuthTokenProvider
24
+ }) {
28
25
  /**
29
26
  * GET /amenities - list amenities.
30
27
  * @param {Object} opts
@@ -34,15 +31,18 @@ function amenitiesFactory(_ref) {
34
31
  * @param {Object} [opts.headers] - Optional headers
35
32
  * @returns {Promise<import("axios").AxiosResponse>}
36
33
  */
37
- function all(_ref2) {
38
- var token = _ref2.token,
39
- _ref2$query = _ref2.query,
40
- query = _ref2$query === undefined ? {} : _ref2$query,
41
- headers = _ref2.headers;
42
-
34
+ function all({
35
+ token,
36
+ query = {},
37
+ headers
38
+ }) {
43
39
  return client.get("/amenities", {
44
40
  params: query,
45
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
41
+ headers: authorizationHeaders({
42
+ token,
43
+ internalAuthTokenProvider,
44
+ headers
45
+ })
46
46
  });
47
47
  }
48
48
 
@@ -55,16 +55,19 @@ function amenitiesFactory(_ref) {
55
55
  * @param {Object} [opts.headers] - Optional headers
56
56
  * @returns {Promise<import("axios").AxiosResponse>}
57
57
  */
58
- function get(_ref3) {
59
- var token = _ref3.token,
60
- amenityId = _ref3.amenityId,
61
- _ref3$query = _ref3.query,
62
- query = _ref3$query === undefined ? {} : _ref3$query,
63
- headers = _ref3.headers;
64
-
65
- return client.get("/amenities/" + amenityId, {
58
+ function get({
59
+ token,
60
+ amenityId,
61
+ query = {},
62
+ headers
63
+ }) {
64
+ return client.get(`/amenities/${amenityId}`, {
66
65
  params: query,
67
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
66
+ headers: authorizationHeaders({
67
+ token,
68
+ internalAuthTokenProvider,
69
+ headers
70
+ })
68
71
  });
69
72
  }
70
73
 
@@ -77,17 +80,24 @@ function amenitiesFactory(_ref) {
77
80
  * @param {Object} [opts.headers] - Optional headers
78
81
  * @returns {Promise<import("axios").AxiosResponse>}
79
82
  */
80
- function create(_ref4) {
81
- var token = _ref4.token,
82
- jwtToken = _ref4.jwtToken,
83
- amenity = _ref4.amenity,
84
- headers = _ref4.headers;
85
-
83
+ function create({
84
+ token,
85
+ jwtToken,
86
+ amenity,
87
+ headers
88
+ }) {
86
89
  return client({
87
90
  url: "/amenities",
88
91
  method: "post",
89
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
90
- data: { amenity: amenity }
92
+ headers: authorizationHeaders({
93
+ token,
94
+ jwtToken,
95
+ internalAuthTokenProvider,
96
+ headers
97
+ }),
98
+ data: {
99
+ amenity
100
+ }
91
101
  });
92
102
  }
93
103
 
@@ -101,27 +111,32 @@ function amenitiesFactory(_ref) {
101
111
  * @param {Object} [opts.headers] - Optional headers
102
112
  * @returns {Promise<import("axios").AxiosResponse>}
103
113
  */
104
- function update(_ref5) {
105
- var token = _ref5.token,
106
- jwtToken = _ref5.jwtToken,
107
- amenityId = _ref5.amenityId,
108
- amenity = _ref5.amenity,
109
- headers = _ref5.headers;
110
-
114
+ function update({
115
+ token,
116
+ jwtToken,
117
+ amenityId,
118
+ amenity,
119
+ headers
120
+ }) {
111
121
  return client({
112
- url: "/amenities/" + amenityId,
122
+ url: `/amenities/${amenityId}`,
113
123
  method: "put",
114
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
115
- data: { amenity: amenity }
124
+ headers: authorizationHeaders({
125
+ token,
126
+ jwtToken,
127
+ internalAuthTokenProvider,
128
+ headers
129
+ }),
130
+ data: {
131
+ amenity
132
+ }
116
133
  });
117
134
  }
118
-
119
135
  return {
120
- all: all,
121
- get: get,
122
- create: create,
123
- update: update
136
+ all,
137
+ get,
138
+ create,
139
+ update
124
140
  };
125
141
  }
126
-
127
142
  module.exports = amenitiesFactory;
@@ -1,7 +1,6 @@
1
- "use strict";
2
-
3
- var _require = require("./../endpoints_helpers.js"),
4
- authorizationHeaders = _require.authorizationHeaders;
1
+ const {
2
+ authorizationHeaders
3
+ } = require("./../endpoints_helpers.js");
5
4
 
6
5
  /**
7
6
  * Query params for GET /amenity-groups (btrz-api-inventory). See get-amenity-groups getSpec().
@@ -20,12 +19,10 @@ var _require = require("./../endpoints_helpers.js"),
20
19
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
21
20
  * @returns {{ all: function, get: function, create: function, update: function }}
22
21
  */
23
-
24
-
25
- function amenityGroupsFactory(_ref) {
26
- var client = _ref.client,
27
- internalAuthTokenProvider = _ref.internalAuthTokenProvider;
28
-
22
+ function amenityGroupsFactory({
23
+ client,
24
+ internalAuthTokenProvider
25
+ }) {
29
26
  /**
30
27
  * GET /amenity-groups - list amenity groups.
31
28
  * @param {Object} opts
@@ -35,15 +32,18 @@ function amenityGroupsFactory(_ref) {
35
32
  * @param {Object} [opts.headers] - Optional headers
36
33
  * @returns {Promise<import("axios").AxiosResponse>}
37
34
  */
38
- function all(_ref2) {
39
- var token = _ref2.token,
40
- _ref2$query = _ref2.query,
41
- query = _ref2$query === undefined ? {} : _ref2$query,
42
- headers = _ref2.headers;
43
-
35
+ function all({
36
+ token,
37
+ query = {},
38
+ headers
39
+ }) {
44
40
  return client.get("/amenity-groups", {
45
41
  params: query,
46
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
42
+ headers: authorizationHeaders({
43
+ token,
44
+ internalAuthTokenProvider,
45
+ headers
46
+ })
47
47
  });
48
48
  }
49
49
 
@@ -56,16 +56,19 @@ function amenityGroupsFactory(_ref) {
56
56
  * @param {Object} [opts.headers] - Optional headers
57
57
  * @returns {Promise<import("axios").AxiosResponse>}
58
58
  */
59
- function get(_ref3) {
60
- var token = _ref3.token,
61
- amenityGroupId = _ref3.amenityGroupId,
62
- _ref3$query = _ref3.query,
63
- query = _ref3$query === undefined ? {} : _ref3$query,
64
- headers = _ref3.headers;
65
-
66
- return client.get("/amenity-groups/" + amenityGroupId, {
59
+ function get({
60
+ token,
61
+ amenityGroupId,
62
+ query = {},
63
+ headers
64
+ }) {
65
+ return client.get(`/amenity-groups/${amenityGroupId}`, {
67
66
  params: query,
68
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
67
+ headers: authorizationHeaders({
68
+ token,
69
+ internalAuthTokenProvider,
70
+ headers
71
+ })
69
72
  });
70
73
  }
71
74
 
@@ -78,17 +81,24 @@ function amenityGroupsFactory(_ref) {
78
81
  * @param {Object} [opts.headers] - Optional headers
79
82
  * @returns {Promise<import("axios").AxiosResponse>}
80
83
  */
81
- function create(_ref4) {
82
- var token = _ref4.token,
83
- jwtToken = _ref4.jwtToken,
84
- amenityGroup = _ref4.amenityGroup,
85
- headers = _ref4.headers;
86
-
84
+ function create({
85
+ token,
86
+ jwtToken,
87
+ amenityGroup,
88
+ headers
89
+ }) {
87
90
  return client({
88
91
  url: "/amenity-groups",
89
92
  method: "post",
90
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
91
- data: { amenityGroup: amenityGroup }
93
+ headers: authorizationHeaders({
94
+ token,
95
+ jwtToken,
96
+ internalAuthTokenProvider,
97
+ headers
98
+ }),
99
+ data: {
100
+ amenityGroup
101
+ }
92
102
  });
93
103
  }
94
104
 
@@ -102,27 +112,32 @@ function amenityGroupsFactory(_ref) {
102
112
  * @param {Object} [opts.headers] - Optional headers
103
113
  * @returns {Promise<import("axios").AxiosResponse>}
104
114
  */
105
- function update(_ref5) {
106
- var token = _ref5.token,
107
- jwtToken = _ref5.jwtToken,
108
- amenityGroupId = _ref5.amenityGroupId,
109
- amenityGroup = _ref5.amenityGroup,
110
- headers = _ref5.headers;
111
-
115
+ function update({
116
+ token,
117
+ jwtToken,
118
+ amenityGroupId,
119
+ amenityGroup,
120
+ headers
121
+ }) {
112
122
  return client({
113
- url: "/amenity-groups/" + amenityGroupId,
123
+ url: `/amenity-groups/${amenityGroupId}`,
114
124
  method: "put",
115
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
116
- data: { amenityGroup: amenityGroup }
125
+ headers: authorizationHeaders({
126
+ token,
127
+ jwtToken,
128
+ internalAuthTokenProvider,
129
+ headers
130
+ }),
131
+ data: {
132
+ amenityGroup
133
+ }
117
134
  });
118
135
  }
119
-
120
136
  return {
121
- all: all,
122
- get: get,
123
- create: create,
124
- update: update
137
+ all,
138
+ get,
139
+ create,
140
+ update
125
141
  };
126
142
  }
127
-
128
143
  module.exports = amenityGroupsFactory;