ugcinc 1.0.1 → 1.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/base.js +18 -2
- package/package.json +33 -33
package/dist/base.js
CHANGED
|
@@ -18,8 +18,24 @@ class BaseClient {
|
|
|
18
18
|
...options,
|
|
19
19
|
headers,
|
|
20
20
|
});
|
|
21
|
-
const
|
|
22
|
-
|
|
21
|
+
const rawData = await response.json();
|
|
22
|
+
// Transform server response to match documented API response format
|
|
23
|
+
const isSuccess = response.ok && rawData.code >= 200 && rawData.code < 300;
|
|
24
|
+
if (isSuccess && rawData.data !== undefined) {
|
|
25
|
+
return {
|
|
26
|
+
ok: true,
|
|
27
|
+
code: rawData.code,
|
|
28
|
+
message: rawData.message ?? 'Success',
|
|
29
|
+
data: rawData.data,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return {
|
|
34
|
+
ok: false,
|
|
35
|
+
code: rawData.code,
|
|
36
|
+
message: rawData.message ?? 'Request failed',
|
|
37
|
+
};
|
|
38
|
+
}
|
|
23
39
|
}
|
|
24
40
|
catch (error) {
|
|
25
41
|
return {
|
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ugcinc",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "TypeScript/JavaScript client for the UGC Inc API",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "tsc",
|
|
9
|
-
"prepublishOnly": "npm run build",
|
|
10
|
-
"test": "echo \"No tests specified\" && exit 0"
|
|
11
|
-
},
|
|
12
|
-
"keywords": [
|
|
13
|
-
"ugcinc",
|
|
14
|
-
"api",
|
|
15
|
-
"client",
|
|
16
|
-
"tiktok",
|
|
17
|
-
"automation",
|
|
18
|
-
"social-media",
|
|
19
|
-
"content-management"
|
|
20
|
-
],
|
|
21
|
-
"author": "UGC Inc",
|
|
22
|
-
"license": "MIT",
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@types/node": "^20.0.0",
|
|
25
|
-
"typescript": "^5.0.0"
|
|
26
|
-
},
|
|
27
|
-
"dependencies": {},
|
|
28
|
-
"files": [
|
|
29
|
-
"dist",
|
|
30
|
-
"README.md"
|
|
31
|
-
]
|
|
32
|
-
}
|
|
33
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "ugcinc",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "TypeScript/JavaScript client for the UGC Inc API",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"prepublishOnly": "npm run build",
|
|
10
|
+
"test": "echo \"No tests specified\" && exit 0"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"ugcinc",
|
|
14
|
+
"api",
|
|
15
|
+
"client",
|
|
16
|
+
"tiktok",
|
|
17
|
+
"automation",
|
|
18
|
+
"social-media",
|
|
19
|
+
"content-management"
|
|
20
|
+
],
|
|
21
|
+
"author": "UGC Inc",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^20.0.0",
|
|
25
|
+
"typescript": "^5.0.0"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
|