btrz-api-client 8.45.1 → 8.47.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.
@@ -114,6 +114,35 @@ function externalWalletsFactory(_ref) {
114
114
  }
115
115
  });
116
116
  },
117
+ nip: {
118
+ /**
119
+ * PUT /external-wallets/saldo-max/:walletId/nip - update SaldoMax external wallet's NIP.
120
+ * @param {Object} opts
121
+ * @param {string} [opts.token] - API key
122
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
123
+ * @param {Object} opts.walletId - The walletId of the SaldoMax wallet
124
+ * @param {Object} opts.nip - The new NIP
125
+ * @param {Object} [opts.headers] - Optional headers
126
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
127
+ * @throws When response is 4xx/5xx (400, 401, 404 EXTERNAL_WALLET_NOT_FOUND, 500)
128
+ */
129
+ update: function update(_ref6) {
130
+ var token = _ref6.token,
131
+ jwtToken = _ref6.jwtToken,
132
+ walletId = _ref6.walletId,
133
+ nip = _ref6.nip,
134
+ headers = _ref6.headers;
135
+
136
+ return client({
137
+ url: "/external-wallets/saldo-max/" + walletId + "/nip",
138
+ method: "put",
139
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
140
+ data: {
141
+ nip: nip
142
+ }
143
+ });
144
+ }
145
+ },
117
146
  /** @type {{ create: function }} */
