washday-sdk 0.0.146 → 0.0.148
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/dist/api/index.js +1 -0
- package/dist/api/products/post.js +15 -0
- package/package.json +1 -1
- package/src/api/index.ts +1 -0
- package/src/api/products/post.ts +17 -0
- package/src/interfaces/Api.ts +1 -0
package/dist/api/index.js
CHANGED
|
@@ -141,6 +141,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
141
141
|
getById: productsEndpoints.getModule.getById,
|
|
142
142
|
create: productsEndpoints.postModule.create,
|
|
143
143
|
createProductSupply: productsEndpoints.postModule.createProductSupply,
|
|
144
|
+
bulkCreate: productsEndpoints.postModule.bulkCreate,
|
|
144
145
|
deleteById: productsEndpoints.deleteModule.deleteById,
|
|
145
146
|
deleteProductSupplyById: productsEndpoints.deleteModule.deleteProductSupplyById,
|
|
146
147
|
updateById: productsEndpoints.putModule.updateById,
|
|
@@ -40,3 +40,18 @@ export const createProductSupply = function (id, data) {
|
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
};
|
|
43
|
+
export const bulkCreate = function (data) {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
try {
|
|
46
|
+
const config = {
|
|
47
|
+
headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
|
|
48
|
+
};
|
|
49
|
+
const response = yield axiosInstance.post(`${GET_SET_PRODUCTS}/${data.store}/bulk`, data, config);
|
|
50
|
+
return response.data || {};
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
console.error('Error fetching products bulkCreate:', error);
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
};
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -147,6 +147,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
147
147
|
getById: productsEndpoints.getModule.getById,
|
|
148
148
|
create: productsEndpoints.postModule.create,
|
|
149
149
|
createProductSupply: productsEndpoints.postModule.createProductSupply,
|
|
150
|
+
bulkCreate: productsEndpoints.postModule.bulkCreate,
|
|
150
151
|
deleteById: productsEndpoints.deleteModule.deleteById,
|
|
151
152
|
deleteProductSupplyById: productsEndpoints.deleteModule.deleteProductSupplyById,
|
|
152
153
|
updateById: productsEndpoints.putModule.updateById,
|
package/src/api/products/post.ts
CHANGED
|
@@ -51,4 +51,21 @@ export const createProductSupply = async function (this: WashdayClientInstance,
|
|
|
51
51
|
console.error('Error fetching createProductSupply:', error);
|
|
52
52
|
throw error;
|
|
53
53
|
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const bulkCreate = async function (this: WashdayClientInstance, data: {
|
|
57
|
+
section: string;
|
|
58
|
+
store: string;
|
|
59
|
+
file: any;
|
|
60
|
+
}): Promise<any> {
|
|
61
|
+
try {
|
|
62
|
+
const config = {
|
|
63
|
+
headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
|
|
64
|
+
};
|
|
65
|
+
const response = await axiosInstance.post(`${GET_SET_PRODUCTS}/${data.store}/bulk`, data, config);
|
|
66
|
+
return response.data || {}
|
|
67
|
+
} catch (error) {
|
|
68
|
+
console.error('Error fetching products bulkCreate:', error);
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
54
71
|
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -133,6 +133,7 @@ export interface WashdayClientInstance {
|
|
|
133
133
|
getById: typeof productsEndpoints.getModule.getById;
|
|
134
134
|
create: typeof productsEndpoints.postModule.create;
|
|
135
135
|
createProductSupply: typeof productsEndpoints.postModule.createProductSupply;
|
|
136
|
+
bulkCreate: typeof productsEndpoints.postModule.bulkCreate;
|
|
136
137
|
deleteById: typeof productsEndpoints.deleteModule.deleteById;
|
|
137
138
|
deleteProductSupplyById: typeof productsEndpoints.deleteModule.deleteProductSupplyById;
|
|
138
139
|
updateById: typeof productsEndpoints.putModule.updateById;
|