washday-sdk 0.0.139 → 0.0.140
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 +2 -0
- package/dist/api/users/delete.js +26 -0
- package/package.json +1 -1
- package/src/api/index.ts +2 -0
- package/src/api/users/delete.ts +16 -0
- package/src/interfaces/Api.ts +2 -0
package/dist/api/index.js
CHANGED
|
@@ -35,6 +35,7 @@ import * as routesEndpoints from './routes';
|
|
|
35
35
|
import * as reviewsEndpoints from './reviews';
|
|
36
36
|
import * as cfdiEndpoints from './cfdi';
|
|
37
37
|
import * as cashupsEndpoints from './cashups';
|
|
38
|
+
import { deleteUserById } from "./users/delete";
|
|
38
39
|
function bindMethods(instance, methods) {
|
|
39
40
|
const boundMethods = {};
|
|
40
41
|
for (const key in methods) {
|
|
@@ -142,6 +143,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
142
143
|
});
|
|
143
144
|
this.users = bindMethods(this, {
|
|
144
145
|
updateUserById: updateUserById,
|
|
146
|
+
deleteUserById: deleteUserById,
|
|
145
147
|
});
|
|
146
148
|
this.countries = bindMethods(this, {
|
|
147
149
|
getCountries: getCountries,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import axiosInstance from "../axiosInstance";
|
|
11
|
+
const GET_SET_USER = 'api/user';
|
|
12
|
+
export const deleteUserById = function (id) {
|
|
13
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
try {
|
|
15
|
+
const config = {
|
|
16
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
|
+
};
|
|
18
|
+
const response = yield axiosInstance.delete(`${GET_SET_USER}/${id}`, config);
|
|
19
|
+
return response;
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.error('Error fetching deleteUserById:', error);
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
};
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -36,6 +36,7 @@ import * as routesEndpoints from './routes';
|
|
|
36
36
|
import * as reviewsEndpoints from './reviews';
|
|
37
37
|
import * as cfdiEndpoints from './cfdi';
|
|
38
38
|
import * as cashupsEndpoints from './cashups';
|
|
39
|
+
import { deleteUserById } from "./users/delete";
|
|
39
40
|
|
|
40
41
|
type WashdayClientConstructor = {
|
|
41
42
|
new(apiToken: string): WashdayClientInstance
|
|
@@ -148,6 +149,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
148
149
|
});
|
|
149
150
|
this.users = bindMethods(this, {
|
|
150
151
|
updateUserById: updateUserById,
|
|
152
|
+
deleteUserById: deleteUserById,
|
|
151
153
|
});
|
|
152
154
|
this.countries = bindMethods(this, {
|
|
153
155
|
getCountries: getCountries,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
|
+
import axiosInstance from "../axiosInstance";
|
|
3
|
+
const GET_SET_USER = 'api/user';
|
|
4
|
+
|
|
5
|
+
export const deleteUserById = async function (this: WashdayClientInstance, id: string): Promise<any> {
|
|
6
|
+
try {
|
|
7
|
+
const config = {
|
|
8
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
9
|
+
};
|
|
10
|
+
const response = await axiosInstance.delete(`${GET_SET_USER}/${id}`, config);
|
|
11
|
+
return response;
|
|
12
|
+
} catch (error) {
|
|
13
|
+
console.error('Error fetching deleteUserById:', error);
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -35,6 +35,7 @@ import * as reviewsEndpoints from '../api/reviews';
|
|
|
35
35
|
import * as cfdiEndpoints from '../api/cfdi';
|
|
36
36
|
import * as cashupsEndpoints from '../api/cashups';
|
|
37
37
|
import * as authEndpoints from '../api/auth';
|
|
38
|
+
import { deleteUserById } from "../api/users/delete";
|
|
38
39
|
|
|
39
40
|
export interface WashdayClientInstance {
|
|
40
41
|
apiToken: string;
|
|
@@ -134,6 +135,7 @@ export interface WashdayClientInstance {
|
|
|
134
135
|
};
|
|
135
136
|
users: {
|
|
136
137
|
updateUserById: typeof updateUserById;
|
|
138
|
+
deleteUserById: typeof deleteUserById;
|
|
137
139
|
};
|
|
138
140
|
countries: {
|
|
139
141
|
getCountries: typeof getCountries;
|