btrz-api-client 9.19.0 → 9.20.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.
@@ -28,12 +28,18 @@ const {
28
28
  * @property {boolean} [nextSequenceNumber] - Include next sequence number
29
29
  */
30
30
 
31
+ /**
32
+ * Query params for GET /users/sequences (btrz-api-accounts).
33
+ * @typedef {Object} UsersSequencesBulkQuery
34
+ * @property {string} [userIds] - Comma-separated user ids whose sequences to return
35
+ */
36
+
31
37
  /**
32
38
  * Factory for users API (btrz-api-accounts).
33
39
  * @param {Object} deps
34
40
  * @param {import("axios").AxiosInstance} deps.client
35
41
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
36
- * @returns {{ get: function, getV2: function, all: function, create: function, login: function, update: function, delete: function, createOrUpdateMany: function, impersonate: function, startMfa: function, confirmMfa: function, disableMfa: function, sequences: { get: function, all: function, create: function, update: function, transfer: function } }}
42
+ * @returns {{ get: function, getV2: function, all: function, create: function, login: function, update: function, delete: function, createOrUpdateMany: function, impersonate: function, startMfa: function, confirmMfa: function, disableMfa: function, sequences: { get: function, all: function, allByUserIds: function, create: function, update: function, transfer: function } }}
37
43
  */
38
44
  function usersFactory({
39
45
  client,
@@ -526,6 +532,32 @@ function usersFactory({
526
532
  newUserId
527
533
  }
528
534
  });
535
+ },
536
+ /**
537
+ * GET /users/sequences - list sequences for multiple users.
538
+ * @param {Object} opts
539
+ * @param {string} [opts.token] - API key
540
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
541
+ * @param {UsersSequencesBulkQuery} [opts.query] - Query params (userIds)
542
+ * @param {Object} [opts.headers] - Optional headers
543
+ * @returns {Promise<import("axios").AxiosResponse>}
544
+ */
545
+ allByUserIds({
546
+ token,
547
+ jwtToken,
548
+ query = {},
549
+ headers
550
+ }) {
551
+ return client({
552
+ url: "/users/sequences",
553
+ params: query,
554
+ headers: authorizationHeaders({
555
+ token,
556
+ jwtToken,
557
+ internalAuthTokenProvider,
558
+ headers
559
+ })
560
+ });
529
561
  }
530
562
  };
531
563
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "9.19.0",
3
+ "version": "9.20.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,12 +26,18 @@ const {authorizationHeaders} = require("./../endpoints_helpers.js");
26
26
  * @property {boolean} [nextSequenceNumber] - Include next sequence number
27
27
  */
28
28
 
29
+ /**
30
+ * Query params for GET /users/sequences (btrz-api-accounts).
31
+ * @typedef {Object} UsersSequencesBulkQuery
32
+ * @property {string} [userIds] - Comma-separated user ids whose sequences to return
33
+ */
34
+
29
35
  /**
30
36
  * Factory for users API (btrz-api-accounts).
31
37
  * @param {Object} deps
32
38
  * @param {import("axios").AxiosInstance} deps.client
33
39
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
34
- * @returns {{ get: function, getV2: function, all: function, create: function, login: function, update: function, delete: function, createOrUpdateMany: function, impersonate: function, startMfa: function, confirmMfa: function, disableMfa: function, sequences: { get: function, all: function, create: function, update: function, transfer: function } }}
40
+ * @returns {{ get: function, getV2: function, all: function, create: function, login: function, update: function, delete: function, createOrUpdateMany: function, impersonate: function, startMfa: function, confirmMfa: function, disableMfa: function, sequences: { get: function, all: function, allByUserIds: function, create: function, update: function, transfer: function } }}
35
41
  */
36
42
  function usersFactory({client, internalAuthTokenProvider}) {
37
43
  /**
@@ -332,6 +338,22 @@ function usersFactory({client, internalAuthTokenProvider}) {
332
338
  newUserId
333
339
  }
334
340
  });
341
+ },
342
+ /**
343
+ * GET /users/sequences - list sequences for multiple users.
344
+ * @param {Object} opts
345
+ * @param {string} [opts.token] - API key
346
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
347
+ * @param {UsersSequencesBulkQuery} [opts.query] - Query params (userIds)
348
+ * @param {Object} [opts.headers] - Optional headers
349
+ * @returns {Promise<import("axios").AxiosResponse>}
350
+ */
351
+ allByUserIds({token, jwtToken, query = {}, headers}) {
352
+ return client({
353
+ url: "/users/sequences",
354
+ params: query,
355
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
356
+ });
335
357
  }
336
358
  };
337
359
 
@@ -205,4 +205,28 @@ describe("accounts/user/{id}", () => {
205
205
  newUserId
206
206
  });
207
207
  });
208
+
209
+ it("should GET /users/sequences with query.userIds", () => {
210
+ const query = {userIds: "1234321,9876543"};
211
+ axiosMock.onGet("/users/sequences", {params: query}).reply(
212
+ expectRequest({statusCode: 200, token, jwtToken, query})
213
+ );
214
+ return api.accounts.users.sequences.allByUserIds({
215
+ jwtToken,
216
+ token,
217
+ query
218
+ });
219
+ });
220
+
221
+ it("should GET /users/sequences without inventing extra query params", () => {
222
+ const query = {userIds: "1234321"};
223
+ axiosMock.onGet("/users/sequences").reply(
224
+ expectRequest({statusCode: 200, token, jwtToken, query})
225
+ );
226
+ return api.accounts.users.sequences.allByUserIds({
227
+ jwtToken,
228
+ token,
229
+ query
230
+ });
231
+ });
208
232
  });
@@ -4,7 +4,7 @@ export = usersFactory;
4
4
  * @param {Object} deps
5
5
  * @param {import("axios").AxiosInstance} deps.client
6
6
  * @param {{ getToken: function(): string }} [deps.internalAuthTokenProvider]
7
- * @returns {{ get: function, getV2: function, all: function, create: function, login: function, update: function, delete: function, createOrUpdateMany: function, impersonate: function, startMfa: function, confirmMfa: function, disableMfa: function, sequences: { get: function, all: function, create: function, update: function, transfer: function } }}
7
+ * @returns {{ get: function, getV2: function, all: function, create: function, login: function, update: function, delete: function, createOrUpdateMany: function, impersonate: function, startMfa: function, confirmMfa: function, disableMfa: function, sequences: { get: function, all: function, allByUserIds: function, create: function, update: function, transfer: function } }}
8
8
  */
9
9
  declare function usersFactory({ client, internalAuthTokenProvider }: {
10
10
  client: import("axios").AxiosInstance;
@@ -27,6 +27,7 @@ declare function usersFactory({ client, internalAuthTokenProvider }: {
27
27
  sequences: {
28
28
  get: Function;
29
29
  all: Function;
30
+ allByUserIds: Function;
30
31
  create: Function;
31
32
  update: Function;
32
33
  transfer: Function;