washday-sdk 0.0.116 → 0.0.117
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/get.js +15 -0
- package/dist/api/index.js +1 -0
- package/package.json +1 -1
- package/src/api/customers/get.ts +14 -1
- package/src/api/index.ts +1 -0
- package/src/interfaces/Api.ts +1 -0
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
11
11
|
import axiosInstance from "../axiosInstance";
|
|
12
|
+
const GET_SET_CUSTOMERS_APP = 'api/v2/washdayapp/customers';
|
|
12
13
|
const GET_SET_CUSTOMERS = 'api/customer';
|
|
13
14
|
export const getList = function (params) {
|
|
14
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -70,3 +71,17 @@ export const getCustomerOrders = function (customerId, params) {
|
|
|
70
71
|
}
|
|
71
72
|
});
|
|
72
73
|
};
|
|
74
|
+
export const getCustomerByIdCustomersApp = function (customerId) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
try {
|
|
77
|
+
const config = {
|
|
78
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
79
|
+
};
|
|
80
|
+
return yield axiosInstance.get(`${GET_SET_CUSTOMERS_APP}/${customerId}`, config);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
console.error('Error fetching customer:', error);
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
};
|
package/dist/api/index.js
CHANGED
|
@@ -101,6 +101,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
101
101
|
getCustomerById: customersEndpoints.getModule.getCustomerById,
|
|
102
102
|
getCustomerHighlightsById: customersEndpoints.getModule.getCustomerHighlightsById,
|
|
103
103
|
getCustomerOrders: customersEndpoints.getModule.getCustomerOrders,
|
|
104
|
+
getCustomerByIdCustomersApp: customersEndpoints.getModule.getCustomerByIdCustomersApp,
|
|
104
105
|
create: customersEndpoints.postModule.create,
|
|
105
106
|
updateById: customersEndpoints.putModule.updateById,
|
|
106
107
|
deleteById: customersEndpoints.deleteModule.deleteById,
|
package/package.json
CHANGED
package/src/api/customers/get.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ICustomer } from "../../interfaces/Customer";
|
|
|
3
3
|
import { IOrderInfo } from "../../interfaces/Order";
|
|
4
4
|
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
5
5
|
import axiosInstance from "../axiosInstance";
|
|
6
|
-
|
|
6
|
+
const GET_SET_CUSTOMERS_APP = 'api/v2/washdayapp/customers';
|
|
7
7
|
const GET_SET_CUSTOMERS = 'api/customer';
|
|
8
8
|
|
|
9
9
|
export const getList = async function (this: WashdayClientInstance, params: {
|
|
@@ -69,3 +69,16 @@ export const getCustomerOrders = async function (this: WashdayClientInstance, cu
|
|
|
69
69
|
throw error;
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
export const getCustomerByIdCustomersApp = async function (this: WashdayClientInstance, customerId: string): Promise<{ customer: ICustomer }> {
|
|
75
|
+
try {
|
|
76
|
+
const config = {
|
|
77
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
78
|
+
};
|
|
79
|
+
return await axiosInstance.get(`${GET_SET_CUSTOMERS_APP}/${customerId}`, config);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.error('Error fetching customer:', error);
|
|
82
|
+
throw error;
|
|
83
|
+
}
|
|
84
|
+
};
|
package/src/api/index.ts
CHANGED
|
@@ -107,6 +107,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
107
107
|
getCustomerById: customersEndpoints.getModule.getCustomerById,
|
|
108
108
|
getCustomerHighlightsById: customersEndpoints.getModule.getCustomerHighlightsById,
|
|
109
109
|
getCustomerOrders: customersEndpoints.getModule.getCustomerOrders,
|
|
110
|
+
getCustomerByIdCustomersApp: customersEndpoints.getModule.getCustomerByIdCustomersApp,
|
|
110
111
|
create: customersEndpoints.postModule.create,
|
|
111
112
|
updateById: customersEndpoints.putModule.updateById,
|
|
112
113
|
deleteById: customersEndpoints.deleteModule.deleteById,
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -93,6 +93,7 @@ export interface WashdayClientInstance {
|
|
|
93
93
|
getCustomerById: typeof customersEndpoints.getModule.getCustomerById;
|
|
94
94
|
getCustomerHighlightsById: typeof customersEndpoints.getModule.getCustomerHighlightsById;
|
|
95
95
|
getCustomerOrders: typeof customersEndpoints.getModule.getCustomerOrders;
|
|
96
|
+
getCustomerByIdCustomersApp: typeof customersEndpoints.getModule.getCustomerByIdCustomersApp;
|
|
96
97
|
create: typeof customersEndpoints.postModule.create;
|
|
97
98
|
updateById: typeof customersEndpoints.putModule.updateById;
|
|
98
99
|
deleteById: typeof customersEndpoints.deleteModule.deleteById;
|