washday-sdk 0.0.39 → 0.0.41

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 CHANGED
@@ -5,11 +5,13 @@ const put_1 = require("./products/put");
5
5
  const get_2 = require("./stores/get");
6
6
  const post_1 = require("./stores/post");
7
7
  const put_2 = require("./stores/put");
8
+ const put_3 = require("./users/put");
8
9
  const WashdayClient = function WashdayClient(apiToken) {
9
10
  this.apiToken = apiToken;
10
11
  WashdayClient.prototype.customers.apiToken = apiToken;
11
12
  WashdayClient.prototype.stores.apiToken = apiToken;
12
13
  WashdayClient.prototype.products.apiToken = apiToken;
14
+ WashdayClient.prototype.users.apiToken = apiToken;
13
15
  };
14
16
  WashdayClient.prototype.customers = {
15
17
  getCustomerById: get_1.getCustomerById,
@@ -24,4 +26,7 @@ WashdayClient.prototype.stores = {
24
26
  WashdayClient.prototype.products = {
25
27
  bulkUpdate: put_1.bulkUpdate,
26
28
  };
29
+ WashdayClient.prototype.users = {
30
+ updateUserById: put_3.updateUserById,
31
+ };
27
32
  exports.default = WashdayClient;
@@ -22,7 +22,7 @@ const bulkUpdate = function (storeId, data) {
22
22
  return __awaiter(this, void 0, void 0, function* () {
23
23
  try {
24
24
  const config = {
25
- headers: { Authorization: `Bearer ${this.apiToken}` }
25
+ headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
26
26
  };
27
27
  const response = yield axiosInstance_1.default.put(`${GET_SET_PRODUCTS}/${storeId}/bulk`, data, config);
28
28
  return response.data || {};
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.updateUserById = void 0;
16
+ const axiosInstance_1 = __importDefault(require("../axiosInstance"));
17
+ const GET_SET_USER = 'api/user';
18
+ const REQUEST_PARAMS = {
19
+ token: 'LOGGED_USER_TOKEN',
20
+ };
21
+ const updateUserById = function (userId, data) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ try {
24
+ const config = {
25
+ headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
26
+ };
27
+ const response = yield axiosInstance_1.default.put(`${GET_SET_USER}/${userId}`, data, config);
28
+ return response.data || {};
29
+ }
30
+ catch (error) {
31
+ console.error('Error fetching updateUserById:', error);
32
+ throw error;
33
+ }
34
+ });
35
+ };
36
+ exports.updateUserById = updateUserById;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/api/index.ts CHANGED
@@ -4,6 +4,7 @@ import { bulkUpdate } from "./products/put";
4
4
  import { getStoreById, getStores } from "./stores/get";
5
5
  import { createStoreImage } from "./stores/post";
6
6
  import { updateStoreById } from "./stores/put";
7
+ import { updateUserById } from "./users/put";
7
8
 
8
9
  type WashdayClientConstructor = {
9
10
  new(apiToken: string): {
@@ -16,6 +17,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
16
17
  WashdayClient.prototype.customers.apiToken = apiToken;
17
18
  WashdayClient.prototype.stores.apiToken = apiToken;
18
19
  WashdayClient.prototype.products.apiToken = apiToken;
20
+ WashdayClient.prototype.users.apiToken = apiToken;
19
21
  } as any;
20
22
 
21
23
  WashdayClient.prototype.customers = {
@@ -35,4 +37,8 @@ WashdayClient.prototype.products = {
35
37
  bulkUpdate: bulkUpdate,
36
38
  };
37
39
 
40
+ WashdayClient.prototype.users = {
41
+ updateUserById: updateUserById,
42
+ };
43
+
38
44
  export default WashdayClient;
@@ -10,7 +10,7 @@ const REQUEST_PARAMS = {
10
10
  export const bulkUpdate = async function (this: WashdayClientInstance, storeId: string, data: IStore): Promise<any> {
11
11
  try {
12
12
  const config = {
13
- headers: { Authorization: `Bearer ${this.apiToken}` }
13
+ headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
14
14
  };
15
15
  const response = await axiosInstance.put(`${GET_SET_PRODUCTS}/${storeId}/bulk`, data, config);
16
16
  return response.data || {}
@@ -0,0 +1,21 @@
1
+ import { WashdayClientInstance } from "../../interfaces/Api";
2
+ import { IStore } from "../../interfaces/Store";
3
+ import axiosInstance from "../axiosInstance";
4
+ const GET_SET_USER = 'api/user';
5
+ const REQUEST_PARAMS = {
6
+ token: 'LOGGED_USER_TOKEN',
7
+ };
8
+
9
+
10
+ export const updateUserById = async function (this: WashdayClientInstance, userId: string, data: IStore): Promise<any> {
11
+ try {
12
+ const config = {
13
+ headers: { Authorization: `Bearer ${this.apiToken}`, 'Content-Type': false }
14
+ };
15
+ const response = await axiosInstance.put(`${GET_SET_USER}/${userId}`, data, config);
16
+ return response.data || {}
17
+ } catch (error) {
18
+ console.error('Error fetching updateUserById:', error);
19
+ throw error;
20
+ }
21
+ };