btrz-api-client 7.25.0 → 7.26.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,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- var _require = require("./../endpoints_helpers"),
3
+ var _require = require("./../endpoints_helpers.js"),
4
4
  authorizationHeaders = _require.authorizationHeaders;
5
5
 
6
6
  function schedulesFactory(_ref) {
@@ -117,13 +117,65 @@ function schedulesFactory(_ref) {
117
117
  }
118
118
  };
119
119
 
120
+ var exceptions = {
121
+ create: function create(_ref9) {
122
+ var token = _ref9.token,
123
+ jwtToken = _ref9.jwtToken,
124
+ data = _ref9.data,
125
+ scheduleId = _ref9.scheduleId,
126
+ headers = _ref9.headers;
127
+
128
+ return client({
129
+ url: "/schedules/" + scheduleId + "/schedule-exceptions",
130
+ method: "post",
131
+ headers: authorizationHeaders({
132
+ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
133
+ }),
134
+ data: data
135
+ });
136
+ },
137
+ delete: function _delete(_ref10) {
138
+ var token = _ref10.token,
139
+ jwtToken = _ref10.jwtToken,
140
+ scheduleId = _ref10.scheduleId,
141
+ exceptionId = _ref10.exceptionId,
142
+ headers = _ref10.headers;
143
+
144
+ return client({
145
+ url: "/schedules/" + scheduleId + "/schedule-exceptions/" + exceptionId,
146
+ method: "delete",
147
+ headers: authorizationHeaders({
148
+ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
149
+ })
150
+ });
151
+ },
152
+ update: function update(_ref11) {
153
+ var token = _ref11.token,
154
+ jwtToken = _ref11.jwtToken,
155
+ data = _ref11.data,
156
+ scheduleId = _ref11.scheduleId,
157
+ exceptionId = _ref11.exceptionId,
158
+ headers = _ref11.headers;
159
+
160
+ return client({
161
+ url: "/schedules/" + scheduleId + "/schedule-exceptions/" + exceptionId,
162
+ method: "put",
163
+ headers: authorizationHeaders({
164
+ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
165
+ }),
166
+ data: data
167
+ });
168
+ }
169
+ };
170
+
120
171
  return {
121
172
  all: all,
122
173
  get: get,
123
174
  create: create,
124
175
  update: update,
125
176
  delete: deleteSchedule,
126
- autoBouncing: autoBouncing
177
+ autoBouncing: autoBouncing,
178
+ exceptions: exceptions
127
179
  };
128
180
  }
129
181
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "7.25.0",
3
+ "version": "7.26.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- const {authorizationHeaders} = require("./../endpoints_helpers");
1
+ const {authorizationHeaders} = require("./../endpoints_helpers.js");
2
2
 
3
3
  function schedulesFactory({client, internalAuthTokenProvider}) {
4
4
  function all({token, query = {}, headers}) {
@@ -69,13 +69,46 @@ function schedulesFactory({client, internalAuthTokenProvider}) {
69
69
  }
70
70
  };
71
71
 
72
+ const exceptions = {
73
+ create: ({token, jwtToken, data, scheduleId, headers}) => {
74
+ return client({
75
+ url: `/schedules/${scheduleId}/schedule-exceptions`,
76
+ method: "post",
77
+ headers: authorizationHeaders({
78
+ token, jwtToken, internalAuthTokenProvider, headers
79
+ }),
80
+ data
81
+ });
82
+ },
83
+ delete: ({token, jwtToken, scheduleId, exceptionId, headers}) => {
84
+ return client({
85
+ url: `/schedules/${scheduleId}/schedule-exceptions/${exceptionId}`,
86
+ method: "delete",
87
+ headers: authorizationHeaders({
88
+ token, jwtToken, internalAuthTokenProvider, headers
89
+ })
90
+ });
91
+ },
92
+ update: ({token, jwtToken, data, scheduleId, exceptionId, headers}) => {
93
+ return client({
94
+ url: `/schedules/${scheduleId}/schedule-exceptions/${exceptionId}`,
95
+ method: "put",
96
+ headers: authorizationHeaders({
97
+ token, jwtToken, internalAuthTokenProvider, headers
98
+ }),
99
+ data
100
+ });
101
+ }
102
+ };
103
+
72
104
  return {
73
105
  all,
74
106
  get,
75
107
  create,
76
108
  update,
77
109
  delete: deleteSchedule,
78
- autoBouncing
110
+ autoBouncing,
111
+ exceptions
79
112
  };
80
113
  }
81
114
 
@@ -1,5 +1,5 @@
1
- const {axiosMock, expectRequest} = require("./../../test-helpers");
2
- const api = require("./../../../src/client").createApiClient({baseURL: "http://test.com"});
1
+ const {axiosMock, expectRequest} = require("./../../test-helpers.js");
2
+ const api = require("./../../../src/client.js").createApiClient({baseURL: "http://test.com"});
3
3
 
