@encatch/api-sdk 0.0.11 → 0.1.0-beta.1
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 +10 -12
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +10 -12
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -146,7 +146,7 @@ var _EncatchApiSDK = class _EncatchApiSDK {
|
|
|
146
146
|
}
|
|
147
147
|
async submitFeedback(params) {
|
|
148
148
|
this._log(
|
|
149
|
-
`Submitting feedback with
|
|
149
|
+
`Submitting feedback with isPartialSubmit: '${params.formConfig.isPartialSubmit}'`,
|
|
150
150
|
params
|
|
151
151
|
);
|
|
152
152
|
try {
|
|
@@ -170,7 +170,7 @@ var _EncatchApiSDK = class _EncatchApiSDK {
|
|
|
170
170
|
}
|
|
171
171
|
async viewFeedback(params) {
|
|
172
172
|
this._log(
|
|
173
|
-
`Viewing feedback with
|
|
173
|
+
`Viewing feedback with isPartialSubmit: '${params.formConfig.isPartialSubmit}'`,
|
|
174
174
|
params
|
|
175
175
|
);
|
|
176
176
|
try {
|
|
@@ -194,28 +194,26 @@ var _EncatchApiSDK = class _EncatchApiSDK {
|
|
|
194
194
|
}
|
|
195
195
|
async refineText(params) {
|
|
196
196
|
this._log("Refining text with params:", JSON.stringify(params, null, 2));
|
|
197
|
-
let convertedPayload;
|
|
198
197
|
const url = `${this.hostUrl}${_EncatchApiSDK.ENDPOINTS.REFINE_TEXT}`;
|
|
199
198
|
const headers = {
|
|
200
199
|
"Content-Type": "application/json",
|
|
201
200
|
"X-Api-Key": this.apiKey,
|
|
202
201
|
Referer: this.appPackageName
|
|
203
202
|
};
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
203
|
+
const requestBody = {
|
|
204
|
+
questionId: params.questionId,
|
|
205
|
+
feedbackConfigurationId: params.feedbackConfigurationId,
|
|
206
|
+
userText: params.userText
|
|
207
|
+
};
|
|
209
208
|
const response = await fetch(url, {
|
|
210
209
|
method: "POST",
|
|
211
210
|
headers,
|
|
212
|
-
body: JSON.stringify(
|
|
211
|
+
body: JSON.stringify(requestBody)
|
|
213
212
|
});
|
|
214
213
|
try {
|
|
215
214
|
const jsonResponse = await response.json();
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
return convertedResponse;
|
|
215
|
+
this._log("Text refine response: ", jsonResponse);
|
|
216
|
+
return jsonResponse;
|
|
219
217
|
} catch (error) {
|
|
220
218
|
this._log("Error parsing response:", error);
|
|
221
219
|
throw new Error("Failed to parse response");
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FetchConfigurationListRequest, FetchConfigurationListResponse, FetchFeedbackDetailsRequest, FetchFeedbackDetailsResponse, SubmitFeedback,
|
|
1
|
+
import { FetchConfigurationListRequest, FetchConfigurationListResponse, FetchFeedbackDetailsRequest, FetchFeedbackDetailsResponse, SubmitFeedback, PartialFeedback, RefineTextParams, RefineTextResponse } from '@encatch/schema';
|
|
2
2
|
export * from '@encatch/schema';
|
|
3
3
|
|
|
4
4
|
interface SDKConfig {
|
|
@@ -25,7 +25,7 @@ declare class EncatchApiSDK {
|
|
|
25
25
|
success: boolean;
|
|
26
26
|
error?: string;
|
|
27
27
|
}>;
|
|
28
|
-
viewFeedback(params:
|
|
28
|
+
viewFeedback(params: PartialFeedback): Promise<{
|
|
29
29
|
success: boolean;
|
|
30
30
|
error?: string;
|
|
31
31
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FetchConfigurationListRequest, FetchConfigurationListResponse, FetchFeedbackDetailsRequest, FetchFeedbackDetailsResponse, SubmitFeedback,
|
|
1
|
+
import { FetchConfigurationListRequest, FetchConfigurationListResponse, FetchFeedbackDetailsRequest, FetchFeedbackDetailsResponse, SubmitFeedback, PartialFeedback, RefineTextParams, RefineTextResponse } from '@encatch/schema';
|
|
2
2
|
export * from '@encatch/schema';
|
|
3
3
|
|
|
4
4
|
interface SDKConfig {
|
|
@@ -25,7 +25,7 @@ declare class EncatchApiSDK {
|
|
|
25
25
|
success: boolean;
|
|
26
26
|
error?: string;
|
|
27
27
|
}>;
|
|
28
|
-
viewFeedback(params:
|
|
28
|
+
viewFeedback(params: PartialFeedback): Promise<{
|
|
29
29
|
success: boolean;
|
|
30
30
|
error?: string;
|
|
31
31
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -112,7 +112,7 @@ var _EncatchApiSDK = class _EncatchApiSDK {
|
|
|
112
112
|
}
|
|
113
113
|
async submitFeedback(params) {
|
|
114
114
|
this._log(
|
|
115
|
-
`Submitting feedback with
|
|
115
|
+
`Submitting feedback with isPartialSubmit: '${params.formConfig.isPartialSubmit}'`,
|
|
116
116
|
params
|
|
117
117
|
);
|
|
118
118
|
try {
|
|
@@ -136,7 +136,7 @@ var _EncatchApiSDK = class _EncatchApiSDK {
|
|
|
136
136
|
}
|
|
137
137
|
async viewFeedback(params) {
|
|
138
138
|
this._log(
|
|
139
|
-
`Viewing feedback with
|
|
139
|
+
`Viewing feedback with isPartialSubmit: '${params.formConfig.isPartialSubmit}'`,
|
|
140
140
|
params
|
|
141
141
|
);
|
|
142
142
|
try {
|
|
@@ -160,28 +160,26 @@ var _EncatchApiSDK = class _EncatchApiSDK {
|
|
|
160
160
|
}
|
|
161
161
|
async refineText(params) {
|
|
162
162
|
this._log("Refining text with params:", JSON.stringify(params, null, 2));
|
|
163
|
-
let convertedPayload;
|
|
164
163
|
const url = `${this.hostUrl}${_EncatchApiSDK.ENDPOINTS.REFINE_TEXT}`;
|
|
165
164
|
const headers = {
|
|
166
165
|
"Content-Type": "application/json",
|
|
167
166
|
"X-Api-Key": this.apiKey,
|
|
168
167
|
Referer: this.appPackageName
|
|
169
168
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
169
|
+
const requestBody = {
|
|
170
|
+
questionId: params.questionId,
|
|
171
|
+
feedbackConfigurationId: params.feedbackConfigurationId,
|
|
172
|
+
userText: params.userText
|
|
173
|
+
};
|
|
175
174
|
const response = await fetch(url, {
|
|
176
175
|
method: "POST",
|
|
177
176
|
headers,
|
|
178
|
-
body: JSON.stringify(
|
|
177
|
+
body: JSON.stringify(requestBody)
|
|
179
178
|
});
|
|
180
179
|
try {
|
|
181
180
|
const jsonResponse = await response.json();
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
return convertedResponse;
|
|
181
|
+
this._log("Text refine response: ", jsonResponse);
|
|
182
|
+
return jsonResponse;
|
|
185
183
|
} catch (error) {
|
|
186
184
|
this._log("Error parsing response:", error);
|
|
187
185
|
throw new Error("Failed to parse response");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@encatch/api-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.1.0-beta.1",
|
|
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": "
|
|
23
|
+
"@encatch/schema": "1.1.0-beta.7"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"dev": "vite",
|