btrz-api-client 8.34.0 → 8.36.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 +38 -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 +24 -17
  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 +38 -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 +24 -18
  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
package/lib/client.js CHANGED
@@ -98,6 +98,7 @@ function createInventory(_ref) {
98
98
  getnetTerminals: require("./endpoints/inventory/getnet-terminals.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
99
99
  giftCertificateDefinitions: require("./endpoints/inventory/gift-certificate-definitions.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
100
100
  healthCheck: require("./endpoints/inventory/healthcheck.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
101
+ holidays: require("./endpoints/inventory/holidays.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
101
102
  insurances: require("./endpoints/inventory/insurances.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
102
103
  insurancesCost: require("./endpoints/inventory/insurancesCost.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
103
104
  items: require("./endpoints/inventory/items.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
@@ -341,11 +342,13 @@ function createOperations(_ref6) {
341
342
  calendarEntries: require("./endpoints/operations/calendar_entries.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
342
343
  externalBookings: require("./endpoints/operations/external-bookings.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
343
344
  flexpasses: require("./endpoints/operations/flexpasses.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
345
+ giftCertificates: require("./endpoints/operations/gift-certificates.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
344
346
  loans: require("./endpoints/operations/loans.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
345
347
  manifest: require("./endpoints/operations/manifest.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
346
348
  manifestLegForTickets: require("./endpoints/operations/manifest_leg_for_tickets.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
347
349
  movements: require("./endpoints/operations/movements.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
348
350
  outlookTrips: require("./endpoints/operations/outlook-trips.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
351
+ pagoExpress: require("./endpoints/operations/pago-express.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
349
352
  parcel: require("./endpoints/operations/parcels.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
350
353
  parcelManifests: require("./endpoints/operations/parcels_manifests.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
351
354
  passengerCheckInInfo: require("./endpoints/operations/passenger_check_in_info.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
@@ -418,6 +421,7 @@ function createNotifications(_ref8) {
418
421
  pdfData: require("./endpoints/notifications/pdf-data.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
419
422
  email: require("./endpoints/notifications/email.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
420
423
  customers: require("./endpoints/notifications/customers.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
424
+ externalCustomers: require("./endpoints/notifications/external-customers.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
421
425
  twilio: require("./endpoints/notifications/twilio.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
422
426
  salesforce: require("./endpoints/notifications/salesforce.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
423
427
  notify: require("./endpoints/notifications/notify.js")({ client: client, internalAuthTokenProvider: internalAuthTokenProvider }),
@@ -17,12 +17,15 @@ function banksFactory(_ref) {
17
17
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
18
18
 
19
19
  /**
20
- * GET /banks - list banks. API does not accept query params.
20
+ * GET /banks List banks for the account. Paginated; optional page query param (1-based).
21
21
  * @param {Object} opts
22
- * @param {string} [opts.token] - API key
23
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
22
+ * @param {string} [opts.token] - API key (X-API-KEY)
23
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
24
+ * @param {Object} [opts.query] - Query params: page (1-based page number)
24
25
  * @param {Object} [opts.headers] - Optional headers
25
- * @returns {Promise<import("axios").AxiosResponse>}
26
+ * @returns {Promise<import("axios").AxiosResponse<{ banks: Object[], count: number, next: string, previous: string }>>}
27
+ * @throws 401 Unauthorized
28
+ * @throws 500 Internal server error
26
29
  */
27
30
  function all(_ref2) {
28
31
  var token = _ref2.token,
@@ -38,13 +41,17 @@ function banksFactory(_ref) {
38
41
  }
39
42
 
40
43
  /**
41
- * GET /banks/:bankId - get bank by id. API does not accept query params.
44
+ * GET /banks/:bankId Get a single bank by ID (24 hex characters).
42
45
  * @param {Object} opts
43
46
  * @param {string} [opts.token] - API key
44
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
45
- * @param {string} opts.bankId - Bank id
47
+ * @param {string} [opts.jwtToken] - JWT or internal auth
48
+ * @param {string} opts.bankId - Bank id (24 hex characters)
46
49
  * @param {Object} [opts.headers] - Optional headers
47
- * @returns {Promise<import("axios").AxiosResponse>}
50
+ * @returns {Promise<import("axios").AxiosResponse<{ bank: Object }>>}
51
+ * @throws 400 INVALID_BANK_ID
52
+ * @throws 401 Unauthorized
53
+ * @throws 404 BANK_NOT_FOUND
54
+ * @throws 500 Internal server error
48
55
  */
49
56
  function get(_ref3) {
50
57
  var bankId = _ref3.bankId,
@@ -58,13 +65,16 @@ function banksFactory(_ref) {
58
65
  }
59
66
 
60
67
  /**
61
- * POST /banks - create bank. API does not accept query params.
68
+ * POST /banks Create a bank. Body: BankPostData (name, accountNumbers required; optional depositAlgorithmCode).
62
69
  * @param {Object} opts
63
70
  * @param {string} [opts.token] - API key
64
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
65
- * @param {Object} opts.bank - Bank payload
71
+ * @param {string} [opts.jwtToken] - JWT or internal auth
72
+ * @param {Object} opts.bank - Bank payload (name, accountNumbers; each accountNumber: number, currency, alias)
66
73
  * @param {Object} [opts.headers] - Optional headers
67
- * @returns {Promise<import("axios").AxiosResponse>}
74
+ * @returns {Promise<import("axios").AxiosResponse<{ bank: Object }>>}
75
+ * @throws 400 WRONG_DATA, STATION_INVALID_COST_CENTER
76
+ * @throws 401 Unauthorized
77
+ * @throws 500 Internal server error
68
78
  */
69
79
  function create(_ref4) {
70
80
  var jwtToken = _ref4.jwtToken,
@@ -83,13 +93,17 @@ function banksFactory(_ref) {
83
93
  }
84
94
 
85
95
  /**
86
- * DELETE /banks/:bankId - remove bank. API does not accept query params.
96
+ * DELETE /banks/:bankId Delete a bank by ID.
87
97
  * @param {Object} opts
88
98
  * @param {string} [opts.token] - API key
89
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
90
- * @param {string} opts.bankId - Bank id
99
+ * @param {string} [opts.jwtToken] - JWT or internal auth
100
+ * @param {string} opts.bankId - Bank id (24 hex characters)
91
101
  * @param {Object} [opts.headers] - Optional headers
92
- * @returns {Promise<import("axios").AxiosResponse>}
102
+ * @returns {Promise<import("axios").AxiosResponse<{ bankId: string }>>}
103
+ * @throws 400 BANK_ID
104
+ * @throws 401 Unauthorized
105
+ * @throws 404 BANK_NOT_FOUND
106
+ * @throws 500 Internal server error
93
107
  */
94
108
  function remove(_ref5) {
95
109
  var jwtToken = _ref5.jwtToken,
@@ -105,14 +119,18 @@ function banksFactory(_ref) {
105
119
  }
106
120
 
107
121
  /**
108
- * PUT /banks/:bankId - update bank. API does not accept query params.
122
+ * PUT /banks/:bankId Update a bank by ID. Body: BankPostData (name, accountNumbers required).
109
123
  * @param {Object} opts
110
124
  * @param {string} [opts.token] - API key
111
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
112
- * @param {string} opts.bankId - Bank id
113
- * @param {Object} opts.bank - Bank payload
125
+ * @param {string} [opts.jwtToken] - JWT or internal auth
126
+ * @param {string} opts.bankId - Bank id (24 hex characters)
127
+ * @param {Object} opts.bank - Bank payload (name, accountNumbers; each accountNumber: number, currency, alias)
114
128
  * @param {Object} [opts.headers] - Optional headers
115
- * @returns {Promise<import("axios").AxiosResponse>}
129
+ * @returns {Promise<import("axios").AxiosResponse<{ bank: Object }>>}
130
+ * @throws 400 WRONG_DATA, STATION_INVALID_COST_CENTER
131
+ * @throws 401 Unauthorized
132
+ * @throws 404 BANK_NOT_FOUND
133
+ * @throws 500 Internal server error
116
134
  */
117
135
  function update(_ref6) {
118
136
  var jwtToken = _ref6.jwtToken,
@@ -33,13 +33,16 @@ function changeRequestsFactory(_ref) {
33
33
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
34
34
 
35
35
  /**
36
- * GET /change-requests - list change requests.
36
+ * GET /change-requests List change requests with optional filters and pagination.
37
37
  * @param {Object} opts
38
- * @param {string} [opts.token] - API key
39
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
40
- * @param {ChangeRequestsListQuery} [opts.query] - Query params
38
+ * @param {string} [opts.token] - API key (X-API-KEY)
39
+ * @param {string} [opts.jwtToken] - JWT or internal auth (Authorization: Bearer)
40
+ * @param {ChangeRequestsListQuery} [opts.query] - Query params (type, status, createdBy, from, to, etc.)
41
41
  * @param {Object} [opts.headers] - Optional headers
42
- * @returns {Promise<import("axios").AxiosResponse>}
42
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequests: Object[], count: number, next: string, previous: string }>>}
43
+ * @throws 400 INVALID_PAGE, INVALID_TYPE_PARAMETER, INVALID_STATUS_PARAMETER, etc.
44
+ * @throws 401 Unauthorized
45
+ * @throws 500 Internal server error
43
46
  */
44
47
  function all(_ref2) {
45
48
  var token = _ref2.token,
@@ -55,13 +58,18 @@ function changeRequestsFactory(_ref) {
55
58
  }
56
59
 
57
60
  /**
58
- * GET /change-requests/:changerequestId/manifests - get change request manifests. API does not accept query params.
61
+ * GET /change-requests/:changerequestId/manifests Get manifest change request by ID. Requires multipleManifestEditing.
59
62
  * @param {Object} opts
60
63
  * @param {string} [opts.token] - API key
61
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
62
- * @param {string} opts.changerequestId - Change request id
64
+ * @param {string} [opts.jwtToken] - JWT or internal auth
65
+ * @param {string} opts.changerequestId - Change request id (24 hex characters)
63
66
  * @param {Object} [opts.headers] - Optional headers
64
- * @returns {Promise<import("axios").AxiosResponse>}
67
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
68
+ * @throws 400 INVALID_CHANGEREQUEST_ID, FAILED_TO_FETCH_OPERATION_SETTINGS
69
+ * @throws 401 Unauthorized
70
+ * @throws 403 MULTIPLE_MANIFEST_EDIT_NOT_ALLOWED
71
+ * @throws 404 CHANGEREQUEST_NOT_FOUND
72
+ * @throws 500 Internal server error
65
73
  */
66
74
  function get(_ref3) {
67
75
  var changerequestId = _ref3.changerequestId,
@@ -79,13 +87,17 @@ function changeRequestsFactory(_ref) {
79
87
  }
80
88
 
81
89
  /**
82
- * POST /change-requests/manifests - create change request manifest. API does not accept query params.
90
+ * POST /change-requests/manifests Create manifest change request. Emits changeRequests.manifests.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.data - Manifest payload
93
+ * @param {string} [opts.jwtToken] - JWT or internal auth
94
+ * @param {Object} opts.data - Manifest change request payload (manifestId, request, routeId, scheduleId, date, etc.)
87
95
  * @param {Object} [opts.headers] - Optional headers
88
- * @returns {Promise<import("axios").AxiosResponse>}
96
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
97
+ * @throws 400 WRONG_DATA, FAILED_TO_FETCH_OPERATION_SETTINGS, MANIFEST_NOT_FOUND, etc.
98
+ * @throws 401 Unauthorized
99
+ * @throws 403 MULTIPLE_MANIFEST_EDIT_NOT_ALLOWED
100
+ * @throws 500 Internal server error
89
101
  */
90
102
  function create(_ref4) {
91
103
  var data = _ref4.data,
@@ -102,14 +114,19 @@ function changeRequestsFactory(_ref) {
102
114
  }
103
115
 
104
116
  /**
105
- * PUT /change-requests/:changerequestId/manifests - update change request manifest. API does not accept query params.
117
+ * PUT /change-requests/:changerequestId/manifests Update manifest change request. Emits changeRequests.manifests.updated.
106
118
  * @param {Object} opts
107
119
  * @param {string} [opts.token] - API key
108
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
109
- * @param {string} opts.changerequestId - Change request id
110
- * @param {Object} opts.data - Manifest payload
120
+ * @param {string} [opts.jwtToken] - JWT or internal auth
121
+ * @param {string} opts.changerequestId - Change request id (24 hex characters)
122
+ * @param {Object} opts.data - Update payload (status: 'approved' or 'rejected')
111
123
  * @param {Object} [opts.headers] - Optional headers
112
- * @returns {Promise<import("axios").AxiosResponse>}
124
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
125
+ * @throws 400 WRONG_DATA, CHANGEREQUEST_STATUS_NOT_PENDING, etc.
126
+ * @throws 401 Unauthorized
127
+ * @throws 403 MULTIPLE_MANIFEST_EDIT_NOT_ALLOWED
128
+ * @throws 404 CHANGEREQUEST_NOT_FOUND
129
+ * @throws 500 Internal server error
113
130
  */
114
131
  function update(_ref5) {
115
132
  var changerequestId = _ref5.changerequestId,
@@ -129,13 +146,17 @@ function changeRequestsFactory(_ref) {
129
146
  /** @type {{ get: function, create: function, update: function }} */
130
147
  var schedules = {
131
148
  /**
132
- * GET /change-requests/:changeRequestId/schedules - get change request schedules. API does not accept query params.
149
+ * GET /change-requests/:changeRequestId/schedules Get schedule change request by ID.
133
150
  * @param {Object} opts
134
151
  * @param {string} [opts.token] - API key
135
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
136
- * @param {string} opts.changeRequestId - Change request id
152
+ * @param {string} [opts.jwtToken] - JWT or internal auth
153
+ * @param {string} opts.changeRequestId - Change request id (24 hex characters)
137
154
  * @param {Object} [opts.headers] - Optional headers
138
- * @returns {Promise<import("axios").AxiosResponse>}
155
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
156
+ * @throws 400 INVALID_CHANGEREQUEST_ID, FAILED_TO_FETCH_OPERATION_SETTINGS, etc.
157
+ * @throws 401 Unauthorized
158
+ * @throws 404 CHANGEREQUEST_NOT_FOUND
159
+ * @throws 500 Internal server error
139
160
  */
140
161
  get: function get(_ref6) {
141
162
  var changeRequestId = _ref6.changeRequestId,
@@ -154,13 +175,16 @@ function changeRequestsFactory(_ref) {
154
175
 
155
176
 
156
177
  /**
157
- * POST /change-requests/schedules - create change request schedule. API does not accept query params.
178
+ * POST /change-requests/schedules Create a schedule change request. Emits webhook changeRequests.schedules.created.
158
179
  * @param {Object} opts
159
180
  * @param {string} [opts.token] - API key
160
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
161
- * @param {Object} opts.data - Schedule payload
181
+ * @param {string} [opts.jwtToken] - JWT or internal auth
182
+ * @param {Object} opts.data - Schedule change request payload (request, routeId, scheduleId, legs, etc.)
162
183
  * @param {Object} [opts.headers] - Optional headers
163
- * @returns {Promise<import("axios").AxiosResponse>}
184
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
185
+ * @throws 400 WRONG_DATA, FAILED_TO_FETCH_OPERATION_SETTINGS, etc.
186
+ * @throws 401 Unauthorized
187
+ * @throws 500 Internal server error
164
188
  */
165
189
  create: function create(_ref7) {
166
190
  var data = _ref7.data,
@@ -178,14 +202,18 @@ function changeRequestsFactory(_ref) {
178
202
 
179
203
 
180
204
  /**
181
- * PUT /change-requests/:changeRequestId/schedules - update change request schedule. API does not accept query params.
205
+ * PUT .../schedules Update schedule change request (approve/reject). Emits changeRequests.schedules.updated.
182
206
  * @param {Object} opts
183
207
  * @param {string} [opts.token] - API key
184
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
185
- * @param {string} opts.changeRequestId - Change request id
186
- * @param {Object} opts.data - Schedule payload
208
+ * @param {string} [opts.jwtToken] - JWT or internal auth
209
+ * @param {string} opts.changeRequestId - Change request id (24 hex characters)
210
+ * @param {Object} opts.data - Update payload (status: 'approved' or 'rejected')
187
211
  * @param {Object} [opts.headers] - Optional headers
188
- * @returns {Promise<import("axios").AxiosResponse>}
212
+ * @returns {Promise<import("axios").AxiosResponse<{ changeRequest: Object }>>}
213
+ * @throws 400 WRONG_DATA, CHANGEREQUEST_STATUS_NOT_PENDING, etc.
214
+ * @throws 401 Unauthorized
215
+ * @throws 404 CHANGEREQUEST_NOT_FOUND
216
+ * @throws 500 Internal server error
189
217
  */
190
218
  update: function update(_ref8) {
191
219
  var changeRequestId = _ref8.changeRequestId,
@@ -47,13 +47,17 @@ function controlClassesFactory(_ref) {
47
47
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
48
48
 
49
49
  /**
50
- * GET /control-classes - list control classes.
50
+ * GET /control-classes List control class roots (paginated). Emits no webhooks.
51
51
  * @param {Object} opts
52
52
  * @param {string} [opts.token] - API key
53
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
53
+ * @param {string} [opts.jwtToken] - JWT or internal auth
54
54
  * @param {ControlClassesListQuery} [opts.query] - Query params
55
55
  * @param {Object} [opts.headers] - Optional headers
56
- * @returns {Promise<import("axios").AxiosResponse>}
56
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClasses: Object[], authorizationsEnabled?: boolean }>>}
57
+ * @throws 400 INVALID_PAGE, INVALID_SCHEDULE_ID, INVALID_ASSIGNED_SCHEDULE_ID
58
+ * @throws 401 Unauthorized
59
+ * @throws 404 SCHEDULE_NOT_FOUND
60
+ * @throws 500 Internal server error
57
61
  */
58
62
  function all(_ref2) {
59
63
  var token = _ref2.token,
@@ -69,14 +73,18 @@ function controlClassesFactory(_ref) {
69
73
  }
70
74
 
71
75
  /**
72
- * GET /control-classes/:controlClassId - get control class by id.
76
+ * GET /control-classes/:controlClassId Get one control class (optional tree, schedules).
73
77
  * @param {Object} opts
74
78
  * @param {string} [opts.token] - API key
75
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
76
- * @param {string} opts.controlClassId - Control class id
79
+ * @param {string} [opts.jwtToken] - JWT or internal auth
80
+ * @param {string} opts.controlClassId - Control class id (24 hex)
77
81
  * @param {ControlClassGetQuery} [opts.query] - Query params (tree, scheduleId, etc.)
78
82
  * @param {Object} [opts.headers] - Optional headers
79
- * @returns {Promise<import("axios").AxiosResponse>}
83
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClass, root?, parent?, siblings?, children?, schedules?, tree? }>>}
84
+ * @throws 400 INVALID_CONTROLCLASS_ID
85
+ * @throws 401 Unauthorized
86
+ * @throws 404 CONTROLCLASS_NOT_FOUND
87
+ * @throws 500 Internal server error
80
88
  */
81
89
  function get(_ref3) {
82
90
  var controlClassId = _ref3.controlClassId,
@@ -93,13 +101,16 @@ function controlClassesFactory(_ref) {
93
101
  }
94
102
 
95
103
  /**
96
- * POST /control-classes - create control class. API does not accept query params.
104
+ * POST /control-classes Create control class. Body: { controlClass }. Emits controlclasses.created.
97
105
  * @param {Object} opts
98
106
  * @param {string} [opts.token] - API key
99
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
100
- * @param {Object} opts.controlClass - Control class payload
107
+ * @param {string} [opts.jwtToken] - JWT or internal auth
108
+ * @param {Object} opts.controlClass - ControlClassData (name, props required)
101
109
  * @param {Object} [opts.headers] - Optional headers
102
- * @returns {Promise<import("axios").AxiosResponse>}
110
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClass: Object }>>}
111
+ * @throws 400 WRONG_DATA, DUPLICATE_CLASS_NAME, NO_ROOT_PROPS, PARENT_CLASS_NOT_FOUND, etc.
112
+ * @throws 401 Unauthorized
113
+ * @throws 500 Internal server error
103
114
  */
104
115
  function create(_ref4) {
105
116
  var jwtToken = _ref4.jwtToken,
@@ -118,13 +129,17 @@ function controlClassesFactory(_ref) {
118
129
  }
119
130
 
120
131
  /**
121
- * DELETE /control-classes/:controlClassId - remove control class.
132
+ * DELETE /control-classes/:controlClassId Delete control class. Emits controlclasses.deleted.
122
133
  * @param {Object} opts
123
134
  * @param {string} [opts.token] - API key
124
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
125
- * @param {string} opts.controlClassId - Control class id
135
+ * @param {string} [opts.jwtToken] - JWT or internal auth
136
+ * @param {string} opts.controlClassId - Control class id (24 hex)
126
137
  * @param {Object} [opts.headers] - Optional headers
127
- * @returns {Promise<import("axios").AxiosResponse>}
138
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClassId: string }>>}
139
+ * @throws 400 INVALID_CONTROLCLASS_ID, CANNOT_DELETE_CLASS_WITH_CHILDREN
140
+ * @throws 401 Unauthorized
141
+ * @throws 404 CONTROLCLASS_NOT_FOUND
142
+ * @throws 500 Internal server error
128
143
  */
129
144
  function remove(_ref5) {
130
145
  var jwtToken = _ref5.jwtToken,
@@ -140,14 +155,18 @@ function controlClassesFactory(_ref) {
140
155
  }
141
156
 
142
157
  /**
143
- * PUT /control-classes/:controlClassId - update control class. API does not accept query params.
158
+ * PUT /control-classes/:controlClassId Update control class. Body: { controlClass }. Emits controlclasses.updated.
144
159
  * @param {Object} opts
145
160
  * @param {string} [opts.token] - API key
146
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
147
- * @param {string} opts.controlClassId - Control class id
148
- * @param {Object} opts.controlClass - Control class payload
161
+ * @param {string} [opts.jwtToken] - JWT or internal auth
162
+ * @param {string} opts.controlClassId - Control class id (24 hex)
163
+ * @param {Object} opts.controlClass - ControlClassData (name, props required)
149
164
  * @param {Object} [opts.headers] - Optional headers
150
- * @returns {Promise<import("axios").AxiosResponse>}
165
+ * @returns {Promise<import("axios").AxiosResponse<{ controlClass: Object }>>}
166
+ * @throws 400 WRONG_DATA, INVALID_CONTROLCLASS_ID, DUPLICATE_CLASS_NAME, etc.
167
+ * @throws 401 Unauthorized
168
+ * @throws 404 CONTROLCLASS_NOT_FOUND
169
+ * @throws 500 Internal server error
151
170
  */
152
171
  function update(_ref6) {
153
172
  var jwtToken = _ref6.jwtToken,
@@ -6,7 +6,14 @@ var _require = require("./../endpoints_helpers.js"),
6
6
  /**
7
7
  * Query params for GET /countries (btrz-api-inventory). See get-countries getSpec().
8
8
  * @typedef {Object} CountriesListQuery
9
- * @property {string} [isoCode] - Country 2 or 3 letter ISO code
9
+ * @property {string} [isoCode] - Country 2- or 3-letter ISO code (must be 2 or 3 chars if provided)
10
+ */
11
+
12
+ /**
13
+ * Query params for GET /countries/:countryId (btrz-api-inventory). See getCountryById getSpec().
14
+ * @typedef {Object} CountryGetQuery
15
+ * @property {string} [include] - Address level to include: "provinces" (default), "counties", "cities", "neighborhoods"
16
+ * @property {string} [parentKey] - Parent address level to filter by when include is not provinces
10
17
  */
11
18
 
12
19
  /**
@@ -23,16 +30,20 @@ function countriesFactory(_ref) {
23
30
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
24
31
 
25
32
  /**
26
- * GET /countries - list countries.
33
+ * GET /countries List countries. Optional filter by isoCode (2 or 3 characters).
27
34
  * @param {Object} opts
28
35
  * @param {string} [opts.token] - API key
29
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
36
+ * @param {string} [opts.jwtToken] - JWT or internal auth
30
37
  * @param {CountriesListQuery} [opts.query] - Query params (isoCode)
31
38
  * @param {Object} [opts.headers] - Optional headers
32
- * @returns {Promise<import("axios").AxiosResponse>}
39
+ * @returns {Promise<import("axios").AxiosResponse<{ countries: Object[] }>>}
40
+ * @throws 400 Validation failure (e.g. invalid isoCode length)
41
+ * @throws 401 Unauthorized
42
+ * @throws 500 Internal server error
33
43
  */
34
44
  function all(_ref2) {
35
45
  var token = _ref2.token,
46
+ jwtToken = _ref2.jwtToken,
36
47
  _ref2$query = _ref2.query,
37
48
  query = _ref2$query === undefined ? {} : _ref2$query,
38
49
  headers = _ref2.headers;
@@ -40,18 +51,23 @@ function countriesFactory(_ref) {
40
51
  return client({
41
52
  url: "/countries",
42
53
  params: query,
43
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
54
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
44
55
  });
45
56
  }
46
57
 
47
58
  /**
48
- * GET /countries/:id - get country by id. API does not accept query params.
59
+ * GET /countries/:id Get country by id. Optional include (provinces/counties/cities/neighborhoods) and parentKey.
49
60
  * @param {Object} opts
50
61
  * @param {string} [opts.token] - API key
51
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
52
- * @param {string} opts.id - Country id
62
+ * @param {string} [opts.jwtToken] - JWT or internal auth
63
+ * @param {string} opts.id - Country id (24 hex)
64
+ * @param {CountryGetQuery} [opts.query] - Query params (include, parentKey)
53
65
  * @param {Object} [opts.headers] - Optional headers
54
- * @returns {Promise<import("axios").AxiosResponse>}
66
+ * @returns {Promise<import("axios").AxiosResponse<{ country: Object }>>}
67
+ * @throws 400 INVALID_COUNTRY_ID
68
+ * @throws 401 Unauthorized
69
+ * @throws 404 COUNTRY_NOT_FOUND
70
+ * @throws 500 Internal server error
55
71
  */
56
72
  function get(_ref3) {
57
73
  var token = _ref3.token,
@@ -24,13 +24,14 @@ function customContentFactory(_ref) {
24
24
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
25
25
 
26
26
  /**
27
- * GET /custom-content - list custom content.
27
+ * GET /custom-content List custom content (paginated). Query: enabled, pageId.
28
28
  * @param {Object} opts
29
29
  * @param {string} [opts.token] - API key
30
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
31
30
  * @param {InventoryCustomContentQuery} [opts.query] - Query params (enabled, pageId)
32
31
  * @param {Object} [opts.headers] - Optional headers
33
- * @returns {Promise<import("axios").AxiosResponse>}
32
+ * @returns {Promise<import("axios").AxiosResponse<{ customContent: Object[] }>>}
33
+ * @throws 401 Unauthorized
34
+ * @throws 500 Internal server error
34
35
  */
35
36
  function all(_ref2) {
36
37
  var token = _ref2.token,
@@ -45,32 +46,40 @@ function customContentFactory(_ref) {
45
46
  }
46
47
 
47
48
  /**
48
- * GET /custom-content/:customContentId - get custom content by id. API does not accept query params.
49
+ * GET /custom-content/:customContentId Get custom content by id.
49
50
  * @param {Object} opts
50
51
  * @param {string} [opts.token] - API key
51
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
52
- * @param {string} opts.customContentId - Custom content id
52
+ * @param {string} [opts.jwtToken] - JWT or internal auth
53
+ * @param {string} opts.customContentId - Custom content id (24 hex)
53
54
  * @param {Object} [opts.headers] - Optional headers
54
- * @returns {Promise<import("axios").AxiosResponse>}
55
+ * @returns {Promise<import("axios").AxiosResponse<{ customContent: Object }>>}
56
+ * @throws 400 INVALID_CUSTOMCONTENT_ID
57
+ * @throws 401 Unauthorized
58
+ * @throws 404 CUSTOMCONTENT_NOT_FOUND
59
+ * @throws 500 Internal server error
55
60
  */
56
61
  function get(_ref3) {
57
62
  var customContentId = _ref3.customContentId,
58
63
  token = _ref3.token,
64
+ jwtToken = _ref3.jwtToken,
59
65
  headers = _ref3.headers;
60
66
 
61
67
  return client.get("/custom-content/" + customContentId, {
62
- headers: authorizationHeaders({ token: token, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
68
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
63
69
  });
64
70
  }
65
71
 
66
72
  /**
67
- * POST /custom-content - create custom content. API does not accept query params.
73
+ * POST /custom-content Create custom content. Body: { customContent }. Emits customContent.created.
68
74
  * @param {Object} opts
69
75
  * @param {string} [opts.token] - API key
70
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
71
- * @param {Object} opts.customContent - Custom content payload
76
+ * @param {string} [opts.jwtToken] - JWT or internal auth
77
+ * @param {Object} opts.customContent - CustomContentPost (name, pageId, lang required; at least one of title, text, imgUrl, mainUrl)
72
78
  * @param {Object} [opts.headers] - Optional headers
73
- * @returns {Promise<import("axios").AxiosResponse>}
79
+ * @returns {Promise<import("axios").AxiosResponse<{ customContent: Object }>>}
80
+ * @throws 400 WRONG_DATA, INVALID_CUSTOMCONTENT
81
+ * @throws 401 Unauthorized
82
+ * @throws 500 Internal server error
74
83
  */
75
84
  function create(_ref4) {
76
85
  var jwtToken = _ref4.jwtToken,
@@ -89,13 +98,17 @@ function customContentFactory(_ref) {
89
98
  }
90
99
 
91
100
  /**
92
- * DELETE /custom-content/:customContentId - remove custom content. API does not accept query params.
101
+ * DELETE /custom-content/:customContentId Delete custom content. Emits customContent.deleted.
93
102
  * @param {Object} opts
94
103
  * @param {string} [opts.token] - API key
95
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
96
- * @param {string} opts.customContentId - Custom content id
104
+ * @param {string} [opts.jwtToken] - JWT or internal auth
105
+ * @param {string} opts.customContentId - Custom content id (24 hex)
97
106
  * @param {Object} [opts.headers] - Optional headers
98
- * @returns {Promise<import("axios").AxiosResponse>}
107
+ * @returns {Promise<import("axios").AxiosResponse<{ customContentId: string }>>}
108
+ * @throws 400 CUSTOMCONTENT_TERMINAL_ID, WRONG_DATA
109
+ * @throws 401 Unauthorized
110
+ * @throws 404 CUSTOMCONTENT_NOT_FOUND
111
+ * @throws 500 Internal server error
99
112
  */
100
113
  function remove(_ref5) {
101
114
  var jwtToken = _ref5.jwtToken,
@@ -111,14 +124,18 @@ function customContentFactory(_ref) {
111
124
  }
112
125
 
113
126
  /**
114
- * PUT /custom-content/:customContentId - update custom content. API does not accept query params.
127
+ * PUT /custom-content/:customContentId Update custom content. Body: { customContent }. Emits customContent.updated.
115
128
  * @param {Object} opts
116
129
  * @param {string} [opts.token] - API key
117
- * @param {string} [opts.jwtToken] - JWT or internal auth symbol
118
- * @param {string} opts.customContentId - Custom content id
119
- * @param {Object} opts.customContent - Custom content payload
130
+ * @param {string} [opts.jwtToken] - JWT or internal auth
131
+ * @param {string} opts.customContentId - Custom content id (24 hex)
132
+ * @param {Object} opts.customContent - CustomContentPost (at least one of title, text, imgUrl for update)
120
133
  * @param {Object} [opts.headers] - Optional headers
121
- * @returns {Promise<import("axios").AxiosResponse>}
134
+ * @returns {Promise<import("axios").AxiosResponse<{ customContent: Object }>>}
135
+ * @throws 400 WRONG_DATA, INVALID_CUSTOMCONTENT_UPDATE
136
+ * @throws 401 Unauthorized
137
+ * @throws 404 CUSTOMCONTENT_NOT_FOUND
138
+ * @throws 500 Internal server error
122
139
  */
123
140
  function update(_ref6) {
124
141
  var jwtToken = _ref6.jwtToken,