washday-sdk 0.0.138 → 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.
@@ -70,3 +70,15 @@ export const regularUserLogin = function (params) {
70
70
  }
71
71
  });
72
72
  };
73
+ export const regularUserTokenLogin = function (params) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ try {
76
+ const config = {};
77
+ return yield axiosInstance.post(`${REGULAR_USER_AUTH}/tokenLogin`, params, config);
78
+ }
79
+ catch (error) {
80
+ console.error('Error fetching regularUserTokenLogin:', error);
81
+ throw error;
82
+ }
83
+ });
84
+ };
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) {
@@ -79,6 +80,7 @@ const WashdayClient = function WashdayClient(apiToken) {
79
80
  customerRegularLogin: authEndpoints.postModule.customerRegularLogin,
80
81
  customerSignUp: authEndpoints.postModule.customerSignUp,
81
82
  regularUserLogin: authEndpoints.postModule.regularUserLogin,
83
+ regularUserTokenLogin: authEndpoints.postModule.regularUserTokenLogin,
82
84
  });
83
85
  this.orders = bindMethods(this, {
84
86
  getList: ordersEndpoints.getModule.getList,
@@ -141,6 +143,7 @@ const WashdayClient = function WashdayClient(apiToken) {
141
143
  });
142
144
  this.users = bindMethods(this, {
143
145
  updateUserById: updateUserById,
146
+ deleteUserById: deleteUserById,
144
147
  });
145
148
  this.countries = bindMethods(this, {
146
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.138",
3
+ "version": "0.0.140",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -83,3 +83,16 @@ export const regularUserLogin = async function (this: WashdayClientInstance, par
83
83
  throw error;
84
84
  }
85
85
  };
86
+
87
+
88
+ export const regularUserTokenLogin = async function (this: WashdayClientInstance, params: {
89
+ token: string
90
+ }): Promise<any> {
91
+ try {
92
+ const config = {};
93
+ return await axiosInstance.post(`${REGULAR_USER_AUTH}/tokenLogin`, params, config);
94
+ } catch (error) {
95
+ console.error('Error fetching regularUserTokenLogin:', error);
96
+ throw error;
97
+ }
98
+ };
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
@@ -85,6 +86,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
85
86
  customerRegularLogin: authEndpoints.postModule.customerRegularLogin,
86
87
  customerSignUp: authEndpoints.postModule.customerSignUp,
87
88
  regularUserLogin: authEndpoints.postModule.regularUserLogin,
89
+ regularUserTokenLogin: authEndpoints.postModule.regularUserTokenLogin,
88
90
  });
89
91
  this.orders = bindMethods(this, {
90
92
  getList: ordersEndpoints.getModule.getList,
@@ -147,6 +149,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
147
149
  });
148
150
  this.users = bindMethods(this, {
149
151
  updateUserById: updateUserById,
152
+ deleteUserById: deleteUserById,
150
153
  });
151
154
  this.countries = bindMethods(this, {
152
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
+ };
@@ -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;
@@ -61,6 +62,7 @@ export interface WashdayClientInstance {
61
62
  customerRegularLogin: typeof authEndpoints.postModule.customerRegularLogin;
62
63
  customerSignUp: typeof authEndpoints.postModule.customerSignUp;
63
64
  regularUserLogin: typeof authEndpoints.postModule.regularUserLogin;
65
+ regularUserTokenLogin: typeof authEndpoints.postModule.regularUserTokenLogin;
64
66
  }
65
67
  review: {
66
68
  getList: typeof reviewsEndpoints.getModule.getList;
@@ -133,6 +135,7 @@ export interface WashdayClientInstance {
133
135
  };
134
136
  users: {
135
137
  updateUserById: typeof updateUserById;
138
+ deleteUserById: typeof deleteUserById;
136
139
  };
137
140
  countries: {
138
141
  getCountries: typeof getCountries;