@encatch/api-sdk 0.0.1 → 0.0.3

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/index.cjs CHANGED
@@ -52,7 +52,7 @@ module.exports = __toCommonJS(index_exports);
52
52
 
53
53
  // src/feature/encatch-api.ts
54
54
  var import_pako = __toESM(require("pako"), 1);
55
- var import_ts_case_convert = require("ts-case-convert");
55
+ var import_schema = require("@encatch/schema");
56
56
  var _EncatchApiSDK = class _EncatchApiSDK {
57
57
  constructor(config) {
58
58
  __publicField(this, "apiKey");
@@ -84,11 +84,7 @@ var _EncatchApiSDK = class _EncatchApiSDK {
84
84
  _EncatchApiSDK.ENDPOINTS.FETCH_CONFIGURATIONS,
85
85
  {
86
86
  method: "POST",
87
- body: {
88
- sessionInfo: params.sessionInfo,
89
- deviceInfo: params.deviceInfo,
90
- userInfo: params.userInfo
91
- }
87
+ body: params
92
88
  }
93
89
  );
94
90
  this._log(
@@ -113,11 +109,7 @@ var _EncatchApiSDK = class _EncatchApiSDK {
113
109
  `${_EncatchApiSDK.ENDPOINTS.FETCH_CONFIGURATIONS}?isNewDevice=true`,
114
110
  {
115
111
  method: "POST",
116
- body: {
117
- sessionInfo: params.sessionInfo,
118
- deviceInfo: params.deviceInfo,
119
- userInfo: params.userInfo
120
- }
112
+ body: params
121
113
  }
122
114
  );
123
115
  this._log(
@@ -139,12 +131,7 @@ var _EncatchApiSDK = class _EncatchApiSDK {
139
131
  `${_EncatchApiSDK.ENDPOINTS.FETCH_CONFIGURATION_DETAILS}/${params.formConfig.feedbackConfigurationId}`,
140
132
  {
141
133
  method: "POST",
142
- body: {
143
- formConfig: params.formConfig,
144
- deviceInfo: params.deviceInfo,
145
- sessionInfo: params.sessionInfo,
146
- userInfo: params.userInfo
147
- }
134
+ body: params
148
135
  }
149
136
  );
150
137
  this._log(
@@ -227,13 +214,12 @@ var _EncatchApiSDK = class _EncatchApiSDK {
227
214
  const headers = __spreadValues({
228
215
  "Content-Type": "application/json",
229
216
  "X-Api-Key": this.apiKey,
230
- "X-Dev-Debug-Id": "rahul",
231
217
  Referer: this.appPackageName
232
218
  }, options.headers);
233
219
  let convertedPayload;
234
220
  let requestBody;
235
221
  try {
236
- convertedPayload = (0, import_ts_case_convert.objectToSnake)(options.body);
222
+ convertedPayload = (0, import_schema.objectToSnake)(options.body);
237
223
  } catch (error) {
238
224
  this._log("Error in snake case transformation: ", error);
239
225
  }
@@ -257,7 +243,7 @@ var _EncatchApiSDK = class _EncatchApiSDK {
257
243
  }
258
244
  try {
259
245
  const jsonResponse = await response.json();
260
- const convertedResponse = (0, import_ts_case_convert.objectToCamel)(jsonResponse);
246
+ const convertedResponse = (0, import_schema.objectToCamel)(jsonResponse);
261
247
  return convertedResponse;
262
248
  } catch (error) {
263
249
  this._log("Error parsing response:", error);
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
18
18
 
19
19
  // src/feature/encatch-api.ts
20
20
  import pako from "pako";
21
- import { objectToSnake, objectToCamel } from "ts-case-convert";
21
+ import { objectToSnake, objectToCamel } from "@encatch/schema";
22
22
  var _EncatchApiSDK = class _EncatchApiSDK {
23
23
  constructor(config) {
24
24
  __publicField(this, "apiKey");
@@ -50,11 +50,7 @@ var _EncatchApiSDK = class _EncatchApiSDK {
50
50
  _EncatchApiSDK.ENDPOINTS.FETCH_CONFIGURATIONS,
51
51
  {
52
52
  method: "POST",
53
- body: {
54
- sessionInfo: params.sessionInfo,
55
- deviceInfo: params.deviceInfo,
56
- userInfo: params.userInfo
57
- }
53
+ body: params
58
54
  }
59
55
  );
60
56
  this._log(
@@ -79,11 +75,7 @@ var _EncatchApiSDK = class _EncatchApiSDK {
79
75
  `${_EncatchApiSDK.ENDPOINTS.FETCH_CONFIGURATIONS}?isNewDevice=true`,
80
76
  {
81
77
  method: "POST",
82
- body: {
83
- sessionInfo: params.sessionInfo,
84
- deviceInfo: params.deviceInfo,
85
- userInfo: params.userInfo
86
- }
78
+ body: params
87
79
  }
88
80
  );
89
81
  this._log(
@@ -105,12 +97,7 @@ var _EncatchApiSDK = class _EncatchApiSDK {
105
97
  `${_EncatchApiSDK.ENDPOINTS.FETCH_CONFIGURATION_DETAILS}/${params.formConfig.feedbackConfigurationId}`,
106
98
  {
107
99
  method: "POST",
108
- body: {
109
- formConfig: params.formConfig,
110
- deviceInfo: params.deviceInfo,
111
- sessionInfo: params.sessionInfo,
112
- userInfo: params.userInfo
113
- }
100
+ body: params
114
101
  }
115
102
  );
116
103
  this._log(
@@ -193,7 +180,6 @@ var _EncatchApiSDK = class _EncatchApiSDK {
193
180
  const headers = __spreadValues({
194
181
  "Content-Type": "application/json",
195
182
  "X-Api-Key": this.apiKey,
196
- "X-Dev-Debug-Id": "rahul",
197
183
  Referer: this.appPackageName
198
184
  }, options.headers);
199
185
  let convertedPayload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@encatch/api-sdk",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -20,7 +20,7 @@
20
20
  "pako": "^2.1.0",
21
21
  "ts-case-convert": "^2.1.0",
22
22
  "zod": "^4.1.8",
23
- "@encatch/schema": "0.1.25"
23
+ "@encatch/schema": "0.1.27"
24
24
  },
25
25
  "scripts": {
26
26
  "dev": "vite",