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
@@ -30,13 +30,14 @@ function financingCostsFactory(_ref) {
30
30
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
31
31
 
32
32
  /**
33
- * GET /financing-costs - list financing costs.
33
+ * GET /financing-costs - list financing costs (paginated).
34
34
  * @param {Object} opts
35
35
  * @param {string} [opts.token] - API key
36
36
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
37
37
  * @param {FinancingCostsListQuery} [opts.query] - Query params (page, providerId)
38
38
  * @param {Object} [opts.headers] - Optional headers
39
- * @returns {Promise<import("axios").AxiosResponse>}
39
+ * @returns {Promise<import("axios").AxiosResponse<{ financingcosts: Array, next: string, previous: string, count: number }>>}
40
+ * @throws When response is 4xx/5xx (400 INVALID_PAGE, 401, 500)
40
41
  */
41
42
  function all(_ref2) {
42
43
  var token = _ref2.token,
@@ -56,10 +57,11 @@ function financingCostsFactory(_ref) {
56
57
  * @param {Object} opts
57
58
  * @param {string} [opts.token] - API key
58
59
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
59
- * @param {string} opts.id - Financing cost id
60
+ * @param {string} opts.id - Financing cost id (24 hex characters)
60
61
  * @param {FinancingCostGetQuery} [opts.query] - Query params (providerId)
61
62
  * @param {Object} [opts.headers] - Optional headers
62
- * @returns {Promise<import("axios").AxiosResponse>}
63
+ * @returns {Promise<import("axios").AxiosResponse<{ financingcost: Object }>>}
64
+ * @throws When response is 4xx/5xx (400 INVALID_FINANCINGCOST_ID, 401, 404 FINANCINGCOST_NOT_FOUND, 500)
63
65
  */
64
66
  function get(_ref3) {
65
67
  var id = _ref3.id,
@@ -76,13 +78,14 @@ function financingCostsFactory(_ref) {
76
78
  }
77
79
 
78
80
  /**
79
- * POST /financing-costs - create financing cost. API does not accept query params.
81
+ * POST /financing-costs - create financing cost.
80
82
  * @param {Object} opts
81
83
  * @param {string} [opts.token] - API key
82
84
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
83
- * @param {Object} opts.financingCost - Financing cost payload
85
+ * @param {Object} opts.financingCost - Financing cost (name, internalId, currencyCode, dow, creditCard, maxQuota, interest, enabled)
84
86
  * @param {Object} [opts.headers] - Optional headers
85
- * @returns {Promise<import("axios").AxiosResponse>}
87
+ * @returns {Promise<import("axios").AxiosResponse<{ financingcost: Object }>>}
88
+ * @throws When response is 4xx/5xx (400 WRONG_DATA, 401, 409 duplicated internalId, 500)
86
89
  */
87
90
  function create(_ref4) {
88
91
  var jwtToken = _ref4.jwtToken,
@@ -101,13 +104,14 @@ function financingCostsFactory(_ref) {
101
104
  }
102
105
 
103
106
  /**
104
- * DELETE /financing-costs/:id - remove financing cost. API does not accept query params.
107
+ * DELETE /financing-costs/:id - remove financing cost.
105
108
  * @param {Object} opts
106
109
  * @param {string} [opts.token] - API key
107
110
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
108
- * @param {string} opts.id - Financing cost id
111
+ * @param {string} opts.id - Financing cost id (24 hex characters)
109
112
  * @param {Object} [opts.headers] - Optional headers
110
- * @returns {Promise<import("axios").AxiosResponse>}
113
+ * @returns {Promise<import("axios").AxiosResponse<{ financingcostId: string }>>}
114
+ * @throws When response is 4xx/5xx (400 INVALID_FINANCINGCOST_ID, 401, 404 FINANCINGCOST_NOT_FOUND, 500)
111
115
  */
112
116
  function remove(_ref5) {
113
117
  var jwtToken = _ref5.jwtToken,
@@ -126,14 +130,15 @@ function financingCostsFactory(_ref) {
126
130
  }
127
131
 
128
132
  /**
129
- * PUT /financing-costs/:id - update financing cost. API does not accept query params.
133
+ * PUT /financing-costs/:id - update financing cost.
130
134
  * @param {Object} opts
131
135
  * @param {string} [opts.token] - API key
132
136
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
133
- * @param {string} opts.id - Financing cost id
134
- * @param {Object} opts.financingCost - Financing cost payload
137
+ * @param {string} opts.id - Financing cost id (24 hex characters)
138
+ * @param {Object} opts.financingCost - Financing cost (name, internalId, currencyCode, dow, creditCard, maxQuota, interest, enabled)
135
139
  * @param {Object} [opts.headers] - Optional headers
136
- * @returns {Promise<import("axios").AxiosResponse>}
140
+ * @returns {Promise<import("axios").AxiosResponse<{ financingcost: Object }>>}
141
+ * @throws When response is 4xx/5xx (400 WRONG_DATA, 401, 404 not found, 409 duplicated internalId, 500)
137
142
  */
138
143
  function update(_ref6) {
139
144
  var jwtToken = _ref6.jwtToken,
@@ -24,13 +24,14 @@ function garagesFactory(_ref) {
24
24
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
25
25
 
26
26
  /**
27
- * GET /garages - list garages.
27
+ * GET /garages - list garages (paginated).
28
28
  * @param {Object} opts
29
29
  * @param {string} [opts.token] - API key
30
30
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
31
31
  * @param {GaragesQuery} [opts.query] - Query params (location, stationId)
32
32
  * @param {Object} [opts.headers] - Optional headers
33
- * @returns {Promise<import("axios").AxiosResponse>}
33
+ * @returns {Promise<import("axios").AxiosResponse<{ garages: Array, next?: string, previous?: string, count: number }>>}
34
+ * @throws When response is 4xx/5xx (401, 500)
34
35
  */
35
36
  function all(_ref2) {
36
37
  var token = _ref2.token,
@@ -46,13 +47,14 @@ function garagesFactory(_ref) {
46
47
  }
47
48
 
48
49
  /**
49
- * GET /garages/:garageId - get garage by id. API does not accept query params.
50
+ * GET /garages/:garageId - get garage by id.
50
51
  * @param {Object} opts
51
52
  * @param {string} [opts.token] - API key
52
53
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
53
- * @param {string} opts.garageId - Garage id
54
+ * @param {string} opts.garageId - Garage id (24 hex characters)
54
55
  * @param {Object} [opts.headers] - Optional headers
55
- * @returns {Promise<import("axios").AxiosResponse>}
56
+ * @returns {Promise<import("axios").AxiosResponse<{ garage: Object }>>}
57
+ * @throws When response is 4xx/5xx (400 INVALID_GARAGE_ID, 401, 404 GARAGE_NOT_FOUND, 500)
56
58
  */
57
59
  function get(_ref3) {
58
60
  var token = _ref3.token,
@@ -66,13 +68,14 @@ function garagesFactory(_ref) {
66
68
  }
67
69
 
68
70
  /**
69
- * POST /garages - create garage. API does not accept query params.
71
+ * POST /garages - create garage.
70
72
  * @param {Object} opts
71
73
  * @param {string} [opts.token] - API key
72
74
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
73
- * @param {Object} opts.data - Garage payload
75
+ * @param {Object} opts.data - Garage payload (name, location, stationId)
74
76
  * @param {Object} [opts.headers] - Optional headers
75
- * @returns {Promise<import("axios").AxiosResponse>}
77
+ * @returns {Promise<import("axios").AxiosResponse<{ garage: Object }>>}
78
+ * @throws When response is 4xx/5xx (400 WRONG_DATA, 401, 500)
76
79
  */
77
80
  function create(_ref4) {
78
81
  var token = _ref4.token,
@@ -95,10 +98,11 @@ function garagesFactory(_ref) {
95
98
  * @param {Object} opts
96
99
  * @param {string} [opts.token] - API key
97
100
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
98
- * @param {string} opts.garageId - Garage id
99
- * @param {Object} opts.data - Garage payload
101
+ * @param {string} opts.garageId - Garage id (24 hex characters)
102
+ * @param {Object} opts.data - Garage payload (name, location, stationId)
100
103
  * @param {Object} [opts.headers] - Optional headers
101
- * @returns {Promise<import("axios").AxiosResponse>}
104
+ * @returns {Promise<import("axios").AxiosResponse<{ garage: Object }>>}
105
+ * @throws When response is 4xx/5xx (400, 401, 404 GARAGE_NOT_FOUND/STATION_NOT_FOUND, 500)
102
106
  */
103
107
  function update(_ref5) {
104
108
  var token = _ref5.token,
@@ -118,13 +122,14 @@ function garagesFactory(_ref) {
118
122
  }
119
123
 
120
124
  /**
121
- * DELETE /garages/:garageId - remove garage. API does not accept query params.
125
+ * DELETE /garages/:garageId - remove garage.
122
126
  * @param {Object} opts
123
127
  * @param {string} [opts.token] - API key
124
128
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
125
- * @param {string} opts.garageId - Garage id
129
+ * @param {string} opts.garageId - Garage id (24 hex characters)
126
130
  * @param {Object} [opts.headers] - Optional headers
127
- * @returns {Promise<import("axios").AxiosResponse>}
131
+ * @returns {Promise<import("axios").AxiosResponse<{ success: boolean }>>}
132
+ * @throws When response is 4xx/5xx (400 INVALID_GARAGE_ID or GARAGE_WITH_VEHICLES, 401, 404, 500)
128
133
  */
129
134
  function remove(_ref6) {
130
135
  var token = _ref6.token,
@@ -25,13 +25,14 @@ function getnetTerminalFactory(_ref) {
25
25
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
26
26
 
27
27
  /**
28
- * GET /getnet-terminals - list getnet terminals.
28
+ * GET /getnet-terminals - list getnet terminals (paginated).
29
29
  * @param {Object} opts
30
30
  * @param {string} [opts.token] - API key
31
31
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
32
- * @param {GetnetTerminalsQuery} [opts.query] - Query params
32
+ * @param {GetnetTerminalsQuery} [opts.query] - Query params (page, stationId, serialNumber)
33
33
  * @param {Object} [opts.headers] - Optional headers
34
- * @returns {Promise<import("axios").AxiosResponse>}
34
+ * @returns {Promise<import("axios").AxiosResponse<{ getnetTerminals: Array, next?: string, previous?: string, count: number }>>}
35
+ * @throws When response is 4xx/5xx (400 INVALID_PAGE, 401, 500)
35
36
  */
36
37
  function all(_ref2) {
37
38
  var token = _ref2.token,
@@ -47,13 +48,14 @@ function getnetTerminalFactory(_ref) {
47
48
  }
48
49
 
49
50
  /**
50
- * GET /getnet-terminals/:getnetTerminalId - get a getnet terminal. API does not accept query params.
51
+ * GET /getnet-terminals/:getnetTerminalId - get a getnet terminal by id.
51
52
  * @param {Object} opts
52
53
  * @param {string} [opts.token] - API key
53
54
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
54
- * @param {string} opts.getnetTerminalId - Getnet terminal id
55
+ * @param {string} opts.getnetTerminalId - Getnet terminal id (24 hex characters)
55
56
  * @param {Object} [opts.headers] - Optional headers
56
- * @returns {Promise<import("axios").AxiosResponse>}
57
+ * @returns {Promise<import("axios").AxiosResponse<{ getnetTerminal: Object }>>}
58
+ * @throws When response is 4xx/5xx (400 INVALID_GETNET_TERMINAL_ID, 401, 404 GETNET_TERMINAL_NOT_FOUND, 500)
57
59
  */
58
60
  function get(_ref3) {
59
61
  var getnetTerminalId = _ref3.getnetTerminalId,
@@ -71,9 +73,10 @@ function getnetTerminalFactory(_ref) {
71
73
  * @param {Object} opts
72
74
  * @param {string} [opts.token] - API key
73
75
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
74
- * @param {Object} opts.getnetTerminal - Getnet terminal payload
76
+ * @param {Object} opts.getnetTerminal - Getnet terminal payload (name, serialNumber, stationId optional)
75
77
  * @param {Object} [opts.headers] - Optional headers
76
- * @returns {Promise<import("axios").AxiosResponse>}
78
+ * @returns {Promise<import("axios").AxiosResponse<{ getnetTerminal: Object }>>}
79
+ * @throws When response is 4xx/5xx (400 WRONG_DATA/INVALID_STATION_ID/STATION_NOT_FOUND, 401, 409 duplicate serial, 500)
77
80
  */
78
81
  function create(_ref4) {
79
82
  var jwtToken = _ref4.jwtToken,
@@ -92,13 +95,14 @@ function getnetTerminalFactory(_ref) {
92
95
  }
93
96
 
94
97
  /**
95
- * DELETE /getnet-terminals/:getnetTerminalId - remove getnet terminal. API does not accept query params.
98
+ * DELETE /getnet-terminals/:getnetTerminalId - remove getnet terminal.
96
99
  * @param {Object} opts
97
100
  * @param {string} [opts.token] - API key
98
101
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
99
- * @param {string} opts.getnetTerminalId - Getnet terminal id
102
+ * @param {string} opts.getnetTerminalId - Getnet terminal id (24 hex characters)
100
103
  * @param {Object} [opts.headers] - Optional headers
101
- * @returns {Promise<import("axios").AxiosResponse>}
104
+ * @returns {Promise<import("axios").AxiosResponse<{ getnetTerminalId: string }>>}
105
+ * @throws When response is 4xx/5xx (400 INVALID_GETNET_TERMINAL_ID, 401, 404 GETNET_TERMINAL_NOT_FOUND, 500)
102
106
  */
103
107
  function remove(_ref5) {
104
108
  var jwtToken = _ref5.jwtToken,
@@ -114,14 +118,15 @@ function getnetTerminalFactory(_ref) {
114
118
  }
115
119
 
116
120
  /**
117
- * PUT /getnet-terminals/:getnetTerminalId - update getnet terminal. API does not accept query params.
121
+ * PUT /getnet-terminals/:getnetTerminalId - update getnet terminal.
118
122
  * @param {Object} opts
119
123
  * @param {string} [opts.token] - API key
120
124
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
121
- * @param {string} opts.getnetTerminalId - Getnet terminal id
122
- * @param {Object} opts.getnetTerminal - Getnet terminal payload
125
+ * @param {string} opts.getnetTerminalId - Getnet terminal id (24 hex characters)
126
+ * @param {Object} opts.getnetTerminal - Getnet terminal payload (name, serialNumber, stationId)
123
127
  * @param {Object} [opts.headers] - Optional headers
124
- * @returns {Promise<import("axios").AxiosResponse>}
128
+ * @returns {Promise<import("axios").AxiosResponse<{ getnetTerminal: Object }>>}
129
+ * @throws When response is 4xx/5xx (400, 401, 404 GETNET_TERMINAL_NOT_FOUND, 409 duplicate serial, 500)
125
130
  */
126
131
  function update(_ref6) {
127
132
  var jwtToken = _ref6.jwtToken,
@@ -30,7 +30,8 @@ function giftCertificateDefinitionsFactory(_ref) {
30
30
  * @param {string} [opts.token] - API key
31
31
  * @param {GiftCertificateDefinitionsListQuery} [opts.query] - Query params (channels, currencies, providerId)
32
32
  * @param {Object} [opts.headers] - Optional headers
33
- * @returns {Promise<import("axios").AxiosResponse>}
33
+ * @returns {Promise<import("axios").AxiosResponse<{ giftCertificates: Object[], next?: string, previous?: string, count: number }>>}
34
+ * @throws 400 WRONG_DATA, PROVIDER_ID; 401 Unauthorized; 500.
34
35
  */
35
36
  function all(_ref2) {
36
37
  var token = _ref2.token,
@@ -51,7 +52,8 @@ function giftCertificateDefinitionsFactory(_ref) {
51
52
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
52
53
  * @param {string} opts.giftcertificateId - Gift certificate definition id
53
54
  * @param {Object} [opts.headers] - Optional headers
54
- * @returns {Promise<import("axios").AxiosResponse>}
55
+ * @returns {Promise<import("axios").AxiosResponse<{ giftcertificate: Object }>>}
56
+ * @throws When the API returns an error. 400 INVALID_GIFTCERTIFICATE_ID; 401 Unauthorized; 404 GIFTCERTIFICATE_NOT_FOUND; 500.
55
57
  */
56
58
  function get(_ref3) {
57
59
  var token = _ref3.token,
@@ -76,7 +78,8 @@ function giftCertificateDefinitionsFactory(_ref) {
76
78
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
77
79
  * @param {Object} opts.giftcertificate - Gift certificate payload
78
80
  * @param {Object} [opts.headers] - Optional headers
79
- * @returns {Promise<import("axios").AxiosResponse>}
81
+ * @returns {Promise<import("axios").AxiosResponse<{ giftcertificate: Object }>>}
82
+ * @throws When the API returns an error. 400 WRONG_DATA; 401 Unauthorized; 500.
80
83
  */
81
84
  function create(_ref4) {
82
85
  var token = _ref4.token,
@@ -103,7 +106,8 @@ function giftCertificateDefinitionsFactory(_ref) {
103
106
  * @param {string} opts.giftcertificateId - Gift certificate definition id
104
107
  * @param {Object} opts.giftcertificate - Gift certificate payload
105
108
  * @param {Object} [opts.headers] - Optional headers
106
- * @returns {Promise<import("axios").AxiosResponse>}
109
+ * @returns {Promise<import("axios").AxiosResponse<{ giftcertificate: Object }>>}
110
+ * @throws 400 WRONG_DATA, GIFTCERTIFICATE_ID; 401; 404 GIFTCERTIFICATE_NOT_FOUND; 500.
107
111
  */
108
112
  function update(_ref5) {
109
113
  var token = _ref5.token,
@@ -130,7 +134,8 @@ function giftCertificateDefinitionsFactory(_ref) {
130
134
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
131
135
  * @param {string} opts.giftcertificateId - Gift certificate definition id
132
136
  * @param {Object} [opts.headers] - Optional headers
133
- * @returns {Promise<import("axios").AxiosResponse>}
137
+ * @returns {Promise<import("axios").AxiosResponse<{ giftcertificateId: string }>>}
138
+ * @throws 400 WRONG_DATA, GIFTCERTIFICATE_ID, GIFT_CERTIFICATE_DEFINITION_ALREADY_IMPLEMENTED; 401; 404; 500.
134
139
  */
135
140
  function remove(_ref6) {
136
141
  var token = _ref6.token,
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+
3
+ var _require = require("../endpoints_helpers.js"),
4
+ authorizationHeaders = _require.authorizationHeaders;
5
+
6
+ /**
7
+ * Query params for GET /holidays (btrz-api-inventory). See get-handler getSpec().
8
+ * @typedef {Object} HolidaysListQuery
9
+ * @property {number} [page] - The page number to retrieve
10
+ * @property {string} [providerId] - Provider (account) id to list holidays for
11
+ */
12
+
13
+ /**
14
+ * Factory for holidays API (btrz-api-inventory).
15
+ * @param {Object} deps
16
+ * @param {import("axios").AxiosInstance} deps.client
17
+ * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
18
+ * @returns {{ all: function, get: function, create: function, update: function, remove: function }}
19
+ */
20
+
21
+
22
+ function holidaysFactory(_ref) {
23
+ var client = _ref.client,
24
+ internalAuthTokenProvider = _ref.internalAuthTokenProvider;
25
+
26
+ /**
27
+ * GET /holidays - list holidays (paginated).
28
+ * @param {Object} opts
29
+ * @param {string} [opts.token] - API key
30
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
31
+ * @param {HolidaysListQuery} [opts.query] - Query params (page, providerId)
32
+ * @param {Object} [opts.headers] - Optional headers
33
+ * @returns {Promise<import("axios").AxiosResponse<{ holidays: Object[], next?: string, previous?: string, count: number }>>}
34
+ * @throws 400 INVALID_PAGE; 401; 500.
35
+ */
36
+ function all(_ref2) {
37
+ var token = _ref2.token,
38
+ jwtToken = _ref2.jwtToken,
39
+ _ref2$query = _ref2.query,
40
+ query = _ref2$query === undefined ? {} : _ref2$query,
41
+ headers = _ref2.headers;
42
+
43
+ return client.get("/holidays", {
44
+ params: query,
45
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
46
+ });
47
+ }
48
+
49
+ /**
50
+ * GET /holidays/:holidayId - get holiday by id.
51
+ * @param {Object} opts
52
+ * @param {string} [opts.token] - API key
53
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
54
+ * @param {string} opts.holidayId - Holiday id (24 hex characters)
55
+ * @param {{ providerId?: string }} [opts.query] - Optional providerId
56
+ * @param {Object} [opts.headers] - Optional headers
57
+ * @returns {Promise<import("axios").AxiosResponse<{ holiday: Object }>>}
58
+ * @throws 400 INVALID_HOLIDAY_ID, INVALID_PROVIDER_ID; 401; 404 HOLIDAY_NOT_FOUND; 500.
59
+ */
60
+ function get(_ref3) {
61
+ var token = _ref3.token,
62
+ jwtToken = _ref3.jwtToken,
63
+ holidayId = _ref3.holidayId,
64
+ _ref3$query = _ref3.query,
65
+ query = _ref3$query === undefined ? {} : _ref3$query,
66
+ headers = _ref3.headers;
67
+
68
+ return client({
69
+ url: "/holidays/" + holidayId,
70
+ method: "get",
71
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
72
+ params: query
73
+ });
74
+ }
75
+
76
+ /**
77
+ * POST /holidays - create holiday.
78
+ * @param {Object} opts
79
+ * @param {string} [opts.token] - API key
80
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
81
+ * @param {Object} opts.holiday - Holiday payload (day, month, year required; name, blackout, recurring, externalId optional)
82
+ * @param {Object} [opts.headers] - Optional headers
83
+ * @returns {Promise<import("axios").AxiosResponse<{ holiday: Object }>>}
84
+ * @throws 400 WRONG_DATA; 401; 500.
85
+ */
86
+ function create(_ref4) {
87
+ var token = _ref4.token,
88
+ jwtToken = _ref4.jwtToken,
89
+ holiday = _ref4.holiday,
90
+ headers = _ref4.headers;
91
+
92
+ return client({
93
+ url: "/holidays",
94
+ method: "post",
95
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
96
+ data: { holiday: holiday }
97
+ });
98
+ }
99
+
100
+ /**
101
+ * PUT /holidays/:holidayId - update holiday.
102
+ * @param {Object} opts
103
+ * @param {string} [opts.token] - API key
104
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
105
+ * @param {string} opts.holidayId - Holiday id
106
+ * @param {Object} opts.holiday - Holiday payload
107
+ * @param {Object} [opts.headers] - Optional headers
108
+ * @returns {Promise<import("axios").AxiosResponse<{ holiday: Object }>>}
109
+ * @throws 400 WRONG_DATA, INVALID_HOLIDAY_ID; 401; 404 HOLIDAY_NOT_FOUND; 500.
110
+ */
111
+ function update(_ref5) {
112
+ var token = _ref5.token,
113
+ jwtToken = _ref5.jwtToken,
114
+ holidayId = _ref5.holidayId,
115
+ holiday = _ref5.holiday,
116
+ headers = _ref5.headers;
117
+
118
+ return client({
119
+ url: "/holidays/" + holidayId,
120
+ method: "put",
121
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
122
+ data: { holiday: holiday }
123
+ });
124
+ }
125
+
126
+ /**
127
+ * DELETE /holidays/:holidayId - remove holiday.
128
+ * @param {Object} opts
129
+ * @param {string} [opts.token] - API key
130
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
131
+ * @param {string} opts.holidayId - Holiday id
132
+ * @param {Object} [opts.headers] - Optional headers
133
+ * @returns {Promise<import("axios").AxiosResponse<{ holidayId: string }>>}
134
+ * @throws 400 INVALID_HOLIDAY_ID; 401; 404 HOLIDAY_NOT_FOUND; 500.
135
+ */
136
+ function remove(_ref6) {
137
+ var token = _ref6.token,
138
+ jwtToken = _ref6.jwtToken,
139
+ holidayId = _ref6.holidayId,
140
+ headers = _ref6.headers;
141
+
142
+ return client({
143
+ url: "/holidays/" + holidayId,
144
+ method: "delete",
145
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
146
+ });
147
+ }
148
+
149
+ return {
150
+ all: all,
151
+ get: get,
152
+ create: create,
153
+ update: update,
154
+ remove: remove
155
+ };
156
+ }
157
+
158
+ module.exports = holidaysFactory;
@@ -6,9 +6,9 @@ var _require = require("./../endpoints_helpers.js"),
6
6
  /**
7
7
  * Query params for GET /insurances (btrz-api-inventory). See get-insurances getSpec().
8
8
  * @typedef {Object} InsurancesListQuery
9
- * @property {string} [productId] - Filter by product id
10
- * @property {boolean} [enabled] - Filter by enabled
11
- * @property {string[]} [providerIds] - Filter by provider ids
9
+ * @property {string} [productId] - The ids of the products to get insurances for
10
+ * @property {string} [enabled] - Filter insurances if they are enabled or not [true, false]
11
+ * @property {string} [providerIds] - The ids of the providers to get products for
12
12
  */
13
13
 
14
14
  /**
@@ -25,12 +25,13 @@ function insurancesFactory(_ref) {
25
25
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
26
26
 
27
27
  /**
28
- * GET /insurances - list insurances.
28
+ * GET /insurances - list insurances for the account and product provided.
29
29
  * @param {Object} opts
30
30
  * @param {string} [opts.token] - API key
31
31
  * @param {InsurancesListQuery} [opts.query] - Query params (productId, enabled, providerIds)
32
32
  * @param {Object} [opts.headers] - Optional headers
33
- * @returns {Promise<import("axios").AxiosResponse>}
33
+ * @returns {Promise<import("axios").AxiosResponse<{ insurances: Object[] }>>}
34
+ * @throws 400 INVALID_PRODUCTIDS; 401; 500.
34
35
  */
35
36
  function all(_ref2) {
36
37
  var token = _ref2.token,
@@ -47,12 +48,13 @@ function insurancesFactory(_ref) {
47
48
  }
48
49
 
49
50
  /**
50
- * GET /insurances/:insuranceId - get insurance by id. API does not accept query params.
51
+ * GET /insurances/:insuranceId - get insurance by id.
51
52
  * @param {Object} opts
52
53
  * @param {string} [opts.token] - API key
53
- * @param {string} opts.insuranceId - Insurance id
54
+ * @param {string} opts.insuranceId - Insurance id (24 hex characters)
54
55
  * @param {Object} [opts.headers] - Optional headers
55
- * @returns {Promise<import("axios").AxiosResponse>}
56
+ * @returns {Promise<import("axios").AxiosResponse<{ insurance: Object }>>}
57
+ * @throws 400 INVALID_INSURANCE_ID; 401; 404 INSURANCE_NOT_FOUND; 500.
56
58
  */
57
59
  function get(_ref3) {
58
60
  var token = _ref3.token,
@@ -92,14 +94,15 @@ function insurancesFactory(_ref) {
92
94
  }
93
95
 
94
96
  /**
95
- * PUT /insurances/:insuranceId - update insurance. API does not accept query params.
97
+ * PUT /insurances/:insuranceId - update insurance.
96
98
  * @param {Object} opts
97
99
  * @param {string} [opts.token] - API key
98
100
  * @param {Object} opts.insurance - Insurance payload
99
101
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
100
102
  * @param {string} opts.insuranceId - Insurance id
101
103
  * @param {Object} [opts.headers] - Optional headers
102
- * @returns {Promise<import("axios").AxiosResponse>}
104
+ * @returns {Promise<import("axios").AxiosResponse<{ insurance: Object }>>}
105
+ * @throws 400 WRONG_DATA; 401; 404 INSURANCE_NOT_FOUND; 500.
103
106
  */
104
107
  function update(_ref5) {
105
108
  var token = _ref5.token,
@@ -119,13 +122,14 @@ function insurancesFactory(_ref) {
119
122
  }
120
123
 
121
124
  /**
122
- * DELETE /insurances/:insuranceId - remove insurance. API does not accept query params.
125
+ * DELETE /insurances/:insuranceId - remove insurance.
123
126
  * @param {Object} opts
124
127
  * @param {string} [opts.token] - API key
125
128
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
126
- * @param {string} opts.insuranceId - Insurance id
129
+ * @param {string} opts.insuranceId - Insurance id (24 hex characters)
127
130
  * @param {Object} [opts.headers] - Optional headers
128
- * @returns {Promise<import("axios").AxiosResponse>}
131
+ * @returns {Promise<import("axios").AxiosResponse<{ insuranceId: string }>>}
132
+ * @throws 400 INVALID_INSURANCE_ID; 401; 404 INSURANCE_NOT_FOUND; 500.
129
133
  */
130
134
  function remove(_ref6) {
131
135
  var token = _ref6.token,
@@ -36,13 +36,14 @@ function itemsFactory(_ref) {
36
36
  internalAuthTokenProvider = _ref.internalAuthTokenProvider;
37
37
 
38
38
  /**
39
- * GET /items - list items.
39
+ * GET /items - list items (paginated).
40
40
  * @param {Object} opts
41
41
  * @param {string} [opts.token] - API key
42
42
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
43
43
  * @param {ItemsQuery} [opts.query] - Query params (productId, disabled, type, providerIds, channels, currency, etc.)
44
44
  * @param {Object} [opts.headers] - Optional headers
45
- * @returns {Promise<import("axios").AxiosResponse>}
45
+ * @returns {Promise<import("axios").AxiosResponse<{ items: Object[], next?: string, previous?: string, count: number }>>}
46
+ * @throws 401; 500.
46
47
  */
47
48
  function all(_ref2) {
48
49
  var token = _ref2.token,
@@ -63,10 +64,11 @@ function itemsFactory(_ref) {
63
64
  * @param {Object} opts
64
65
  * @param {string} [opts.token] - API key
65
66
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
66
- * @param {string} opts.itemId - Item id (ObjectId format)
67
+ * @param {string} opts.itemId - Item id (24 hex characters)
67
68
  * @param {ItemByIdQuery} [opts.query] - Query params (currency)
68
69
  * @param {Object} [opts.headers] - Optional headers
69
- * @returns {Promise<import("axios").AxiosResponse>}
70
+ * @returns {Promise<import("axios").AxiosResponse<{ item: Object }>>}
71
+ * @throws 400 INVALID_ITEM_ID; 401; 404 ITEM_NOT_FOUND; 500.
70
72
  */
71
73
  function get(_ref3) {
72
74
  var itemId = _ref3.itemId,
@@ -87,9 +89,10 @@ function itemsFactory(_ref) {
87
89
  * @param {Object} opts
88
90
  * @param {string} [opts.token] - API key
89
91
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
90
- * @param {Object} opts.item - Item payload
92
+ * @param {Object} opts.item - Item payload (ItemPostData: name, productId, type, amount, valueType, order, etc.)
91
93
  * @param {Object} [opts.headers] - Optional headers
92
- * @returns {Promise<import("axios").AxiosResponse>}
94
+ * @returns {Promise<import("axios").AxiosResponse<{ item: Object }>>}
95
+ * @throws 400 WRONG_DATA, PRODUCT_ID_INVALID, etc.; 401; 404 PRODUCT_NOT_FOUND, etc.; 500.
93
96
  */
94
97
  function create(_ref4) {
95
98
  var jwtToken = _ref4.jwtToken,
@@ -110,10 +113,11 @@ function itemsFactory(_ref) {
110
113
  * @param {Object} opts
111
114
  * @param {string} [opts.token] - API key
112
115
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
113
- * @param {string} opts.itemId - Item id
114
- * @param {Object} opts.item - Item payload
116
+ * @param {string} opts.itemId - Item id (24 hex characters)
117
+ * @param {Object} opts.item - Item payload (ItemPostData)
115
118
  * @param {Object} [opts.headers] - Optional headers
116
- * @returns {Promise<import("axios").AxiosResponse>}
119
+ * @returns {Promise<import("axios").AxiosResponse<{ item: Object }>>}
120
+ * @throws 400 WRONG_DATA, INVALID ids; 401; 404 ITEM_NOT_FOUND, PRODUCT_NOT_FOUND, etc.; 500.
117
121
  */
118
122
  function update(_ref5) {
119
123
  var jwtToken = _ref5.jwtToken,