4
4
  describe("inventory/routes/shedules", () => {
5
5
  const token = "I owe you a token";
@@ -64,7 +64,7 @@ describe("inventory/routes/shedules", () => {
64
64
  });
65
65
 
66
66
  it("should add auto bouncing data to the schedules", () => {
67
- axiosMock.onPost(`/routes/schedules/auto-bouncing`).reply(expectRequest({
67
+ axiosMock.onPost("/routes/schedules/auto-bouncing").reply(expectRequest({
68
68
  statusCode: 200, token, jwtToken
69
69
  }));
70
70
  return api.inventory.schedules.autoBouncing.create({token, jwtToken, data});
@@ -74,4 +74,25 @@ describe("inventory/routes/shedules", () => {
74
74
  axiosMock.onDelete(`/routes/${routeId}/schedules/${scheduleId}/auto-bouncing`).reply(expectRequest({statusCode: 200, token, jwtToken}));
75
75
  return api.inventory.schedules.autoBouncing.delete({token, jwtToken, routeId, parentScheduleId: scheduleId});
76
76
  });
77
+
78
+ it("should create a schedule exception", () => {
79
+ axiosMock.onPost(`/schedules/${scheduleId}/schedule-exceptions`).reply(expectRequest({
80
+ statusCode: 200, token, jwtToken
81
+ }));
82
+ return api.inventory.schedules.exceptions.create({token, jwtToken, data, scheduleId});
83
+ });
84
+
85
+ it("should delete a schedule exception", async () => {
86
+ const exceptionId = "exception123";
87
+ axiosMock.onDelete(`/schedules/${scheduleId}/schedule-exceptions/${exceptionId}`)
88
+ .reply(expectRequest({statusCode: 200, token, jwtToken}));
89
+ return api.inventory.schedules.exceptions.delete({token, jwtToken, scheduleId, exceptionId});
90
+ });
91
+
92
+ it("should update a schedule exception", async () => {
93
+ const exceptionId = "exception123";
94
+ axiosMock.onPut(`/schedules/${scheduleId}/schedule-exceptions/${exceptionId}`)
95
+ .reply(expectRequest({statusCode: 200, token, jwtToken}));
96
+ return api.inventory.schedules.exceptions.update({token, jwtToken, data, scheduleId, exceptionId});
97
+ });
77
98
  });
package/types/client.d.ts CHANGED
@@ -1432,6 +1432,30 @@ export function createApiClient(options: {
1432
1432
  headers: any;
1433
1433
  }) => any;
1434
1434
  };
1435
+ exceptions: {
1436
+ create: ({ token, jwtToken, data, scheduleId, headers }: {
1437
+ token: any;
1438
+ jwtToken: any;
1439
+ data: any;
1440
+ scheduleId: any;
1441
+ headers: any;
1442
+ }) => any;
1443
+ delete: ({ token, jwtToken, scheduleId, exceptionId, headers }: {
1444
+ token: any;
1445
+ jwtToken: any;
1446
+ scheduleId: any;
1447
+ exceptionId: any;
1448
+ headers: any;
1449
+ }) => any;
1450
+ update: ({ token, jwtToken, data, scheduleId, exceptionId, headers }: {
1451
+ token: any;
1452
+ jwtToken: any;
1453
+ data: any;
1454
+ scheduleId: any;
1455
+ exceptionId: any;
1456
+ headers: any;
1457
+ }) => any;
1458
+ };
1435
1459
  };
1436
1460
  seatClasses: {
1437
1461
  all: ({ token, jwtToken, query, headers }: {
@@ -52,4 +52,28 @@ declare function schedulesFactory({ client, internalAuthTokenProvider }: {
52
52
  headers: any;
53
53
  }) => any;
54
54
  };
55
+ exceptions: {
56
+ create: ({ token, jwtToken, data, scheduleId, headers }: {
57
+ token: any;
58
+ jwtToken: any;
59
+ data: any;
60
+ scheduleId: any;
61
+ headers: any;
62
+ }) => any;
63
+ delete: ({ token, jwtToken, scheduleId, exceptionId, headers }: {
64
+ token: any;
65
+ jwtToken: any;
66
+ scheduleId: any;
67
+ exceptionId: any;
68
+ headers: any;
69
+ }) => any;
70
+ update: ({ token, jwtToken, data, scheduleId, exceptionId, headers }: {
71
+ token: any;
72
+ jwtToken: any;
73
+ data: any;
74
+ scheduleId: any;
75
+ exceptionId: any;
76
+ headers: any;
77
+ }) => any;
78
+ };
55
79
  };
@@ -1386,6 +1386,30 @@ declare const _exports: {
1386
1386
  headers: any;
1387
1387
  }) => any;
1388
1388
  };
1389
+ exceptions: {
1390
+ create: ({ token, jwtToken, data, scheduleId, headers }: {
1391
+ token: any;
1392
+ jwtToken: any;
1393
+ data: any;
1394
+ scheduleId: any;
1395
+ headers: any;
1396
+ }) => any;
1397
+ delete: ({ token, jwtToken, scheduleId, exceptionId, headers }: {
1398
+ token: any;
1399
+ jwtToken: any;
1400
+ scheduleId: any;
1401
+ exceptionId: any;
1402
+ headers: any;
1403
+ }) => any;
1404
+ update: ({ token, jwtToken, data, scheduleId, exceptionId, headers }: {
1405
+ token: any;
1406
+ jwtToken: any;
1407
+ data: any;
1408
+ scheduleId: any;
1409
+ exceptionId: any;
1410
+ headers: any;
1411
+ }) => any;
1412
+ };
1389
1413
  };
1390
1414
  seatClasses: {
1391
1415
  all: ({ token, jwtToken, query, headers }: {