btrz-api-client 9.32.0 → 9.33.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.
@@ -42,8 +42,31 @@ function currentShiftsFactory({
42
42
  params: query
43
43
  });
44
44
  }
45
+
46
+ /**
47
+ * GET /users/:userId/current-shift-location - location `_id`, `name`, and `zone` for the open shift.
48
+ * @param {Object} opts
49
+ * @param {string} [opts.token] - API key
50
+ * @param {string} opts.userId - User id (ObjectId)
51
+ * @param {Object} [opts.headers] - Optional headers
52
+ * @returns {Promise<import("axios").AxiosResponse>}
53
+ */
54
+ function getLocation({
55
+ token,
56
+ userId,
57
+ headers
58
+ }) {
59
+ return client.get(`/users/${userId}/current-shift-location`, {
60
+ headers: authorizationHeaders({
61
+ token,
62
+ internalAuthTokenProvider,
63
+ headers
64
+ })
65
+ });
66
+ }
45
67
  return {
46
- get
68
+ get,
69
+ getLocation
47
70
  };
48
71
  }
49
72
  module.exports = currentShiftsFactory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "9.32.0",
3
+ "version": "9.33.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -31,8 +31,23 @@ function currentShiftsFactory({client, internalAuthTokenProvider}) {
31
31
  });
32
32
  }
33
33
 
34
+ /**
35
+ * GET /users/:userId/current-shift-location - location `_id`, `name`, and `zone` for the open shift.
36
+ * @param {Object} opts
37
+ * @param {string} [opts.token] - API key
38
+ * @param {string} opts.userId - User id (ObjectId)
39
+ * @param {Object} [opts.headers] - Optional headers
40
+ * @returns {Promise<import("axios").AxiosResponse>}
41
+ */
42
+ function getLocation({token, userId, headers}) {
43
+ return client.get(`/users/${userId}/current-shift-location`, {
44
+ headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
45
+ });
46
+ }
47
+
34
48
  return {
35
- get
49
+ get,
50
+ getLocation
36
51
  };
37
52
  }
38
53
 
@@ -16,4 +16,12 @@ describe("accounts/users/:userId/current-shift", () => {
16
16
  .reply(expectRequest({statusCode: 200, token}));
17
17
  return api.accounts.currentShifts.get({token, userId, query});
18
18
  });
19
+
20
+ it("should get current-shift-location", () => {
21
+ const userId = "userId1";
22
+
23
+ axiosMock.onGet(`/users/${userId}/current-shift-location`)
24
+ .reply(expectRequest({statusCode: 200, token}));
25
+ return api.accounts.currentShifts.getLocation({token, userId});
26
+ });
19
27
  });
@@ -4,7 +4,7 @@ export = currentShiftsFactory;
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 }}
7
+ * @returns {{ get: function, getLocation: function }}
8
8
  */
9
9
  declare function currentShiftsFactory({ client, internalAuthTokenProvider }: {
10
10
  client: import("axios").AxiosInstance;
@@ -13,4 +13,5 @@ declare function currentShiftsFactory({ client, internalAuthTokenProvider }: {
13
13
  };
14
14
  }): {
15
15
  get: Function;
16
+ getLocation: Function;
16
17
  };