btrz-api-client 7.8.0 → 7.10.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.
@@ -24,9 +24,12 @@ function controlClassesFactory(_ref) {
24
24
  var controlClassId = _ref3.controlClassId,
25
25
  token = _ref3.token,
26
26
  headers = _ref3.headers,
27
- jwtToken = _ref3.jwtToken;
27
+ jwtToken = _ref3.jwtToken,
28
+ _ref3$query = _ref3.query,
29
+ query = _ref3$query === undefined ? {} : _ref3$query;
28
30
 
29
31
  return client.get("/control-classes/" + controlClassId, {
32
+ params: query,
30
33
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
31
34
  });
32
35
  }
@@ -30,8 +30,28 @@ function vouchersFactory(_ref) {
30
30
  });
31
31
  }
32
32
 
33
+ function compensationsCreate(_ref3) {
34
+ var token = _ref3.token,
35
+ jwtToken = _ref3.jwtToken,
36
+ compensation = _ref3.compensation,
37
+ _ref3$query = _ref3.query,
38
+ query = _ref3$query === undefined ? {} : _ref3$query,
39
+ headers = _ref3.headers;
40
+
41
+ return client({
42
+ url: "/vouchers/compensations",
43
+ method: "post",
44
+ params: query,
45
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
46
+ data: compensation
47
+ });
48
+ }
49
+
33
50
  return {
34
- create: create
51
+ create: create,
52
+ compensations: {
53
+ create: compensationsCreate
54
+ }
35
55
  };
36
56
  }
37
57
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "7.8.0",
3
+ "version": "7.10.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,8 +15,9 @@ function controlClassesFactory({client, internalAuthTokenProvider}) {
15
15
  });
16
16
  }
17
17
 
18
- function get({controlClassId, token, headers, jwtToken}) {
18
+ function get({controlClassId, token, headers, jwtToken, query = {}}) {
19
19
  return client.get(`/control-classes/${controlClassId}`, {
20
+ params: query,
20
21
  headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
21
22
  });
22
23
  }
@@ -22,8 +22,21 @@ function vouchersFactory({
22
22
  });
23
23
  }
24
24
 
25
+ function compensationsCreate({token, jwtToken, compensation, query = {}, headers}) {
26
+ return client({
27
+ url: "/vouchers/compensations",
28
+ method: "post",
29
+ params: query,
30
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
31
+ data: compensation
32
+ });
33
+ }
34
+
25
35
  return {
26
- create
36
+ create,
37
+ compensations: {
38
+ create: compensationsCreate
39
+ }
27
40
  };
28
41
  }
29
42
 
@@ -27,3 +27,29 @@ describe("operations/vouchers", () => {
27
27
  return api.operations.vouchers.create({jwtToken, token, voucher});
28
28
  });
29
29
  });
30
+
31
+ describe("operations/vouchers/compensations", () => {
32
+ const token = "I owe you a token";
33
+ const jwtToken = "I owe you a JWT token";
34
+
35
+ afterEach(() => {
36
+ axiosMock.reset();
37
+ });
38
+
39
+ it("should POST a compensation", () => {
40
+ const compensation = {
41
+ voucherInfo: {
42
+ type: "voucher",
43
+ amount: "100",
44
+ typeAmount: "%"
45
+ },
46
+ ticketIds: []
47
+ };
48
+
49
+ axiosMock
50
+ .onPost("/vouchers/compensations")
51
+ .reply(expectRequest({statusCode: 200, token, jwtToken}));
52
+
53
+ return api.operations.vouchers.compensations.create({jwtToken, token, compensation});
54
+ });
55
+ });
package/types/client.d.ts CHANGED
@@ -273,11 +273,12 @@ export function createApiClient(options: {
273
273
  query?: {};
274
274
  headers: any;
275
275
  }) => any;
276
- get: ({ controlClassId, token, headers, jwtToken }: {
276
+ get: ({ controlClassId, token, headers, jwtToken, query }: {
277
277
  controlClassId: any;
278
278
  token: any;
279
279
  headers: any;
280
280
  jwtToken: any;
281
+ query?: {};
281
282
  }) => any;
282
283
  create: ({ jwtToken, token, controlClass, headers }: {
283
284
  jwtToken: any;
@@ -3947,6 +3948,15 @@ export function createApiClient(options: {
3947
3948
  query?: {};
3948
3949
  voucher?: {};
3949
3950
  }) => any;
3951
+ compensations: {
3952
+ create: ({ token, jwtToken, compensation, query, headers }: {
3953
+ token: any;
3954
+ jwtToken: any;
3955
+ compensation: any;
3956
+ query?: {};
3957
+ headers: any;
3958
+ }) => any;
3959
+ };
3950
3960
  };
3951
3961
  waitlists: {
3952
3962
  all: ({ token, jwtToken, query, headers }: {
@@ -9,11 +9,12 @@ declare function controlClassesFactory({ client, internalAuthTokenProvider }: {
9
9
  query?: {};
10
10
  headers: any;
11
11
  }) => any;
12
- get: ({ controlClassId, token, headers, jwtToken }: {
12
+ get: ({ controlClassId, token, headers, jwtToken, query }: {
13
13
  controlClassId: any;
14
14
  token: any;
15
15
  headers: any;
16
16
  jwtToken: any;
17
+ query?: {};
17
18
  }) => any;
18
19
  create: ({ jwtToken, token, controlClass, headers }: {
19
20
  jwtToken: any;
@@ -10,4 +10,13 @@ declare function vouchersFactory({ client, internalAuthTokenProvider }: {
10
10
  query?: {};
11
11
  voucher?: {};
12
12
  }) => any;
13
+ compensations: {
14
+ create: ({ token, jwtToken, compensation, query, headers }: {
15
+ token: any;
16
+ jwtToken: any;
17
+ compensation: any;
18
+ query?: {};
19
+ headers: any;
20
+ }) => any;
21
+ };
13
22
  };
@@ -227,11 +227,12 @@ declare const _exports: {
227
227
  query?: {};
228
228
  headers: any;
229
229
  }) => any;
230
- get: ({ controlClassId, token, headers, jwtToken }: {
230
+ get: ({ controlClassId, token, headers, jwtToken, query }: {
231
231
  controlClassId: any;
232
232
  token: any;
233
233
  headers: any;
234
234
  jwtToken: any;
235
+ query?: {};
235
236
  }) => any;
236
237
  create: ({ jwtToken, token, controlClass, headers }: {
237
238
  jwtToken: any;
@@ -3901,6 +3902,15 @@ declare const _exports: {
3901
3902
  query?: {};
3902
3903
  voucher?: {};
3903
3904
  }) => any;
3905
+ compensations: {
3906
+ create: ({ token, jwtToken, compensation, query, headers }: {
3907
+ token: any;
3908
+ jwtToken: any;
3909
+ compensation: any;
3910
+ query?: {};
3911
+ headers: any;
3912
+ }) => any;
3913
+ };
3904
3914
  };
3905
3915
  waitlists: {
3906
3916
  all: ({ token, jwtToken, query, headers }: {