btrz-api-client 8.20.0 → 8.21.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.
@@ -69,6 +69,40 @@ function networkFactory(_ref) {
69
69
  agency: agency
70
70
  }
71
71
  });
72
+ },
73
+ removeProduct: function removeProduct(_ref6) {
74
+ var token = _ref6.token,
75
+ jwtToken = _ref6.jwtToken,
76
+ productId = _ref6.productId,
77
+ headers = _ref6.headers;
78
+
79
+ return client({
80
+ url: "/network/agencies/remove-product",
81
+ method: "put",
82
+ headers: authorizationHeaders({
83
+ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
84
+ }),
85
+ data: {
86
+ productId: productId
87
+ }
88
+ });
89
+ },
90
+ removeFare: function removeFare(_ref7) {
91
+ var token = _ref7.token,
92
+ jwtToken = _ref7.jwtToken,
93
+ fareId = _ref7.fareId,
94
+ headers = _ref7.headers;
95
+
96
+ return client({
97
+ url: "/network/agencies/remove-fare",
98
+ method: "put",
99
+ headers: authorizationHeaders({
100
+ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers
101
+ }),
102
+ data: {
103
+ fareId: fareId
104
+ }
105
+ });
72
106
  }
73
107
  };
74
108
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "8.20.0",
3
+ "version": "8.21.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,45 +4,69 @@ const {
4
4
 
5
5
  function networkFactory({client, internalAuthTokenProvider}) {
6
6
  const agencies = {
7
- all({token, jwtToken, query = {}, headers}) {
8
- return client({
9
- url: "/network/agencies",
10
- params: query,
11
- headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
12
- });
13
- },
14
- get({token, query, headers, sellerId}) {
15
- return client({
16
- url: `/network/agencies/${sellerId}`,
17
- params: query,
18
- headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
19
- });
20
- },
21
- update({jwtToken, token, sellerId, agency, headers, query}) {
22
- return client({
23
- url: `/network/agencies/${sellerId}`,
24
- method: "put",
25
- headers: authorizationHeaders({
26
- token, jwtToken, internalAuthTokenProvider, headers
27
- }),
28
- data: {
29
- agency
30
- },
31
- params: query
32
- });
33
- },
34
- create({jwtToken, token, agency, headers}) {
35
- return client({
36
- url: "/network/agencies",
37
- method: "post",
38
- headers: authorizationHeaders({
39
- token, jwtToken, internalAuthTokenProvider, headers
40
- }),
41
- data: {
42
- agency
43
- }
44
- });
45
- }
7
+ all({token, jwtToken, query = {}, headers}) {
8
+ return client({
9
+ url: "/network/agencies",
10
+ params: query,
11
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
12
+ });
13
+ },
14
+ get({token, query, headers, sellerId}) {
15
+ return client({
16
+ url: `/network/agencies/${sellerId}`,
17
+ params: query,
18
+ headers: authorizationHeaders({token, internalAuthTokenProvider, headers})
19
+ });
20
+ },
21
+ update({jwtToken, token, sellerId, agency, headers, query}) {
22
+ return client({
23
+ url: `/network/agencies/${sellerId}`,
24
+ method: "put",
25
+ headers: authorizationHeaders({
26
+ token, jwtToken, internalAuthTokenProvider, headers
27
+ }),
28
+ data: {
29
+ agency
30
+ },
31
+ params: query
32
+ });
33
+ },
34
+ create({jwtToken, token, agency, headers}) {
35
+ return client({
36
+ url: "/network/agencies",
37
+ method: "post",
38
+ headers: authorizationHeaders({
39
+ token, jwtToken, internalAuthTokenProvider, headers
40
+ }),
41
+ data: {
42
+ agency
43
+ }
44
+ });
45
+ },
46
+ removeProduct({token, jwtToken, productId, headers}) {
47
+ return client({
48
+ url: "/network/agencies/remove-product",
49
+ method: "put",
50
+ headers: authorizationHeaders({
51
+ token, jwtToken, internalAuthTokenProvider, headers
52
+ }),
53
+ data: {
54
+ productId
55
+ }
56
+ });
57
+ },
58
+ removeFare({token, jwtToken, fareId, headers}) {
59
+ return client({
60
+ url: "/network/agencies/remove-fare",
61
+ method: "put",
62
+ headers: authorizationHeaders({
63
+ token, jwtToken, internalAuthTokenProvider, headers
64
+ }),
65
+ data: {
66
+ fareId
67
+ }
68
+ });
69
+ }
46
70
  };
47
71
 
48
72
  return {
@@ -50,4 +74,4 @@ function networkFactory({client, internalAuthTokenProvider}) {
50
74
  };
51
75
  }
52
76
 
53
- module.exports = networkFactory;
77
+ module.exports = networkFactory;
@@ -80,4 +80,27 @@ describe("accounts/interline", () => {
80
80
  });
81
81
  });
