btrz-api-client 8.34.0 → 8.35.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 (99) hide show
  1. package/lib/client-standalone-min.js +3 -3
  2. package/lib/client.js +4 -0
  3. package/lib/endpoints/inventory/banks.js +39 -21
  4. package/lib/endpoints/inventory/change-requests.js +59 -31
  5. package/lib/endpoints/inventory/control-classes.js +39 -20
  6. package/lib/endpoints/inventory/countries.js +25 -9
  7. package/lib/endpoints/inventory/custom-content.js +39 -21
  8. package/lib/endpoints/inventory/custom-fields.js +25 -17
  9. package/lib/endpoints/inventory/document-types.js +33 -42
  10. package/lib/endpoints/inventory/external-wallets.js +26 -20
  11. package/lib/endpoints/inventory/fees.js +19 -13
  12. package/lib/endpoints/inventory/filtered-trips.js +34 -8
  13. package/lib/endpoints/inventory/financing-costs.js +19 -14
  14. package/lib/endpoints/inventory/garages.js +19 -14
  15. package/lib/endpoints/inventory/getnet-terminals.js +20 -15
  16. package/lib/endpoints/inventory/gift-certificate-definitions.js +10 -5
  17. package/lib/endpoints/inventory/holidays.js +158 -0
  18. package/lib/endpoints/inventory/insurances.js +17 -13
  19. package/lib/endpoints/inventory/items.js +13 -9
  20. package/lib/endpoints/inventory/labels.js +16 -11
  21. package/lib/endpoints/inventory/marital-status.js +16 -11
  22. package/lib/endpoints/inventory/marketplace-modifiers.js +16 -11
  23. package/lib/endpoints/inventory/mit-terminal-settings.js +15 -10
  24. package/lib/endpoints/inventory/mit-terminals.js +16 -11
  25. package/lib/endpoints/inventory/operation-messages.js +18 -12
  26. package/lib/endpoints/inventory/operation-reasons.js +15 -10
  27. package/lib/endpoints/inventory/pay-on-accounts.js +5 -4
  28. package/lib/endpoints/inventory/payment-terminals.js +15 -10
  29. package/lib/endpoints/inventory/products.js +22 -10
  30. package/lib/endpoints/inventory/promos.js +27 -18
  31. package/lib/endpoints/inventory/station-groups.js +2 -4
  32. package/lib/endpoints/inventory/taxes.js +11 -2
  33. package/lib/endpoints/inventory/traveller-card-providers-types.js +6 -6
  34. package/lib/endpoints/inventory/vehicle-types.js +2 -5
  35. package/lib/endpoints/inventory/vehicles.js +4 -2
  36. package/lib/endpoints/notifications/customers.js +1 -1
  37. package/lib/endpoints/notifications/external-customers.js +54 -0
  38. package/lib/endpoints/notifications/pdfs.js +0 -3
  39. package/lib/endpoints/operations/accounting_items.js +7 -1
  40. package/lib/endpoints/operations/flexpasses.js +9 -7
  41. package/lib/endpoints/operations/gift-certificates.js +53 -0
  42. package/lib/endpoints/operations/loans.js +16 -10
  43. package/lib/endpoints/operations/movements.js +17 -6
  44. package/lib/endpoints/operations/pago-express.js +96 -0
  45. package/lib/endpoints/operations/parcels.js +11 -11
  46. package/lib/endpoints/operations/parcels_manifests.js +7 -4
  47. package/package.json +1 -1
  48. package/src/client.js +4 -0
  49. package/src/endpoints/inventory/banks.js +39 -21
  50. package/src/endpoints/inventory/change-requests.js +59 -31
  51. package/src/endpoints/inventory/control-classes.js +39 -20
  52. package/src/endpoints/inventory/countries.js +25 -10
  53. package/src/endpoints/inventory/custom-content.js +39 -22
  54. package/src/endpoints/inventory/custom-fields.js +25 -19
  55. package/src/endpoints/inventory/document-types.js +34 -33
  56. package/src/endpoints/inventory/external-wallets.js +25 -20
  57. package/src/endpoints/inventory/fees.js +19 -14
  58. package/src/endpoints/inventory/filtered-trips.js +29 -8
  59. package/src/endpoints/inventory/financing-costs.js +19 -14
  60. package/src/endpoints/inventory/garages.js +19 -14
  61. package/src/endpoints/inventory/getnet-terminals.js +20 -15
  62. package/src/endpoints/inventory/gift-certificate-definitions.js +10 -5
  63. package/src/endpoints/inventory/holidays.js +121 -0
  64. package/src/endpoints/inventory/insurances.js +17 -13
  65. package/src/endpoints/inventory/items.js +13 -9
  66. package/src/endpoints/inventory/labels.js +16 -11
  67. package/src/endpoints/inventory/marital-status.js +16 -11
  68. package/src/endpoints/inventory/marketplace-modifiers.js +16 -11
  69. package/src/endpoints/inventory/mit-terminal-settings.js +15 -10
  70. package/src/endpoints/inventory/mit-terminals.js +16 -11
  71. package/src/endpoints/inventory/operation-messages.js +18 -12
  72. package/src/endpoints/inventory/operation-reasons.js +15 -10
  73. package/src/endpoints/inventory/pay-on-accounts.js +5 -4
  74. package/src/endpoints/inventory/payment-terminals.js +15 -10
  75. package/src/endpoints/inventory/products.js +22 -10
  76. package/src/endpoints/inventory/promos.js +27 -18
  77. package/src/endpoints/inventory/station-groups.js +2 -4
  78. package/src/endpoints/inventory/taxes.js +11 -2
  79. package/src/endpoints/inventory/traveller-card-providers-types.js +6 -5
  80. package/src/endpoints/inventory/vehicle-types.js +3 -4
  81. package/src/endpoints/inventory/vehicles.js +4 -3
  82. package/src/endpoints/notifications/customers.js +1 -1
  83. package/src/endpoints/notifications/external-customers.js +41 -0
  84. package/src/endpoints/notifications/pdfs.js +0 -3
  85. package/src/endpoints/operations/accounting_items.js +7 -2
  86. package/src/endpoints/operations/flexpasses.js +9 -7
  87. package/src/endpoints/operations/gift-certificates.js +39 -0
  88. package/src/endpoints/operations/loans.js +16 -11
  89. package/src/endpoints/operations/movements.js +17 -6
  90. package/src/endpoints/operations/pago-express.js +73 -0
  91. package/src/endpoints/operations/parcels.js +11 -11
  92. package/src/endpoints/operations/parcels_manifests.js +7 -5
  93. package/test/endpoints/inventory/banks.test.js +8 -10
  94. package/test/endpoints/inventory/filtered-trips.test.js +6 -0
  95. package/test/endpoints/inventory/holidays.test.js +52 -0
  96. package/test/endpoints/inventory/traveller-card-providers-types.test.js +3 -2
  97. package/test/endpoints/notifications/external-customers.test.js +30 -0
  98. package/test/endpoints/operations/gift_certificates.test.js +37 -0
  99. package/test/endpoints/operations/operations.test.js +30 -0
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+
3
+ var _require = require("../endpoints_helpers.js"),
4
+ authorizationHeaders = _require.authorizationHeaders;
5
+
6
+ /**
7
+ * Pago Express (Datalogic) endpoints for the Operations API.
8
+ * Used to get info, pay, and reverse reference payments.
9
+ * @param {Object} deps
10
+ * @param {import("axios").AxiosInstance} deps.client
11
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
12
+ * @returns {Object} pagoExpress API methods
13
+ */
14
+
15
+
16
+ function pagoExpressFactory(_ref) {
17
+ var client = _ref.client,
18
+ internalAuthTokenProvider = _ref.internalAuthTokenProvider;
19
+
20
+ /**
21
+ * POST /pago-express/info - get transaction information for a Pago Express reference.
22
+ * @param {Object} opts
23
+ * @param {string} [opts.token] - API key (x-api-key)
24
+ * @param {string} [opts.jwtToken] - JWT or internal auth
25
+ * @param {Object} opts.payment - Request body: folio (20-digit string), id_terminal (number), local_date (string DD/MM/YYYY HH:mm:ss), trx_no (number)
26
+ * @param {Object} [opts.headers] - Optional headers
27
+ * @returns {Promise<import("axios").AxiosResponse>} 200 PostInfoResponse (code, message, result with folio, id_terminal, local_date, saldo, trx_no, responsecode, descriptioncode)
28
+ */
29
+ function info(_ref2) {
30
+ var token = _ref2.token,
31
+ jwtToken = _ref2.jwtToken,
32
+ payment = _ref2.payment,
33
+ headers = _ref2.headers;
34
+
35
+ return client({
36
+ method: "post",
37
+ url: "/pago-express/info",
38
+ data: { payment: payment },
39
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
40
+ });
41
+ }
42
+
43
+ /**
44
+ * POST /pago-express/pay - pay a Pago Express reference payment.
45
+ * @param {Object} opts
46
+ * @param {string} [opts.token] - API key (x-api-key)
47
+ * @param {string} [opts.jwtToken] - JWT or internal auth
48
+ * @param {Object} opts.payment - Request body: folio, id_terminal, local_date, trx_no, amount (string)
49
+ * @param {Object} [opts.headers] - Optional headers
50
+ * @returns {Promise<import("axios").AxiosResponse>} 200 PostPayResponse (code, message, result with folio, id_terminal, local_date, trx_no, noauto, amount, responsecode, descriptioncode)
51
+ */
52
+ function pay(_ref3) {
53
+ var token = _ref3.token,
54
+ jwtToken = _ref3.jwtToken,
55
+ payment = _ref3.payment,
56
+ headers = _ref3.headers;
57
+
58
+ return client({
59
+ method: "post",
60
+ url: "/pago-express/pay",
61
+ data: { payment: payment },
62
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
63
+ });
64
+ }
65
+
66
+ /**
67
+ * POST /pago-express/reverse - reverse (cancel) a Pago Express reference payment. Emits transaction.reversed webhook.
68
+ * @param {Object} opts
69
+ * @param {string} [opts.token] - API key (x-api-key)
70
+ * @param {string} [opts.jwtToken] - JWT or internal auth
71
+ * @param {Object} opts.reversePayment - Request body: folio, id_terminal, local_date, trx_no, amount (string)
72
+ * @param {Object} [opts.headers] - Optional headers
73
+ * @returns {Promise<import("axios").AxiosResponse>} 200 PostReverseResponse (code, message, result)
74
+ */
75
+ function reverse(_ref4) {
76
+ var token = _ref4.token,
77
+ jwtToken = _ref4.jwtToken,
78
+ reversePayment = _ref4.reversePayment,
79
+ headers = _ref4.headers;
80
+
81
+ return client({
82
+ method: "post",
83
+ url: "/pago-express/reverse",
84
+ data: { reversePayment: reversePayment },
85
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
86
+ });
87
+ }
88
+
89
+ return {
90
+ info: info,
91
+ pay: pay,
92
+ reverse: reverse
93
+ };
94
+ }
95
+
96
+ module.exports = pagoExpressFactory;
@@ -38,13 +38,13 @@ function parcelFactory(_ref) {
38
38
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
39
39
 
40
40
  /**
41
- * GET /parcels/:id - get parcel by id. API does not accept query params.
41
+ * GET /parcels/{parcelId} - get parcel by id. Requires JwtAuth. No query params.
42
42
  * @param {Object} opts
43
43
  * @param {string} [opts.token] - API key
44
44
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
45
- * @param {string} opts.id - Parcel id
45
+ * @param {string} opts.id - Parcel id (24 hex characters)
46
46
  * @param {Object} [opts.headers] - Optional headers
47
- * @returns {Promise<import("axios").AxiosResponse>}
47
+ * @returns {Promise<import("axios").AxiosResponse>} 200 { parcel }; 400 INVALID_PARCEL_ID; 401 Unauthorized; 404 PARCEL_NOT_FOUND; 500
48
48
  */
49
49
  function get(_ref2) {
50
50
  var token = _ref2.token,
@@ -112,14 +112,14 @@ function parcelFactory(_ref) {
112
112
  }
113
113
 
114
114
  /**
115
- * POST /parcels/:id/user-comments - add comment to parcel. API does not accept query params.
115
+ * POST /parcels/{parcelId}/user-comments - add user comment to parcel. Requires JwtAuth. Body: { comment } (string).
116
116
  * @param {Object} opts
117
117
  * @param {string} [opts.token] - API key
118
118
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
119
- * @param {string} opts.id - Parcel id
120
- * @param {Object} opts.comment - Comment payload
119
+ * @param {string} opts.id - Parcel id (path parcelId)
120
+ * @param {string} opts.comment - Comment text (sent as body.comment)
121
121
  * @param {Object} [opts.headers] - Optional headers
122
- * @returns {Promise<import("axios").AxiosResponse>}
122
+ * @returns {Promise<import("axios").AxiosResponse>} 200 ParcelUserComment; 400 MISSING_*; 401; 403; 404 PARCEL_NOT_FOUND; 409
123
123
  */
124
124
  function addComment(_ref5) {
125
125
  var token = _ref5.token,
@@ -137,14 +137,14 @@ function parcelFactory(_ref) {
137
137
  }
138
138
 
139
139
  /**
140
- * DELETE /parcels/:id/user-comments/:commentId - delete parcel comment. API does not accept query params.
140
+ * DELETE /parcels/{parcelId}/user-comments/{commentId} - delete user comment from parcel. Requires JwtAuth.
141
141
  * @param {Object} opts
142
142
  * @param {string} [opts.token] - API key
143
143
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
144
- * @param {string} opts.id - Parcel id
145
- * @param {string} opts.commentId - Comment id
144
+ * @param {string} opts.id - Parcel id (path parcelId)
145
+ * @param {string} opts.commentId - Comment id (path)
146
146
  * @param {Object} [opts.headers] - Optional headers
147
- * @returns {Promise<import("axios").AxiosResponse>}
147
+ * @returns {Promise<import("axios").AxiosResponse>} 200 deleted ParcelUserComment; 400 MISSING_*; 401; 403; 404 PARCEL_NOT_FOUND, COMMENT_NOT_FOUND; 409
148
148
  */
149
149
  function deleteComment(_ref6) {
150
150
  var token = _ref6.token,
@@ -53,24 +53,27 @@ function parcelsManifestsFactory(_ref) {
53
53
  }
54
54
 
55
55
  /**
56
- * GET /parcels-manifests/:id - get parcels manifest by id. API does not accept query params.
56
+ * GET /parcels-manifests/:id - get parcels manifest by id.
57
57
  * @param {Object} opts
58
58
  * @param {string} [opts.token] - API key
59
59
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
60
- * @param {string} opts.id - Parcel manifest id (ObjectId)
60
+ * @param {string} opts.id - Parcel manifest id (ObjectId, 24 hex chars)
61
+ * @param {"standard"|"webhook"} [opts.format="standard"] - Response format (standard | webhook)
61
62
  * @param {Object} [opts.headers] - Optional request headers
62
- * @returns {Promise<import("axios").AxiosResponse>} response.data parcel manifest; 404 PARCELMANIFEST_NOT_FOUND
63
+ * @returns {Promise<import("axios").AxiosResponse>} response.data parcel manifest; 400 WRONG_DATA; 404 MANIFEST_NOT_FOUND, PARCELMANIFEST_NOT_FOUND
63
64
  */
64
65
  function get(_ref3) {
65
66
  var token = _ref3.token,
66
67
  jwtToken = _ref3.jwtToken,
67
68
  id = _ref3.id,
69
+ format = _ref3.format,
68
70
  headers = _ref3.headers;
69
71
 
70
72
  return client({
71
73
  url: "/parcels-manifests/" + id,
72
74
  method: "get",
73
- headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
75
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
76
+ params: format != null ? { format: format } : undefined
74
77
  });
75
78
  }
76
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "8.34.0",
3
+ "version": "8.35.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/client.js CHANGED
@@ -85,6 +85,7 @@ function createInventory({baseURL, headers, timeout, overrideFn, internalAuthTok
85
85
  getnetTerminals: require("./endpoints/inventory/getnet-terminals.js")({client, internalAuthTokenProvider}),
86
86
  giftCertificateDefinitions: require("./endpoints/inventory/gift-certificate-definitions.js")({client, internalAuthTokenProvider}),
87
87
  healthCheck: require("./endpoints/inventory/healthcheck.js")({client, internalAuthTokenProvider}),
88
+ holidays: require("./endpoints/inventory/holidays.js")({client, internalAuthTokenProvider}),
88
89
  insurances: require("./endpoints/inventory/insurances.js")({client, internalAuthTokenProvider}),
89
90
  insurancesCost: require("./endpoints/inventory/insurancesCost.js")({client, internalAuthTokenProvider}),
90
91
  items: require("./endpoints/inventory/items.js")({client, internalAuthTokenProvider}),
@@ -293,11 +294,13 @@ function createOperations({baseURL, headers, timeout, overrideFn, internalAuthTo
293
294
  calendarEntries: require("./endpoints/operations/calendar_entries.js")({client, internalAuthTokenProvider}),
294
295
  externalBookings: require("./endpoints/operations/external-bookings.js")({client, internalAuthTokenProvider}),
295
296
  flexpasses: require("./endpoints/operations/flexpasses.js")({client, internalAuthTokenProvider}),
297
+ giftCertificates: require("./endpoints/operations/gift-certificates.js")({client, internalAuthTokenProvider}),
296
298
  loans: require("./endpoints/operations/loans.js")({client, internalAuthTokenProvider}),
297
299
  manifest: require("./endpoints/operations/manifest.js")({client, internalAuthTokenProvider}),
298
300
  manifestLegForTickets: require("./endpoints/operations/manifest_leg_for_tickets.js")({client, internalAuthTokenProvider}),
299
301
  movements: require("./endpoints/operations/movements.js")({client, internalAuthTokenProvider}),
300
302
  outlookTrips: require("./endpoints/operations/outlook-trips.js")({client, internalAuthTokenProvider}),
303
+ pagoExpress: require("./endpoints/operations/pago-express.js")({client, internalAuthTokenProvider}),
301
304
  parcel: require("./endpoints/operations/parcels.js")({client, internalAuthTokenProvider}),
302
305
  parcelManifests: require("./endpoints/operations/parcels_manifests.js")({client, internalAuthTokenProvider}),
303
306
  passengerCheckInInfo: require("./endpoints/operations/passenger_check_in_info.js")({client, internalAuthTokenProvider}),
@@ -356,6 +359,7 @@ function createNotifications({baseURL, headers, timeout, overrideFn, internalAut
356
359
  pdfData: require("./endpoints/notifications/pdf-data.js")({client, internalAuthTokenProvider}),
357
360
  email: require("./endpoints/notifications/email.js")({client, internalAuthTokenProvider}),
358
361
  customers: require("./endpoints/notifications/customers.js")({client, internalAuthTokenProvider}),
362
+ externalCustomers: require("./endpoints/notifications/external-customers.js")({client, internalAuthTokenProvider}),
359
363
  twilio: require("./endpoints/notifications/twilio.js")({client, internalAuthTokenProvider}),
360
364
  salesforce: require("./endpoints/notifications/salesforce.js")({client, internalAuthTokenProvider}),
361
365
  notify: require("./endpoints/notifications/notify.js")({client, internalAuthTokenProvider}),
@@ -11,12 +11,15 @@ const {
11
11
  */
12
12
  function banksFactory({client, internalAuthTokenProvider}) {
13
13
  /**
14
- * GET /banks - list banks. API does not accept query params.
14
+ * GET /banks List banks for the account. Paginated; optional page query param (1-based).
15
15
  * @param {Object} opts
16
- * @param {string} [opts.token] - API key
17
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
16
+ * @param {string} [opts.token] - API key (X-API-KEY)
17
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
18
+ * @param {Object} [opts.query] - Query params: page (1-based page number)
18
19
  * @param {Object} [opts.headers] - Optional headers
19
- * @returns {Promise<import("axios").AxiosResponse>}
20
+ * @returns {Promise<import("axios").AxiosResponse<{ banks: Object[], count: number, next: string, previous: string }>>}
21
+ * @throws 401 Unauthorized
22
+ * @throws 500 Internal server error
20
23
  */
21
24
  function all({
22
25
  token,
@@ -31,13 +34,17 @@ function banksFactory({client, internalAuthTokenProvider}) {
31
34
  }
32
35
 
33
36
  /**
34
- * GET /banks/:bankId - get bank by id. API does not accept query params.
37
+ * GET /banks/:bankId Get a single bank by ID (24 hex characters).
35
38
  * @param {Object} opts
36
39
  * @param {string} [opts.token] - API key
37
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
38
- * @param {string} opts.bankId - Bank id
40
+ * @param {string} [opts.jwtToken] - JWT or internal auth
41
+ * @param {string} opts.bankId - Bank id (24 hex characters)
39
42
  * @param {Object} [opts.headers] - Optional headers
40
- * @returns {Promise<import("axios").AxiosResponse>}
43
+ * @returns {Promise<import("axios").AxiosResponse<{ bank: Object }>>}
44
+ * @throws 400 INVALID_BANK_ID
45
+ * @throws 401 Unauthorized
46
+ * @throws 404 BANK_NOT_FOUND
47
+ * @throws 500 Internal server error
41
48
  */
42
49
  function get({bankId, token, headers, jwtToken}) {
43
50
  return client.get(`/banks/${bankId}`, {
@@ -46,13 +53,16 @@ function banksFactory({client, internalAuthTokenProvider}) {
46
53
  }
47
54
 
48
55
  /**
49
- * POST /banks - create bank. API does not accept query params.
56
+ * POST /banks Create a bank. Body: BankPostData (name, accountNumbers required; optional depositAlgorithmCode).
50
57
  * @param {Object} opts
51
58
  * @param {string} [opts.token] - API key
52
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
53
- * @param {Object} opts.bank - Bank payload
59
+ * @param {string} [opts.jwtToken] - JWT or internal auth
60
+ * @param {Object} opts.bank - Bank payload (name, accountNumbers; each accountNumber: number, currency, alias)
54
61
  * @param {Object} [opts.headers] - Optional headers
55
- * @returns {Promise<import("axios").AxiosResponse>}
62
+ * @returns {Promise<import("axios").AxiosResponse<{ bank: Object }>>}
63
+ * @throws 400 WRONG_DATA, STATION_INVALID_COST_CENTER
64
+ * @throws 401 Unauthorized
65
+ * @throws 500 Internal server error
56
66
  */
57
67
  function create({jwtToken, token, bank, headers}) {
58
68
  return client({
@@ -66,13 +76,17 @@ function banksFactory({client, internalAuthTokenProvider}) {
66
76
  }
67
77
 
68
78
  /**
69
- * DELETE /banks/:bankId - remove bank. API does not accept query params.
79
+ * DELETE /banks/:bankId Delete a bank by ID.
70
80
  * @param {Object} opts
71
81
  * @param {string} [opts.token] - API key
72
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
73
- * @param {string} opts.bankId - Bank id
82
+ * @param {string} [opts.jwtToken] - JWT or internal auth
83
+ * @param {string} opts.bankId - Bank id (24 hex characters)
74
84
  * @param {Object} [opts.headers] - Optional headers
75
- * @returns {Promise<import("axios").AxiosResponse>}
85
+ * @returns {Promise<import("axios").AxiosResponse<{ bankId: string }>>}
86
+ * @throws 400 BANK_ID
87
+ * @throws 401 Unauthorized
88
+ * @throws 404 BANK_NOT_FOUND
89
+ * @throws 500 Internal server error
76
90
  */
77
91
  function remove({jwtToken, bankId, token, headers}) {
78
92
  return client({
@@ -83,14 +97,18 @@ function banksFactory({client, internalAuthTokenProvider}) {
83
97
  }
84
98
 
85
99
  /**
86
- * PUT /banks/:bankId - update bank. API does not accept query params.
100
+ * PUT /banks/:bankId Update a bank by ID. Body: BankPostData (name, accountNumbers required).
87
101
  * @param {Object} opts
88
102
  * @param {string} [opts.token] - API key
89
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
90
- * @param {string} opts.bankId - Bank id
91
- * @param {Object} opts.bank - Bank payload
103
+ * @param {string} [opts.jwtToken] - JWT or internal auth
104
+ * @param {string} opts.bankId - Bank id (24 hex characters)
105
+ * @param {Object} opts.bank - Bank payload (name, accountNumbers; each accountNumber: number, currency, alias)
92
106
  * @param {Object} [opts.headers] - Optional headers
93
- * @returns {Promise<import("axios").AxiosResponse>}
107
+ * @returns {Promise<import("axios").AxiosResponse<{ bank: Object }>>}
108
+ * @throws 400 WRONG_DATA, STATION_INVALID_COST_CENTER
109
+ * @throws 401 Unauthorized
110
+ * @throws 404 BANK_NOT_FOUND
111
+ * @throws 500 Internal server error
94
112
  */
95
113
  function update({jwtToken, token, bankId, bank, headers}) {
96
114
  return client({
@@ -25,13 +25,16 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
25
25
  */
26
26
  function changeRequestsFactory({client, internalAuthTokenProvider}) {
27
27
  /**
28
- * GET /change-requests - list change requests.
28
+ * GET /change-requests List change requests with optional filters and pagination.
29
29
  * @param {Object} opts
30
- * @param {string} [opts.token] - API key
31
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
32
- * @param {ChangeRequestsListQuery} [opts.query] - Query params
30
+ * @param {string} [opts.token] - API key (X-API-KEY)
31
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
32
+ * @param {ChangeRequestsListQuery} [opts.query] - Query params (type, status, createdBy, from, to, etc.)
33
33
  * @param {Object} [opts.headers] - Optional headers
34
- * @returns {Promise<import("axios").AxiosResponse>}
34
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequests: Object[], count: number, next: string, previous: string }>>}
35
+ * @throws 400 INVALID_PAGE, INVALID_TYPE_PARAMETER, INVALID_STATUS_PARAMETER, etc.
36
+ * @throws 401 Unauthorized
37
+ * @throws 500 Internal server error
35
38
  */
36
39
  function all({token, jwtToken, query = {}, headers}) {
37
40
  return client.get("/change-requests", {
@@ -41,13 +44,18 @@ function changeRequestsFactory({client, internalAuthTokenProvider}) {
41
44
  }
42
45
 
43
46
  /**
44
- * GET /change-requests/:changerequestId/manifests - get change request manifests. API does not accept query params.
47
+ * GET /change-requests/:changerequestId/manifests Get manifest change request by ID. Requires multipleManifestEditing.
45
48
  * @param {Object} opts
46
49
  * @param {string} [opts.token] - API key
47
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
48
- * @param {string} opts.changerequestId - Change request id
50
+ * @param {string} [opts.jwtToken] - JWT or internal auth
51
+ * @param {string} opts.changerequestId - Change request id (24 hex characters)
49
52
  * @param {Object} [opts.headers] - Optional headers
50
- * @returns {Promise<import("axios").AxiosResponse>}
53
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
54
+ * @throws 400 INVALID_CHANGEREQUEST_ID, FAILED_TO_FETCH_OPERATION_SETTINGS
55
+ * @throws 401 Unauthorized
56
+ * @throws 403 MULTIPLE_MANIFEST_EDIT_NOT_ALLOWED
57
+ * @throws 404 CHANGEREQUEST_NOT_FOUND
58
+ * @throws 500 Internal server error
51
59
  */
52
60
  function get({changerequestId, token, jwtToken, query = {}, headers}) {
53
61
  return client({
@@ -58,13 +66,17 @@ function changeRequestsFactory({client, internalAuthTokenProvider}) {
58
66
  }
59
67
 
60
68
  /**
61
- * POST /change-requests/manifests - create change request manifest. API does not accept query params.
69
+ * POST /change-requests/manifests Create manifest change request. Emits changeRequests.manifests.created.
62
70
  * @param {Object} opts
63
71
  * @param {string} [opts.token] - API key
64
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
65
- * @param {Object} opts.data - Manifest payload
72
+ * @param {string} [opts.jwtToken] - JWT or internal auth
73
+ * @param {Object} opts.data - Manifest change request payload (manifestId, request, routeId, scheduleId, date, etc.)
66
74
  * @param {Object} [opts.headers] - Optional headers
67
- * @returns {Promise<import("axios").AxiosResponse>}
75
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
76
+ * @throws 400 WRONG_DATA, FAILED_TO_FETCH_OPERATION_SETTINGS, MANIFEST_NOT_FOUND, etc.
77
+ * @throws 401 Unauthorized
78
+ * @throws 403 MULTIPLE_MANIFEST_EDIT_NOT_ALLOWED
79
+ * @throws 500 Internal server error
68
80
  */
69
81
  function create({data, token, jwtToken, headers}) {
70
82
  return client({
@@ -76,14 +88,19 @@ function changeRequestsFactory({client, internalAuthTokenProvider}) {
76
88
  }
77
89
 
78
90
  /**
79
- * PUT /change-requests/:changerequestId/manifests - update change request manifest. API does not accept query params.
91
+ * PUT /change-requests/:changerequestId/manifests Update manifest change request. Emits changeRequests.manifests.updated.
80
92
  * @param {Object} opts
81
93
  * @param {string} [opts.token] - API key
82
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
83
- * @param {string} opts.changerequestId - Change request id
84
- * @param {Object} opts.data - Manifest payload
94
+ * @param {string} [opts.jwtToken] - JWT or internal auth
95
+ * @param {string} opts.changerequestId - Change request id (24 hex characters)
96
+ * @param {Object} opts.data - Update payload (status: 'approved' or 'rejected')
85
97
  * @param {Object} [opts.headers] - Optional headers
86
- * @returns {Promise<import("axios").AxiosResponse>}
98
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
99
+ * @throws 400 WRONG_DATA, CHANGEREQUEST_STATUS_NOT_PENDING, etc.
100
+ * @throws 401 Unauthorized
101
+ * @throws 403 MULTIPLE_MANIFEST_EDIT_NOT_ALLOWED
102
+ * @throws 404 CHANGEREQUEST_NOT_FOUND
103
+ * @throws 500 Internal server error
87
104
  */
88
105
  function update({changerequestId, data, token, jwtToken, headers}) {
89
106
  return client({
@@ -97,13 +114,17 @@ function changeRequestsFactory({client, internalAuthTokenProvider}) {
97
114
  /** @type {{ get: function, create: function, update: function }} */
98
115
  const schedules = {
99
116
  /**
100
- * GET /change-requests/:changeRequestId/schedules - get change request schedules. API does not accept query params.
117
+ * GET /change-requests/:changeRequestId/schedules Get schedule change request by ID.
101
118
  * @param {Object} opts
102
119
  * @param {string} [opts.token] - API key
103
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
104
- * @param {string} opts.changeRequestId - Change request id
120
+ * @param {string} [opts.jwtToken] - JWT or internal auth
121
+ * @param {string} opts.changeRequestId - Change request id (24 hex characters)
105
122
  * @param {Object} [opts.headers] - Optional headers
106
- * @returns {Promise<import("axios").AxiosResponse>}
123
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
124
+ * @throws 400 INVALID_CHANGEREQUEST_ID, FAILED_TO_FETCH_OPERATION_SETTINGS, etc.
125
+ * @throws 401 Unauthorized
126
+ * @throws 404 CHANGEREQUEST_NOT_FOUND
127
+ * @throws 500 Internal server error
107
128
  */
108
129
  get({changeRequestId, token, jwtToken, query = {}, headers}) {
109
130
  return client({
@@ -114,13 +135,16 @@ function changeRequestsFactory({client, internalAuthTokenProvider}) {
114
135
  },
115
136
 
116
137
  /**
117
- * POST /change-requests/schedules - create change request schedule. API does not accept query params.
138
+ * POST /change-requests/schedules Create a schedule change request. Emits webhook changeRequests.schedules.created.
118
139
  * @param {Object} opts
119
140
  * @param {string} [opts.token] - API key
120
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
121
- * @param {Object} opts.data - Schedule payload
141
+ * @param {string} [opts.jwtToken] - JWT or internal auth
142
+ * @param {Object} opts.data - Schedule change request payload (request, routeId, scheduleId, legs, etc.)
122
143
  * @param {Object} [opts.headers] - Optional headers
123
- * @returns {Promise<import("axios").AxiosResponse>}
144
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
145
+ * @throws 400 WRONG_DATA, FAILED_TO_FETCH_OPERATION_SETTINGS, etc.
146
+ * @throws 401 Unauthorized
147
+ * @throws 500 Internal server error
124
148
  */
125
149
  create({data, token, jwtToken, headers}) {
126
150
  return client({
@@ -132,14 +156,18 @@ function changeRequestsFactory({client, internalAuthTokenProvider}) {
132
156
  },
133
157
 
134
158
  /**
135
- * PUT /change-requests/:changeRequestId/schedules - update change request schedule. API does not accept query params.
159
+ * PUT .../schedules Update schedule change request (approve/reject). Emits changeRequests.schedules.updated.
136
160
  * @param {Object} opts
137
161
  * @param {string} [opts.token] - API key
138
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
139
- * @param {string} opts.changeRequestId - Change request id
140
- * @param {Object} opts.data - Schedule payload
162
+ * @param {string} [opts.jwtToken] - JWT or internal auth
163
+ * @param {string} opts.changeRequestId - Change request id (24 hex characters)
164
+ * @param {Object} opts.data - Update payload (status: 'approved' or 'rejected')
141
165
  * @param {Object} [opts.headers] - Optional headers
142
- * @returns {Promise<import("axios").AxiosResponse>}
166
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
167
+ * @throws 400 WRONG_DATA, CHANGEREQUEST_STATUS_NOT_PENDING, etc.
168
+ * @throws 401 Unauthorized
169
+ * @throws 404 CHANGEREQUEST_NOT_FOUND
170
+ * @throws 500 Internal server error
143
171
  */
144
172
  update({changeRequestId, data, token, jwtToken, headers}) {
145
173
  return client({
@@ -41,13 +41,17 @@ const {
41
41
  */
42
42
  function controlClassesFactory({client, internalAuthTokenProvider}) {
43
43
  /**
44
- * GET /control-classes - list control classes.
44
+ * GET /control-classes List control class roots (paginated). Emits no webhooks.
45
45
  * @param {Object} opts
46
46
  * @param {string} [opts.token] - API key
47
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
47
+ * @param {string} [opts.jwtToken] - JWT or internal auth
48
48
  * @param {ControlClassesListQuery} [opts.query] - Query params
49
49
  * @param {Object} [opts.headers] - Optional headers
50
- * @returns {Promise<import("axios").AxiosResponse>}
50
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClasses: Object[], authorizationsEnabled?: boolean }>>}
51
+ * @throws 400 INVALID_PAGE, INVALID_SCHEDULE_ID, INVALID_ASSIGNED_SCHEDULE_ID
52
+ * @throws 401 Unauthorized
53
+ * @throws 404 SCHEDULE_NOT_FOUND
54
+ * @throws 500 Internal server error
51
55
  */
52
56
  function all({
53
57
  token,
@@ -62,14 +66,18 @@ function controlClassesFactory({client, internalAuthTokenProvider}) {
62
66
  }
63
67
 
64
68
  /**
65
- * GET /control-classes/:controlClassId - get control class by id.
69
+ * GET /control-classes/:controlClassId Get one control class (optional tree, schedules).
66
70
  * @param {Object} opts
67
71
  * @param {string} [opts.token] - API key
68
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
69
- * @param {string} opts.controlClassId - Control class id
72
+ * @param {string} [opts.jwtToken] - JWT or internal auth
73
+ * @param {string} opts.controlClassId - Control class id (24 hex)
70
74
  * @param {ControlClassGetQuery} [opts.query] - Query params (tree, scheduleId, etc.)
71
75
  * @param {Object} [opts.headers] - Optional headers
72
- * @returns {Promise<import("axios").AxiosResponse>}
76
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClass, root?, parent?, siblings?, children?, schedules?, tree? }>>}
77
+ * @throws 400 INVALID_CONTROLCLASS_ID
78
+ * @throws 401 Unauthorized
79
+ * @throws 404 CONTROLCLASS_NOT_FOUND
80
+ * @throws 500 Internal server error
73
81
  */
74
82
  function get({controlClassId, token, headers, jwtToken, query = {}}) {
75
83
  return client.get(`/control-classes/${controlClassId}`, {
@@ -79,13 +87,16 @@ function controlClassesFactory({client, internalAuthTokenProvider}) {
79
87
  }
80
88
 
81
89
  /**
82
- * POST /control-classes - create control class. API does not accept query params.
90
+ * POST /control-classes Create control class. Body: { controlClass }. Emits controlclasses.created.
83
91
  * @param {Object} opts
84
92
  * @param {string} [opts.token] - API key
85
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
86
- * @param {Object} opts.controlClass - Control class payload
93
+ * @param {string} [opts.jwtToken] - JWT or internal auth
94
+ * @param {Object} opts.controlClass - ControlClassData (name, props required)
87
95
  * @param {Object} [opts.headers] - Optional headers
88
- * @returns {Promise<import("axios").AxiosResponse>}
96
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClass: Object }>>}
97
+ * @throws 400 WRONG_DATA, DUPLICATE_CLASS_NAME, NO_ROOT_PROPS, PARENT_CLASS_NOT_FOUND, etc.
98
+ * @throws 401 Unauthorized
99
+ * @throws 500 Internal server error
89
100
  */
90
101
  function create({jwtToken, token, controlClass, headers}) {
91
102
  return client({
@@ -99,13 +110,17 @@ function controlClassesFactory({client, internalAuthTokenProvider}) {
99
110
  }
100
111
 
101
112
  /**
102
- * DELETE /control-classes/:controlClassId - remove control class.
113
+ * DELETE /control-classes/:controlClassId Delete control class. Emits controlclasses.deleted.
103
114
  * @param {Object} opts
104
115
  * @param {string} [opts.token] - API key
105
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
106
- * @param {string} opts.controlClassId - Control class id
116
+ * @param {string} [opts.jwtToken] - JWT or internal auth
117
+ * @param {string} opts.controlClassId - Control class id (24 hex)
107
118
  * @param {Object} [opts.headers] - Optional headers
108
- * @returns {Promise<import("axios").AxiosResponse>}
119
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClassId: string }>>}
120
+ * @throws 400 INVALID_CONTROLCLASS_ID, CANNOT_DELETE_CLASS_WITH_CHILDREN
121
+ * @throws 401 Unauthorized
122
+ * @throws 404 CONTROLCLASS_NOT_FOUND
123
+ * @throws 500 Internal server error
109
124
  */
110
125
  function remove({jwtToken, controlClassId, token, headers}) {
111
126
  return client({
@@ -116,14 +131,18 @@ function controlClassesFactory({client, internalAuthTokenProvider}) {
116
131
  }
117
132
 
118
133
  /**
119
- * PUT /control-classes/:controlClassId - update control class. API does not accept query params.
134
+ * PUT /control-classes/:controlClassId Update control class. Body: { controlClass }. Emits controlclasses.updated.
120
135
  * @param {Object} opts
121
136
  * @param {string} [opts.token] - API key
122
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
123
- * @param {string} opts.controlClassId - Control class id
124
- * @param {Object} opts.controlClass - Control class payload
137
+ * @param {string} [opts.jwtToken] - JWT or internal auth
138
+ * @param {string} opts.controlClassId - Control class id (24 hex)
139
+ * @param {Object} opts.controlClass - ControlClassData (name, props required)
125
140
  * @param {Object} [opts.headers] - Optional headers
126
- * @returns {Promise<import("axios").AxiosResponse>}
141
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClass: Object }>>}
142
+ * @throws 400 WRONG_DATA, INVALID_CONTROLCLASS_ID, DUPLICATE_CLASS_NAME, etc.
143
+ * @throws 401 Unauthorized
144
+ * @throws 404 CONTROLCLASS_NOT_FOUND
145
+ * @throws 500 Internal server error
127
146
  */
128
147
  function update({jwtToken, token, controlClassId, controlClass, headers}) {
129
148
  return client({