washday-sdk 0.0.143 → 0.0.145
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/customers/delete.js +15 -0
- package/dist/api/customers/post.js +15 -0
- package/dist/api/index.js +2 -0
- package/package.json +1 -1
- package/src/api/customers/delete.ts +14 -0
- package/src/api/customers/post.ts +13 -0
- package/src/api/index.ts +2 -0
- package/src/interfaces/Api.ts +2 -0
|
@@ -9,6 +9,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import axiosInstance from "../axiosInstance";
|
|
11
11
|
const GET_SET_CUSTOMERS = 'api/customer';
|
|
12
|
+
const GET_SET_CUSTOMERS_APP = 'api/v2/washdayapp/customers';
|
|
13
|
+
export const deleteByIdCustomersApp = function (id) {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
try {
|
|
16
|
+
const config = {
|
|
17
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
18
|
+
};
|
|
19
|
+
return yield axiosInstance.delete(`${GET_SET_CUSTOMERS_APP}/${id}`, config);
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.error('Error fetching deleteByIdCustomersApp:', error);
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
|
12
27
|
export const deleteById = function (id) {
|
|
13
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
29
|
try {
|
|
@@ -24,3 +24,18 @@ export const create = function (data) {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
|
+
export const bulkCreate = function (storeId, data) {
|
|
28
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
try {
|
|
30
|
+
const config = {
|
|
31
|
+
headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
|
|
32
|
+
};
|
|
33
|
+
const response = yield axiosInstance.put(`${GET_SET_CUSTOMERS}/bulk`, data, config);
|
|
34
|
+
return response.data || {};
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.error('Error fetching customers bulkCreate:', error);
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
package/dist/api/index.js
CHANGED
|
@@ -118,8 +118,10 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
118
118
|
getCustomerOrders: customersEndpoints.getModule.getCustomerOrders,
|
|
119
119
|
getCustomerByIdCustomersApp: customersEndpoints.getModule.getCustomerByIdCustomersApp,
|
|
120
120
|
create: customersEndpoints.postModule.create,
|
|
121
|
+
bulkCreate: customersEndpoints.postModule.bulkCreate,
|
|
121
122
|
updateById: customersEndpoints.putModule.updateById,
|
|
122
123
|
deleteById: customersEndpoints.deleteModule.deleteById,
|
|
124
|
+
deleteByIdCustomersApp: customersEndpoints.deleteModule.deleteByIdCustomersApp,
|
|
123
125
|
updateByIdCustomersApp: customersEndpoints.putModule.updateByIdCustomersApp,
|
|
124
126
|
});
|
|
125
127
|
this.stores = bindMethods(this, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
2
|
import axiosInstance from "../axiosInstance";
|
|
3
3
|
const GET_SET_CUSTOMERS = 'api/customer';
|
|
4
|
+
const GET_SET_CUSTOMERS_APP = 'api/v2/washdayapp/customers';
|
|
5
|
+
|
|
6
|
+
export const deleteByIdCustomersApp = async function (this: WashdayClientInstance, id: string): Promise<any> {
|
|
7
|
+
try {
|
|
8
|
+
const config = {
|
|
9
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
10
|
+
};
|
|
11
|
+
return await axiosInstance.delete(`${GET_SET_CUSTOMERS_APP}/${id}`, config);
|
|
12
|
+
} catch (error) {
|
|
13
|
+
console.error('Error fetching deleteByIdCustomersApp:', error);
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
4
18
|
|
|
5
19
|
export const deleteById = async function (this: WashdayClientInstance, id: string): Promise<any> {
|
|
6
20
|
try {
|
|
@@ -33,3 +33,16 @@ export const create = async function (this: WashdayClientInstance, data: {
|
|
|
33
33
|
throw error;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
+
|
|
37
|
+
export const bulkCreate = async function (this: WashdayClientInstance, storeId: string, data: any): Promise<any> {
|
|
38
|
+
try {
|
|
39
|
+
const config = {
|
|
40
|
+
headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
|
|
41
|
+
};
|
|
42
|
+
const response = await axiosInstance.put(`${GET_SET_CUSTOMERS}/bulk`, data, config);
|
|
43
|
+
return response.data || {}
|
|
44
|
+
} catch (error) {
|
|
45
|
+
console.error('Error fetching customers bulkCreate:', error);
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
};
|
package/src/api/index.ts
CHANGED
|
@@ -124,8 +124,10 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
124
124
|
getCustomerOrders: customersEndpoints.getModule.getCustomerOrders,
|
|
125
125
|
getCustomerByIdCustomersApp: customersEndpoints.getModule.getCustomerByIdCustomersApp,
|
|
126
126
|
create: customersEndpoints.postModule.create,
|
|
127
|
+
bulkCreate: customersEndpoints.postModule.bulkCreate,
|
|
127
128
|
updateById: customersEndpoints.putModule.updateById,
|
|
128
129
|
deleteById: customersEndpoints.deleteModule.deleteById,
|
|
130
|
+
deleteByIdCustomersApp: customersEndpoints.deleteModule.deleteByIdCustomersApp,
|
|
129
131
|
updateByIdCustomersApp: customersEndpoints.putModule.updateByIdCustomersApp,
|
|
130
132
|
});
|
|
131
133
|
this.stores = bindMethods(this, {
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -110,8 +110,10 @@ export interface WashdayClientInstance {
|
|
|
110
110
|
getCustomerOrders: typeof customersEndpoints.getModule.getCustomerOrders;
|
|
111
111
|
getCustomerByIdCustomersApp: typeof customersEndpoints.getModule.getCustomerByIdCustomersApp;
|
|
112
112
|
create: typeof customersEndpoints.postModule.create;
|
|
113
|
+
bulkCreate: typeof customersEndpoints.postModule.bulkCreate;
|
|
113
114
|
updateById: typeof customersEndpoints.putModule.updateById;
|
|
114
115
|
deleteById: typeof customersEndpoints.deleteModule.deleteById;
|
|
116
|
+
deleteByIdCustomersApp: typeof customersEndpoints.deleteModule.deleteByIdCustomersApp;
|
|
115
117
|
updateByIdCustomersApp: typeof customersEndpoints.putModule.updateByIdCustomersApp;
|
|
116
118
|
};
|
|
117
119
|
stores: {
|