btrz-api-client 5.221.0 → 5.223.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.
@@ -35,12 +35,41 @@ function productsFactory(_ref) {
35
35
  });
36
36
  }
37
37
 
38
+ function create(_ref4) {
39
+ var data = _ref4.data,
40
+ token = _ref4.token,
41
+ jwtToken = _ref4.jwtToken,
42
+ headers = _ref4.headers;
43
+
44
+ return client({
45
+ url: "/products",
46
+ method: "post",
47
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
48
+ data: data
49
+ });
50
+ }
51
+
52
+ function update(_ref5) {
53
+ var productId = _ref5.productId,
54
+ data = _ref5.data,
55
+ token = _ref5.token,
56
+ jwtToken = _ref5.jwtToken,
57
+ headers = _ref5.headers;
58
+
59
+ return client({
60
+ url: "/products/" + productId,
61
+ method: "put",
62
+ headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers }),
63
+ data: data
64
+ });
65
+ }
66
+
38
67
  var domains = {
39
- remove: function remove(_ref4) {
40
- var token = _ref4.token,
41
- jwtToken = _ref4.jwtToken,
42
- domain = _ref4.domain,
43
- headers = _ref4.headers;
68
+ remove: function remove(_ref6) {
69
+ var token = _ref6.token,
70
+ jwtToken = _ref6.jwtToken,
71
+ domain = _ref6.domain,
72
+ headers = _ref6.headers;
44
73
 
45
74
  return client({
46
75
  url: "/products/domains/" + domain,
@@ -51,11 +80,11 @@ function productsFactory(_ref) {
51
80
  };
52
81
 
53
82
  var families = {
54
- all: function all(_ref5) {
55
- var token = _ref5.token,
56
- _ref5$query = _ref5.query,
57
- query = _ref5$query === undefined ? {} : _ref5$query,
58
- headers = _ref5.headers;
83
+ all: function all(_ref7) {
84
+ var token = _ref7.token,
85
+ _ref7$query = _ref7.query,
86
+ query = _ref7$query === undefined ? {} : _ref7$query,
87
+ headers = _ref7.headers;
59
88
 
60
89
  return client({
61
90
  url: "/products/families",
@@ -68,6 +97,8 @@ function productsFactory(_ref) {
68
97
  return {
69
98
  all: all,
70
99
  get: get,
100
+ create: create,
101
+ update: update,
71
102
  families: families,
72
103
  domains: domains
73
104
  };
@@ -185,11 +185,14 @@ function cartFactory(_ref) {
185
185
  var token = _ref13.token,
186
186
  jwtToken = _ref13.jwtToken,
187
187
  headers = _ref13.headers,
188
- cartId = _ref13.cartId;
188
+ cartId = _ref13.cartId,
189
+ _ref13$query = _ref13.query,
190
+ query = _ref13$query === undefined ? {} : _ref13$query;
189
191
 
190
192
  return client({
191
193
  url: "/carts/" + cartId + "/financing-costs",
192
194
  method: "delete",
195
+ params: query,
193
196
  headers: authorizationHeaders({ token: token, jwtToken: jwtToken, internalAuthTokenProvider: internalAuthTokenProvider, headers: headers })
194
197
  });
195
198
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "btrz-api-client",
3
- "version": "5.221.0",
3
+ "version": "5.223.0",
4
4
  "description": "Api client for Betterez endpoints",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,6 +17,24 @@ function productsFactory({client, internalAuthTokenProvider}) {
17
17
  });
18
18
  }
19
19
 
20
+ function create({data, token, jwtToken, headers}) {
21
+ return client({
22
+ url: "/products",
23
+ method: "post",
24
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
25
+ data
26
+ });
27
+ }
28
+
29
+ function update({productId, data, token, jwtToken, headers}) {
30
+ return client({
31
+ url: `/products/${productId}`,
32
+ method: "put",
33
+ headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers}),
34
+ data
35
+ });
36
+ }
37
+
20
38
  const domains = {
21
39
  remove: ({token, jwtToken, domain, headers}) =>{
22
40
  return client({
@@ -40,6 +58,8 @@ function productsFactory({client, internalAuthTokenProvider}) {
40
58
  return {
41
59
  all,
42
60
  get,
61
+ create,
62
+ update,
43
63
  families,
44
64
  domains
45
65
  };
@@ -110,10 +110,11 @@ function cartFactory({client, internalAuthTokenProvider}) {
110
110
  }
111
111
  });
112
112
  },
113
- delete({token, jwtToken, headers, cartId}) {
113
+ delete({token, jwtToken, headers, cartId, query = {}}) {
114
114
  return client({
115
115
  url: `/carts/${cartId}/financing-costs`,
116
116
  method: "delete",
117
+ params: query,
117
118
  headers: authorizationHeaders({token, jwtToken, internalAuthTokenProvider, headers})
118
119
  });
119
120
  }
@@ -4,10 +4,10 @@ const api = require("./../../../src/client").createApiClient({ baseURL: "http://
4
4
  describe('inventory/products', function() {
5
5
  const token = 'I owe you a token';
6
6
  const jwtToken = 'I owe you a JWT token';
7
-
7
+
8
8
  afterEach(function() {
9
9
  axiosMock.reset();
10
- })
10
+ });
11
11
 
12
12
  it("should list products", function() {
13
13
  axiosMock.onGet(`/products`).reply(expectRequest({ statusCode: 200, token }));
@@ -29,6 +29,19 @@ describe('inventory/products', function() {
29
29
  return api.inventory.products.families.all({ token });
30
30
  });
31
31
 
32
+ it("should create a product", function() {
33
+ const data = {name: "Test Product"};
34
+ axiosMock.onPost("/products").reply(expectRequest({statusCode: 200, token, jwtToken}));
35
+ return api.inventory.products.create({token, jwtToken, data});
36
+ });
37
+
38
+ it("should update a product", function() {
39
+ const data = {name: "Test Product"};
40
+ const productId = 1;
41
+ axiosMock.onPut(`/products/${productId}`).reply(expectRequest({statusCode: 200, token, jwtToken}));
42
+ return api.inventory.products.update({token, jwtToken, productId, data});
43
+ });
44
+
32
45
  it("should delete domain for all products from account", () => {
33
46
  const domain = "domain1";
34
47
  axiosMock.onDelete(`/products/domains/${domain}`).reply(expectRequest({
@@ -44,4 +57,4 @@ describe('inventory/products', function() {
44
57
  });
45
58
  });
46
59
 
47
- });
60
+ });
package/types/client.d.ts CHANGED
@@ -124,6 +124,19 @@ export function createApiClient(options: {
124
124
  query?: {};
125
125
  headers: any;
126
126
  }) => any;
127
+ create: ({ data, token, jwtToken, headers }: {
128
+ data: any;
129
+ token: any;
130
+ jwtToken: any;
131
+ headers: any;
132
+ }) => any;
133
+ update: ({ productId, data, token, jwtToken, headers }: {
134
+ productId: any;
135
+ data: any;
136
+ token: any;
137
+ jwtToken: any;
138
+ headers: any;
139
+ }) => any;
127
140
  families: {
128
141
  all: ({ token, query, headers }: {
129
142
  token: any;
@@ -2958,11 +2971,12 @@ export function createApiClient(options: {
2958
2971
  financingCost: any;
2959
2972
  query?: {};
2960
2973
  }): any;
2961
- delete({ token, jwtToken, headers, cartId }: {
2974
+ delete({ token, jwtToken, headers, cartId, query }: {
2962
2975
  token: any;
2963
2976
  jwtToken: any;
2964
2977
  headers: any;
2965
2978
  cartId: any;
2979
+ query?: {};
2966
2980
  }): any;
2967
2981
  };
2968
2982
  };
@@ -15,6 +15,19 @@ declare function productsFactory({ client, internalAuthTokenProvider }: {
15
15
  query?: {};
16
16
  headers: any;
17
17
  }) => any;
18
+ create: ({ data, token, jwtToken, headers }: {
19
+ data: any;
20
+ token: any;
21
+ jwtToken: any;
22
+ headers: any;
23
+ }) => any;
24
+ update: ({ productId, data, token, jwtToken, headers }: {
25
+ productId: any;
26
+ data: any;
27
+ token: any;
28
+ jwtToken: any;
29
+ headers: any;
30
+ }) => any;
18
31
  families: {
19
32
  all: ({ token, query, headers }: {
20
33
  token: any;
@@ -86,11 +86,12 @@ declare function cartFactory({ client, internalAuthTokenProvider }: {
86
86
  financingCost: any;
87
87
  query?: {};
88
88
  }): any;
89
- delete({ token, jwtToken, headers, cartId }: {
89
+ delete({ token, jwtToken, headers, cartId, query }: {
90
90
  token: any;
91
91
  jwtToken: any;
92
92
  headers: any;
93
93
  cartId: any;
94
+ query?: {};
94
95
  }): any;
95
96
  };
96
97
  };
@@ -78,6 +78,19 @@ declare const _exports: {
78
78
  query?: {};
79
79
  headers: any;
80
80
  }) => any;
81
+ create: ({ data, token, jwtToken, headers }: {
82
+ data: any;
83
+ token: any;
84
+ jwtToken: any;
85
+ headers: any;
86
+ }) => any;
87
+ update: ({ productId, data, token, jwtToken, headers }: {
88
+ productId: any;
89
+ data: any;
90
+ token: any;
91
+ jwtToken: any;
92
+ headers: any;
93
+ }) => any;
81
94
  families: {
82
95
  all: ({ token, query, headers }: {
83
96
  token: any;
@@ -2912,11 +2925,12 @@ declare const _exports: {
2912
2925
  financingCost: any;
2913
2926
  query?: {};
2914
2927
  }): any;
2915
- delete({ token, jwtToken, headers, cartId }: {
2928
+ delete({ token, jwtToken, headers, cartId, query }: {
2916
2929
  token: any;
2917
2930
  jwtToken: any;
2918
2931
  headers: any;
2919
2932
  cartId: any;
2933
+ query?: {};
2920
2934
  }): any;
2921
2935
  };
2922
2936
  };