btrz-api-client 9.14.0 → 9.16.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.
@@ -1,4 +1,4 @@
1
- /* eslint-disable max-len */
1
+
2
2
  const {
3
3
  authorizationHeaders
4
4
  } = require("./../endpoints_helpers.js");
@@ -75,6 +75,25 @@ const {
75
75
  * @property {boolean} [bypassValidations] - If true, bypass driver validations
76
76
  */
77
77
 
78
+ /**
79
+ * Query params for GET /manifests/item-capacity-over-limit (btrz-api-operations).
80
+ * @typedef {Object} ItemCapacityOverLimitQuery
81
+ * @property {string} itemId - Catalog item id (sourceItemId)
82
+ * @property {number|string} limit - Proposed Manifest Item Capacity Limit (>= 1)
83
+ * @property {number|string} [page] - Page number (>= 1)
84
+ */
85
+
86
+ /**
87
+ * Query params for GET /manifests/item-capacity-used (btrz-api-operations).
88
+ * @typedef {Object} ItemCapacityUsedQuery
89
+ * @property {string} routeId - Route id
90
+ * @property {string} scheduleId - Schedule id (manifest schedule key)
91
+ * @property {string} date - Travel date yyyy-mm-dd
92
+ * @property {string} fromId - Origin station id
93
+ * @property {string} toId - Destination station id
94
+ * @property {string} [itemIds] - Optional comma-separated catalog item ids
95
+ */
96
+
78
97
  /**
79
98
  * Factory for manifests API (btrz-api-operations).
80
99
  * @param {Object} deps
@@ -160,6 +179,42 @@ function manifestFactory({
160
179
  });
161
180
  }
162
181
 
182
+ /**
183
+ * GET /manifests/item-capacity-over-limit - future manifests over a proposed item capacity limit.
184
+ * @param {Object} opts
185
+ * @param {string} [opts.token] - API key
186
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
187
+ * @param {ItemCapacityOverLimitQuery} opts.query - itemId, limit, optional page
188
+ * @param {Object} [opts.headers] - Optional headers
189
+ * @returns {Promise<import("axios").AxiosResponse>}
190
+ */
191
+ function itemCapacityOverLimit({token, jwtToken, query = {}, headers}) {
192
+ return client({
193
+ url: "/manifests/item-capacity-over-limit",
194
+ method: "get",
195
+ params: query,
196
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
197
+ });
198
+ }
199
+
200
+ /**
201
+ * GET /manifests/item-capacity-used - path max qty used per attach-to-ticket item.
202
+ * @param {Object} opts
203
+ * @param {string} [opts.token] - API key
204
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
205
+ * @param {ItemCapacityUsedQuery} opts.query - routeId, scheduleId, date, fromId, toId, optional itemIds
206
+ * @param {Object} [opts.headers] - Optional headers
207
+ * @returns {Promise<import("axios").AxiosResponse>}
208
+ */
209
+ function itemCapacityUsed({token, jwtToken, query = {}, headers}) {
210
+ return client({
211
+ url: "/manifests/item-capacity-used",
212
+ method: "get",
213
+ params: query,
214
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
215
+ });
216
+ }
217
+
163
218
  /**
164
219
  * GET /manifests/:manifestId - get manifest by id. API does not accept query params.
165
220
  * @param {Object} opts
@@ -730,7 +785,7 @@ function manifestFactory({
730
785
  }
731
786
  };
732
787
 
733
- /**
788
+ /**
734
789
  * POST manifests/:manifestId/boarding/:stationId - board passengers at station.
735
790
  * @param {Object} opts
736
791
  * @param {string} [opts.token] - API key
@@ -741,16 +796,16 @@ function manifestFactory({
741
796
  * @param {Object} opts.data - Request body
742
797
  * @returns {Promise<import("axios").AxiosResponse>}
743
798
  */
744
- function stationBoarding({token, jwtToken, headers, manifestId, stationId, data, query}) {
745
- return client({
746
- url: `/manifests/${manifestId}/boarding/${stationId}`,
747
- method: "post",
748
- headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
749
- data,
750
- params: query
751
- });
752
- }
753
-
799
+ function stationBoarding({token, jwtToken, headers, manifestId, stationId, data, query}) {
800
+ return client({
801
+ url: `/manifests/${manifestId}/boarding/${stationId}`,
802
+ method: "post",
803
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
804
+ data,
805
+ params: query
806
+ });
807
+ }
808
+
754
809
  /**
755
810
  * POST manifests/:manifestId/dispatch/:stationId - dispatch manifest at station.
756
811
  * @param {Object} opts
@@ -762,17 +817,17 @@ function manifestFactory({
762
817
  * @param {Object} opts.data - Request body
763
818
  * @returns {Promise<import("axios").AxiosResponse>}
764
819
  */
765
- function stationDispatch({token, jwtToken, headers, manifestId, stationId, data, query}) {
766
- return client({
767
- url: `/manifests/${manifestId}/dispatch/${stationId}`,
768
- method: "post",
769
- headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
770
- data,
771
- params: query
772
- });
773
- }
820
+ function stationDispatch({token, jwtToken, headers, manifestId, stationId, data, query}) {
821
+ return client({
822
+ url: `/manifests/${manifestId}/dispatch/${stationId}`,
823
+ method: "post",
824
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
825
+ data,
826
+ params: query
827
+ });
828
+ }
774
829
 
775
- /**
830
+ /**
776
831
  * POST manifests/:manifestId/sales-closure/:stationId - close sales at station.
777
832
  * @param {Object} opts
778
833
  * @param {string} [opts.token] - API key
@@ -783,20 +838,22 @@ function manifestFactory({
783
838
  * @param {Object} opts.data - Request body
784
839
  * @returns {Promise<import("axios").AxiosResponse>}
785
840
  */
786
- function stationSalesClosure({token, jwtToken, headers, manifestId, stationId, data, query}) {
787
- return client({
788
- url: `/manifests/${manifestId}/sales-closure/${stationId}`,
789
- method: "post",
790
- headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
791
- data,
792
- params: query
793
- });
794
- }
841
+ function stationSalesClosure({token, jwtToken, headers, manifestId, stationId, data, query}) {
842
+ return client({
843
+ url: `/manifests/${manifestId}/sales-closure/${stationId}`,
844
+ method: "post",
845
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
846
+ data,
847
+ params: query
848
+ });
849
+ }
795
850
 
796
851
  return {
797
852
  get,
798
853
  getAll,
799
854
  getById,
855
+ itemCapacityOverLimit,
856
+ itemCapacityUsed,
800
857
  outlook,
801
858
  patch,
802
859
  save,
@@ -40,6 +40,41 @@ describe("operations/manifest", () => {
40
40
  });
41
41
  });