82
82
 
83
+ it("should remove a product from all agencies", () => {
84
+ const productId = "productId";
85
+ axiosMock.onPut("/network/agencies/remove-product").reply(expectRequest({
86
+ statusCode: 200,
87
+ token,
88
+ jwtToken
89
+ }));
90
+ return api.accounts.network.agencies.removeProduct({
91
+ token, jwtToken, productId
92
+ });
93
+ });
94
+
95
+ it("should remove a fare from all agencies", () => {
96
+ const fareId = "fareId";
97
+ axiosMock.onPut("/network/agencies/remove-fare").reply(expectRequest({
98
+ statusCode: 200,
99
+ token,
100
+ jwtToken
101
+ }));
102
+ return api.accounts.network.agencies.removeFare({
103
+ token, jwtToken, fareId
104
+ });
105
+ });
83
106
  });
package/types/client.d.ts CHANGED
@@ -2727,6 +2727,18 @@ export function createApiClient(options: {
2727
2727
  agency: any;
2728
2728
  headers: any;
2729
2729
  }): any;
2730
+ removeProduct({ token, jwtToken, productId, headers }: {
2731
+ token: any;
2732
+ jwtToken: any;
2733
+ productId: any;
2734
+ headers: any;
2735
+ }): any;
2736
+ removeFare({ token, jwtToken, fareId, headers }: {
2737
+ token: any;
2738
+ jwtToken: any;
2739
+ fareId: any;
2740
+ headers: any;
2741
+ }): any;
2730
2742
  };
2731
2743
  };
2732
2744
  operationSettings: {
@@ -30,5 +30,17 @@ declare function networkFactory({ client, internalAuthTokenProvider }: {
30
30
  agency: any;
31
31
  headers: any;
32
32
  }): any;
33
+ removeProduct({ token, jwtToken, productId, headers }: {
34
+ token: any;
35
+ jwtToken: any;
36
+ productId: any;
37
+ headers: any;
38
+ }): any;
39
+ removeFare({ token, jwtToken, fareId, headers }: {
40
+ token: any;
41
+ jwtToken: any;
42
+ fareId: any;
43
+ headers: any;
44
+ }): any;
33
45
  };
34
46
  };
@@ -2681,6 +2681,18 @@ declare const _exports: {
2681
2681
  agency: any;
2682
2682
  headers: any;
2683
2683
  }): any;
2684
+ removeProduct({ token, jwtToken, productId, headers }: {
2685
+ token: any;
2686
+ jwtToken: any;
2687
+ productId: any;
2688
+ headers: any;
2689
+ }): any;
2690
+ removeFare({ token, jwtToken, fareId, headers }: {
2691
+ token: any;
2692
+ jwtToken: any;
2693
+ fareId: any;
2694
+ headers: any;
2695
+ }): any;
2684
2696
  };
2685
2697
  };
2686
2698
  operationSettings: {