118
147
  movements: {
119
148
  /**
@@ -127,12 +156,12 @@ function externalWalletsFactory(_ref) {
127
156
  * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
128
157
  * @throws When response is 4xx/5xx (400, 401, 403 INVALID_NIP/WALLET_BLOCKED/WALLET_NOT_ACTIVE, 404, 500)
129
158
  */
130
- create: function create(_ref6) {
131
- var token = _ref6.token,
132
- jwtToken = _ref6.jwtToken,
133
- walletId = _ref6.walletId,
134
- movement = _ref6.movement,
135
- headers = _ref6.headers;
159
+ create: function create(_ref7) {
160
+ var token = _ref7.token,
161
+ jwtToken = _ref7.jwtToken,
162
+ walletId = _ref7.walletId,
163
+ movement = _ref7.movement,
164
+ headers = _ref7.headers;
136
165
 
137
166
  return client({
138
167
  url: "/external-wallets/saldo-max/" + walletId + "/movements",
@@ -131,7 +131,7 @@ function schedulesFactory(_ref) {
131
131
  }
132
132
 
133
133
  /**
134
- * PUT /routes/:routeId/schedules/:scheduleId - update schedule. API does not accept query params.
134
+ * PUT /routes/:routeId/schedules/:scheduleId/validations - validate schedule update. API does not accept query params.
135
135
  * @param {Object} opts
136
136
  * @param {string} [opts.token] - API key
137
137
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
@@ -141,7 +141,7 @@ function schedulesFactory(_ref) {
141
141
  * @param {Object} [opts.headers] - Optional headers
142
142
  * @returns {Promise<import("axios").AxiosResponse>}
143
143
  */
144
- function update(_ref6) {
144
+ function runUpdateValidations(_ref6) {
145
145
  var token = _ref6.token,
146
146
  jwtToken = _ref6.jwtToken,
147
147
  data = _ref6.data,
@@ -150,7 +150,7 @@ function schedulesFactory(_ref) {
150
150
  headers = _ref6.headers;
151
151
 
152
152
  return client({
153
- url: "/routes/" + routeId + "/schedules/" + scheduleId,
153
+ url: "/routes/" + routeId + "/schedules/" + scheduleId + "/validations",
154
154
  method: "put",
155
155
  headers: authorizationHeaders({
156
156
  token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
@@ -160,22 +160,51 @@ function schedulesFactory(_ref) {
160
160
  }
161
161
 
162
162
  /**
163
- * DELETE /routes/:routeId/schedules/:scheduleId - delete schedule. API does not accept query params.
163
+ * PUT /routes/:routeId/schedules/:scheduleId - update schedule. API does not accept query params.
164
164
  * @param {Object} opts
165
165
  * @param {string} [opts.token] - API key
166
166
  * @param {string} [opts.jwtToken] - JWT or internal auth symbol
167
167
  * @param {string} opts.routeId - Route id
168
168
  * @param {string} opts.scheduleId - Schedule id
169
+ * @param {Object} opts.data - Schedule payload
169
170
  * @param {Object} [opts.headers] - Optional headers
170
171
  * @returns {Promise<import("axios").AxiosResponse>}
171
172
  */
172
- function deleteSchedule(_ref7) {
173
+ function update(_ref7) {
173
174
  var token = _ref7.token,
174
175
  jwtToken = _ref7.jwtToken,
176
+ data = _ref7.data,
175
177
  routeId = _ref7.routeId,
176
178
  scheduleId = _ref7.scheduleId,
177
179
  headers = _ref7.headers;
178
180
 
181
+ return client({
182
+ url: "/routes/" + routeId + "/schedules/" + scheduleId,
183
+ method: "put",
184
+ headers: authorizationHeaders({
185
+ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
186
+ }),
187
+ data: data
188
+ });
189
+ }
190
+
191
+ /**
192
+ * DELETE /routes/:routeId/schedules/:scheduleId - delete schedule. API does not accept query params.
193
+ * @param {Object} opts
194
+ * @param {string} [opts.token] - API key
195
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
196
+ * @param {string} opts.routeId - Route id
197
+ * @param {string} opts.scheduleId - Schedule id
198
+ * @param {Object} [opts.headers] - Optional headers
199
+ * @returns {Promise<import("axios").AxiosResponse>}
200
+ */
201
+ function deleteSchedule(_ref8) {
202
+ var token = _ref8.token,
203
+ jwtToken = _ref8.jwtToken,
204
+ routeId = _ref8.routeId,
205
+ scheduleId = _ref8.scheduleId,
206
+ headers = _ref8.headers;
207
+
179
208
  return client({
180
209
  url: "/routes/" + routeId + "/schedules/" + scheduleId,
181
210
  method: "delete",
@@ -196,11 +225,11 @@ function schedulesFactory(_ref) {
196
225
  * @param {Object} [opts.headers] - Optional headers
197
226
  * @returns {Promise<import("axios").AxiosResponse>}
198
227
  */
199
- create: function create(_ref8) {
200
- var token = _ref8.token,
201
- jwtToken = _ref8.jwtToken,
202
- data = _ref8.data,
203
- headers = _ref8.headers;
228
+ create: function create(_ref9) {
229
+ var token = _ref9.token,
230
+ jwtToken = _ref9.jwtToken,
231
+ data = _ref9.data,
232
+ headers = _ref9.headers;
204
233
 
205
234
  return client({
206
235
  url: "/routes/schedules/auto-bouncing",
@@ -221,12 +250,12 @@ function schedulesFactory(_ref) {
221
250
  * @param {Object} [opts.headers] - Optional headers
222
251
  * @returns {Promise<import("axios").AxiosResponse>}
223
252
  */
224
- delete: function _delete(_ref9) {
225
- var token = _ref9.token,
226
- jwtToken = _ref9.jwtToken,
227
- routeId = _ref9.routeId,
228
- parentScheduleId = _ref9.parentScheduleId,
229
- headers = _ref9.headers;
253
+ delete: function _delete(_ref10) {
254
+ var token = _ref10.token,
255
+ jwtToken = _ref10.jwtToken,
256
+ routeId = _ref10.routeId,
257
+ parentScheduleId = _ref10.parentScheduleId,
258
+ headers = _ref10.headers;
230
259
 
231
260
  return client({
232
261
  url: "/routes/" + routeId + "/schedules/" + parentScheduleId + "/auto-bouncing",
@@ -250,12 +279,12 @@ function schedulesFactory(_ref) {
250
279
  * @param {Object} [opts.headers] - Optional headers
251
280
  * @returns {Promise<import("axios").AxiosResponse>}
252
281
  */
253
- create: function create(_ref10) {
254
- var token = _ref10.token,
255
- jwtToken = _ref10.jwtToken,
256
- data = _ref10.data,
257
- scheduleId = _ref10.scheduleId,
258
- headers = _ref10.headers;
282
+ create: function create(_ref11) {
283
+ var token = _ref11.token,
284
+ jwtToken = _ref11.jwtToken,
285
+ data = _ref11.data,
286
+ scheduleId = _ref11.scheduleId,
287
+ headers = _ref11.headers;
259
288
 
260
289
  return client({
261
290
  url: "/schedules/" + scheduleId + "/schedule-exceptions",
@@ -276,12 +305,12 @@ function schedulesFactory(_ref) {
276
305
  * @param {Object} [opts.headers] - Optional headers
277
306
  * @returns {Promise<import("axios").AxiosResponse>}
278
307
  */
279
- delete: function _delete(_ref11) {
280
- var token = _ref11.token,
281
- jwtToken = _ref11.jwtToken,
282
- scheduleId = _ref11.scheduleId,
283
- exceptionId = _ref11.exceptionId,
284
- headers = _ref11.headers;
308
+ delete: function _delete(_ref12) {
309
+ var token = _ref12.token,
310
+ jwtToken = _ref12.jwtToken,
311
+ scheduleId = _ref12.scheduleId,
312
+ exceptionId = _ref12.exceptionId,
313
+ headers = _ref12.headers;
285
314
 
286
315
  return client({
287
316
  url: "/schedules/" + scheduleId + "/schedule-exceptions/" + exceptionId,
@@ -302,13 +331,13 @@ function schedulesFactory(_ref) {
302
331
  * @param {Object} [opts.headers] - Optional headers
303
332
  * @returns {Promise<import("axios").AxiosResponse>}
304
333
  */
305
- update: function update(_ref12) {
306
- var token = _ref12.token,
307
- jwtToken = _ref12.jwtToken,
308
- data = _ref12.data,
309
- scheduleId = _ref12.scheduleId,
310
- exceptionId = _ref12.exceptionId,
311
- headers = _ref12.headers;
334
+ update: function update(_ref13) {
335
+ var token = _ref13.token,
336
+ jwtToken = _ref13.jwtToken,
337
+ data = _ref13.data,
338
+ scheduleId = _ref13.scheduleId,
339
+ exceptionId = _ref13.exceptionId,
340
+ headers = _ref13.headers;
312
341
 
313
342
  return client({
314
343
  url: "/schedules/" + scheduleId + "/schedule-exceptions/" + exceptionId,
@@ -328,6 +357,7 @@ function schedulesFactory(_ref) {
328
357
  update: update,
329
358
  delete: deleteSchedule,
330
359
  validations: validations,
360
+ runUpdateValidations: runUpdateValidations,
331
361
  autoBouncing: autoBouncing,
332
362
  exceptions: exceptions
333
363
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "8.45.1",
3
+ "version": "8.47.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -87,6 +87,29 @@ function externalWalletsFactory({client, internalAuthTokenProvider}) {
87
87
  }
88
88
  });
89
89
  },
90
+ nip: {
91
+ /**
92
+ * PUT /external-wallets/saldo-max/:walletId/nip - update SaldoMax external wallet's NIP.
93
+ * @param {Object} opts
94
+ * @param {string} [opts.token] - API key
95
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
96
+ * @param {Object} opts.walletId - The walletId of the SaldoMax wallet
97
+ * @param {Object} opts.nip - The new NIP
98
+ * @param {Object} [opts.headers] - Optional headers
99
+ * @returns {Promise<import("axios").AxiosResponse<{ externalWallet: Object }>>}
100
+ * @throws When response is 4xx/5xx (400, 401, 404 EXTERNAL_WALLET_NOT_FOUND, 500)
101
+ */
102
+ update: ({token, jwtToken, walletId, nip, headers}) => {
103
+ return client({
104
+ url: `/external-wallets/saldo-max/${walletId}/nip`,
105
+ method: "put",
106
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
107
+ data: {
108
+ nip
109
+ }
110
+ });
111
+ }
112
+ },
90
113
  /** @type {{ create: function }} */
91
114
  movements: {
92
115
  /**
@@ -98,6 +98,28 @@ function schedulesFactory({client, internalAuthTokenProvider}) {
98
98
  });
99
99
  }
100
100
 
101
+ /**
102
+ * PUT /routes/:routeId/schedules/:scheduleId/validations - validate schedule update. API does not accept query params.
103
+ * @param {Object} opts
104
+ * @param {string} [opts.token] - API key
105
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
106
+ * @param {string} opts.routeId - Route id
107
+ * @param {string} opts.scheduleId - Schedule id
108
+ * @param {Object} opts.data - Schedule payload
109
+ * @param {Object} [opts.headers] - Optional headers
110
+ * @returns {Promise<import("axios").AxiosResponse>}
111
+ */
112
+ function runUpdateValidations({token, jwtToken, data, routeId, scheduleId, headers}) {
113
+ return client({
114
+ url: `/routes/${routeId}/schedules/${scheduleId}/validations`,
115
+ method: "put",
116
+ headers: authorizationHeaders({
117
+ token, jwtToken, internalAuthTokenProvider, headers
118
+ }),
119
+ data
120
+ });
121
+ }
122
+
101
123
  /**
102
124
  * PUT /routes/:routeId/schedules/:scheduleId - update schedule. API does not accept query params.
103
125
  * @param {Object} opts
@@ -253,6 +275,7 @@ function schedulesFactory({client, internalAuthTokenProvider}) {
253
275
  update,
254
276
  delete: deleteSchedule,
255
277
  validations,
278
+ runUpdateValidations,
256
279
  autoBouncing,
257
280
  exceptions
258
281
  };
@@ -102,4 +102,11 @@ describe("inventory/routes/shedules", () => {
102
102
  }));
103
103
  return api.inventory.schedules.validations({token, jwtToken, data, routeId});
104
104
  });
105
+
106
+ it("should validate a schedule update request", () => {
107
+ axiosMock.onPut(`/routes/${routeId}/schedules/${scheduleId}/validations`).reply(expectRequest({
108
+ statusCode: 200, token, jwtToken
109
+ }));
110
+ return api.inventory.schedules.runUpdateValidations({token, jwtToken, data, routeId, scheduleId});
111
+ });
105
112
  });