42
42
 
43
+ it("should get item capacity over limit manifests", async () => {
44
+ const query = {
45
+ itemId: "507f1f77bcf86cd799439011",
46
+ limit: 5,
47
+ page: 1
48
+ };
49
+ axiosMock.onGet("/manifests/item-capacity-over-limit").reply(expectRequest({
50
+ statusCode: 200, token, jwtToken
51
+ }));
52
+ const call = await api.operations.manifest.itemCapacityOverLimit({
53
+ token, jwtToken, query
54
+ });
55
+ assert.deepStrictEqual(call.config.params, query);
56
+ return call;
57
+ });
58
+
59
+ it("should get item capacity used on a path", async () => {
60
+ const query = {
61
+ routeId: "507f1f77bcf86cd799439011",
62
+ scheduleId: "5cab127c-2c70-4fea-9031-4131e2751cdb",
63
+ date: "2035-07-20",
64
+ fromId: "507f1f77bcf86cd799439012",
65
+ toId: "507f1f77bcf86cd799439013",
66
+ itemIds: "507f1f77bcf86cd799439014"
67
+ };
68
+ axiosMock.onGet("/manifests/item-capacity-used").reply(expectRequest({
69
+ statusCode: 200, token, jwtToken
70
+ }));
71
+ const call = await api.operations.manifest.itemCapacityUsed({
72
+ token, jwtToken, query
73
+ });
74
+ assert.deepStrictEqual(call.config.params, query);
75
+ return call;
76
+ });
77
+
43
78
  it("should get many manifests", () => {
44
79
  const data = {
45
80
  query: [{
@@ -1,7 +1,7 @@
1
1
  export = segmentInformationTableFactory;
2
2
  /**
3
3
  * @typedef {Object} SegmentsInformationTablesQuery
4
- * @property {string} [providerId] - Provider account ID
4
+ * @property {string} [providerId] - Provider account ID when route belongs to a provider in the requester's network
5
5
  */
6
6
  /**
7
7
  * Factory for segments-information-tables API (btrz-api-inventory).
@@ -23,7 +23,7 @@ declare namespace segmentInformationTableFactory {
23
23
  }
24
24
  type SegmentsInformationTablesQuery = {
25
25
  /**
26
- * - Provider account ID
26
+ * - Provider account ID when route belongs to a provider in the requester's network
27
27
  */
28
28
  providerId?: string;
29
29
  };