btrz-api-client 9.7.0 → 9.8.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.
@@ -1028,6 +1028,108 @@ function manifestFactory({
1028
1028
  });
1029
1029
  }
1030
1030
  };
1031
+
1032
+ /**
1033
+ * POST manifests/:manifestId/boarding/:stationId - board passengers at station.
1034
+ * @param {Object} opts
1035
+ * @param {string} [opts.token] - API key
1036
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
1037
+ * @param {Object} [opts.headers] - Optional headers
1038
+ * @param {string} opts.manifestId - Manifest id
1039
+ * @param {string} opts.stationId - Station id
1040
+ * @param {Object} opts.data - Request body
1041
+ * @returns {Promise<import("axios").AxiosResponse>}
1042
+ */
1043
+ function stationBoarding({
1044
+ token,
1045
+ jwtToken,
1046
+ headers,
1047
+ manifestId,
1048
+ stationId,
1049
+ data,
1050
+ query
1051
+ }) {
1052
+ return client({
1053
+ url: `/manifests/${manifestId}/boarding/${stationId}`,
1054
+ method: "post",
1055
+ headers: authorizationHeaders({
1056
+ token,
1057
+ jwtToken,
1058
+ internalAuthTokenProvider,
1059
+ headers
1060
+ }),
1061
+ data,
1062
+ params: query
1063
+ });
1064
+ }
1065
+
1066
+ /**
1067
+ * POST manifests/:manifestId/dispatch/:stationId - dispatch manifest at station.
1068
+ * @param {Object} opts
1069
+ * @param {string} [opts.token] - API key
1070
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
1071
+ * @param {Object} [opts.headers] - Optional headers
1072
+ * @param {string} opts.manifestId - Manifest id
1073
+ * @param {string} opts.stationId - Station id
1074
+ * @param {Object} opts.data - Request body
1075
+ * @returns {Promise<import("axios").AxiosResponse>}
1076
+ */
1077
+ function stationDispatch({
1078
+ token,
1079
+ jwtToken,
1080
+ headers,
1081
+ manifestId,
1082
+ stationId,
1083
+ data,
1084
+ query
1085
+ }) {
1086
+ return client({
1087
+ url: `/manifests/${manifestId}/dispatch/${stationId}`,
1088
+ method: "post",
1089
+ headers: authorizationHeaders({
1090
+ token,
1091
+ jwtToken,
1092
+ internalAuthTokenProvider,
1093
+ headers
1094
+ }),
1095
+ data,
1096
+ params: query
1097
+ });
1098
+ }
1099
+
1100
+ /**
1101
+ * POST manifests/:manifestId/sales-closure/:stationId - close sales at station.
1102
+ * @param {Object} opts
1103
+ * @param {string} [opts.token] - API key
1104
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
1105
+ * @param {Object} [opts.headers] - Optional headers
1106
+ * @param {string} opts.manifestId - Manifest id
1107
+ * @param {string} opts.stationId - Station id
1108
+ * @param {Object} opts.data - Request body
1109
+ * @returns {Promise<import("axios").AxiosResponse>}
1110
+ */
1111
+ function stationSalesClosure({
1112
+ token,
1113
+ jwtToken,
1114
+ headers,
1115
+ manifestId,
1116
+ stationId,
1117
+ data,
1118
+ query
1119
+ }) {
1120
+ return client({
1121
+ url: `/manifests/${manifestId}/sales-closure/${stationId}`,
1122
+ method: "post",
1123
+ headers: authorizationHeaders({
1124
+ token,
1125
+ jwtToken,
1126
+ internalAuthTokenProvider,
1127
+ headers
1128
+ }),
1129
+ data,
1130
+ params: query
1131
+ });
1132
+ }
1031
1133
  return {
1032
1134
  get,
1033
1135
  getAll,
@@ -1052,7 +1154,10 @@ function manifestFactory({
1052
1154
  reports,
1053
1155
  labels,
1054
1156
  driverRelays,
1055
- tripClose
1157
+ tripClose,
1158
+ stationBoarding,
1159
+ stationDispatch,
1160
+ stationSalesClosure
1056
1161
  };
1057
1162
  }
1058
1163
  module.exports = manifestFactory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "9.7.0",
3
+ "version": "9.8.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -730,6 +730,69 @@ function manifestFactory({
730
730
  }
731
731
  };
732
732
 
