@bunnyapp/api-client 2.2.3 → 2.2.4
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.
- package/package.json +1 -1
- package/src/index.js +1 -2
- package/src/helpers/product-create.js +0 -40
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -45,7 +45,7 @@ class Bunny {
|
|
|
45
45
|
return Promise.reject(error.response.data.error_description);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
return Promise.reject(
|
|
48
|
+
return Promise.reject(error.response?.data);
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
this.webhooks = new Webhooks(options.webhookSigningToken);
|
|
@@ -97,6 +97,5 @@ Bunny.prototype.featureUsageCreate = require("./helpers/feature-usage-create.js"
|
|
|
97
97
|
Bunny.prototype.portalSessionCreate = require("./helpers/portal-session-create.js");
|
|
98
98
|
Bunny.prototype.accountUpdateByTenantCode = require("./helpers/account-update-by-tenant-code.js");
|
|
99
99
|
Bunny.prototype.tenantMetricsUpdate = require("./helpers/tenant-metrics-update.js");
|
|
100
|
-
Bunny.prototype.productCreate = require("./helpers/product-create.js");
|
|
101
100
|
|
|
102
101
|
module.exports = Bunny;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const query = `mutation productCreate ($attributes: ProductAttributes!) {
|
|
2
|
-
productCreate (attributes: $attributes) {
|
|
3
|
-
errors
|
|
4
|
-
product {
|
|
5
|
-
code
|
|
6
|
-
description
|
|
7
|
-
everythingInPlus
|
|
8
|
-
id
|
|
9
|
-
internalNotes
|
|
10
|
-
name
|
|
11
|
-
platformId
|
|
12
|
-
productCategoryId
|
|
13
|
-
showProductNameOnLineItem
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}`;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @param {object} attributes Product attributes
|
|
21
|
-
* @returns
|
|
22
|
-
*/
|
|
23
|
-
module.exports = async function (attributes) {
|
|
24
|
-
let variables = {
|
|
25
|
-
attributes: attributes,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const res = await this.query(query, variables);
|
|
29
|
-
const productCreate = res?.data?.productCreate;
|
|
30
|
-
|
|
31
|
-
if (res?.errors) {
|
|
32
|
-
throw new Error(res.errors.map((e) => e.message).join());
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (productCreate?.errors) {
|
|
36
|
-
throw new Error(productCreate.errors.join());
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return productCreate?.product;
|
|
40
|
-
};
|