733
+ /**
734
+ * POST manifests/:manifestId/boarding/:stationId - board passengers at station.
735
+ * @param {Object} opts
736
+ * @param {string} [opts.token] - API key
737
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
738
+ * @param {Object} [opts.headers] - Optional headers
739
+ * @param {string} opts.manifestId - Manifest id
740
+ * @param {string} opts.stationId - Station id
741
+ * @param {Object} opts.data - Request body
742
+ * @returns {Promise<import("axios").AxiosResponse>}
743
+ */
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
+
754
+ /**
755
+ * POST manifests/:manifestId/dispatch/:stationId - dispatch manifest at station.
756
+ * @param {Object} opts
757
+ * @param {string} [opts.token] - API key
758
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
759
+ * @param {Object} [opts.headers] - Optional headers
760
+ * @param {string} opts.manifestId - Manifest id
761
+ * @param {string} opts.stationId - Station id
762
+ * @param {Object} opts.data - Request body
763
+ * @returns {Promise<import("axios").AxiosResponse>}
764
+ */
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
+ }
774
+
775
+ /**
776
+ * POST manifests/:manifestId/sales-closure/:stationId - close sales at station.
777
+ * @param {Object} opts
778
+ * @param {string} [opts.token] - API key
779
+ * @param {string} [opts.jwtToken] - JWT or internal auth symbol
780
+ * @param {Object} [opts.headers] - Optional headers
781
+ * @param {string} opts.manifestId - Manifest id
782
+ * @param {string} opts.stationId - Station id
783
+ * @param {Object} opts.data - Request body
784
+ * @returns {Promise<import("axios").AxiosResponse>}
785
+ */
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
+ }
795
+
733
796
  return {
734
797
  get,
735
798
  getAll,
@@ -754,7 +817,10 @@ function manifestFactory({
754
817
  reports,
755
818
  labels,
756
819
  driverRelays,
757
- tripClose
820
+ tripClose,
821
+ stationBoarding,
822
+ stationDispatch,
823
+ stationSalesClosure
758
824
  };
759
825
  }
760
826
 
@@ -406,3 +406,83 @@ describe("operations/manifests/:manifestKey/manifests-exceptions", () => {
406
406
  return api.operations.manifest.manifestsExceptions.update({token, jwtToken, manifestKey, manifestException});
407
407
  });
408
408
  });
409
+
410
+ describe("operations/manifests/:manifestId/station operations", () => {
411
+ const token = "I owe you a token";
412
+ const jwtToken = "I owe you a JWT token";
413
+
414
+ afterEach(() => {
415
+ axiosMock.reset();
416
+ });
417
+
418
+ it("should board passengers at station", async () => {
419
+ const manifestId = "manifestId";
420
+ const stationId = "stationId";
421
+ const data = {
422
+ user: {
423
+ firstName: "Test",
424
+ lastName: "Testing",
425
+ email: "test@betterez.com"
426
+ }
427
+ };
428
+ const query = {bypassValidations: false};
429
+
430
+ axiosMock.onPost(`/manifests/${manifestId}/boarding/${stationId}`).reply(expectRequest({
431
+ statusCode: 200, token, jwtToken
432
+ }));
433
+ const call = await api.operations.manifest.stationBoarding({
434
+ token, jwtToken, manifestId, stationId, data, query
435
+ });
436
+ assert.deepStrictEqual(JSON.parse(call.config.data), data);
437
+ assert.deepStrictEqual(call.config.params, query);
438
+ return call;
439
+ });
440
+
441
+ it("should dispatch manifest at station", async () => {
442
+ const manifestId = "manifestId";
443
+ const stationId = "stationId";
444
+ const data = {
445
+ user: {
446
+ firstName: "Test",
447
+ lastName: "Testing",
448
+ email: "Test@betterez.com",
449
+ shiftId: "649f20a95679910784326e81",
450
+ shiftNumber: "S-WTN6LDX"
451
+ }
452
+ };
453
+ const query = {bypassValidations: false};
454
+
455
+ axiosMock.onPost(`/manifests/${manifestId}/dispatch/${stationId}`).reply(expectRequest({
456
+ statusCode: 200, token, jwtToken
457
+ }));
458
+ const call = await api.operations.manifest.stationDispatch({
459
+ token, jwtToken, manifestId, stationId, data, query
460
+ });
461
+ assert.deepStrictEqual(JSON.parse(call.config.data), data);
462
+ assert.deepStrictEqual(call.config.params, query);
463
+ return call;
464
+ });
465
+
466
+ it("should close sales at station", async () => {
467
+ const manifestId = "manifestId";
468
+ const stationId = "stationId";
469
+ const data = {
470
+ user: {
471
+ firstName: "Test",
472
+ lastName: "Testing",
473
+ email: "Test@betterez.com"
474
+ }
475
+ };
476
+ const query = {bypassValidations: false};
477
+
478
+ axiosMock.onPost(`/manifests/${manifestId}/sales-closure/${stationId}`).reply(expectRequest({
479
+ statusCode: 200, token, jwtToken
480
+ }));
481
+ const call = await api.operations.manifest.stationSalesClosure({
482
+ token, jwtToken, manifestId, stationId, data, query
483
+ });
484
+ assert.deepStrictEqual(JSON.parse(call.config.data), data);
485
+ assert.deepStrictEqual(call.config.params, query);
486
+ return call;
487
+ });
488
+ });