ugcinc 1.0.4 → 1.0.6
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/README.md +107 -19
- package/dist/accounts.d.ts +11 -3
- package/dist/accounts.js +9 -2
- package/dist/posts.d.ts +2 -1
- package/dist/posts.js +2 -1
- package/dist/types.d.ts +7 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ if (response.ok) {
|
|
|
68
68
|
|
|
69
69
|
#### Refresh Account Statistics
|
|
70
70
|
|
|
71
|
-
Fetch live statistics from TikTok API and create new stat records.
|
|
71
|
+
Fetch live statistics from TikTok/Instagram API and create new stat records.
|
|
72
72
|
|
|
73
73
|
```typescript
|
|
74
74
|
const response = await client.accounts.refreshStats({
|
|
@@ -101,19 +101,41 @@ if (response.ok) {
|
|
|
101
101
|
|
|
102
102
|
#### Update Account Info
|
|
103
103
|
|
|
104
|
-
Update account
|
|
104
|
+
Update account metadata (tag, org_group, user_group).
|
|
105
105
|
|
|
106
106
|
```typescript
|
|
107
107
|
const response = await client.accounts.updateInfo({
|
|
108
|
+
accountId: 'account-id',
|
|
109
|
+
tag: 'influencer',
|
|
110
|
+
org_group: 'group1',
|
|
111
|
+
user_group: 'users1'
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
if (response.ok) {
|
|
115
|
+
console.log(response.data.message);
|
|
116
|
+
console.log(response.data.account); // Updated account
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### Update Account Social Profile
|
|
121
|
+
|
|
122
|
+
Update account social profile information (avatar, nickname, bio).
|
|
123
|
+
|
|
124
|
+
**Important:** Nicknames can only be updated once every 7 days.
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
const response = await client.accounts.updateSocial({
|
|
108
128
|
accountId: 'account-id',
|
|
109
129
|
nickName: 'New Name',
|
|
110
130
|
bio: 'New bio text',
|
|
111
|
-
avatarUrl: 'https://example.com/avatar.jpg'
|
|
112
|
-
site: 'https://example.com'
|
|
131
|
+
avatarUrl: 'https://example.com/avatar.jpg'
|
|
113
132
|
});
|
|
114
133
|
|
|
115
134
|
if (response.ok) {
|
|
116
135
|
console.log(response.data.message);
|
|
136
|
+
} else {
|
|
137
|
+
// Error response includes when nickname can be updated again
|
|
138
|
+
console.error(response.message);
|
|
117
139
|
}
|
|
118
140
|
```
|
|
119
141
|
|
|
@@ -220,7 +242,7 @@ if (response.ok) {
|
|
|
220
242
|
|
|
221
243
|
#### Refresh Post Statistics
|
|
222
244
|
|
|
223
|
-
Fetch live statistics from TikTok API and create new stat records.
|
|
245
|
+
Fetch live statistics from TikTok/Instagram API and create new stat records.
|
|
224
246
|
|
|
225
247
|
```typescript
|
|
226
248
|
const response = await client.posts.refreshStats({
|
|
@@ -461,7 +483,7 @@ const response = await client.accounts.getStats({
|
|
|
461
483
|
|
|
462
484
|
#### `client.accounts.refreshStats(params?)`
|
|
463
485
|
|
|
464
|
-
Refresh account statistics by fetching live data from TikTok API.
|
|
486
|
+
Refresh account statistics by fetching live data from TikTok/Instagram API.
|
|
465
487
|
|
|
466
488
|
**Endpoint:** `POST /accounts/stats/refresh`
|
|
467
489
|
|
|
@@ -476,10 +498,10 @@ Refresh account statistics by fetching live data from TikTok API.
|
|
|
476
498
|
|
|
477
499
|
**Returns:** `ApiResponse<AccountStat[]>`
|
|
478
500
|
|
|
479
|
-
Returns an array of newly created AccountStat objects with live data from TikTok. This endpoint fetches fresh statistics directly from the
|
|
501
|
+
Returns an array of newly created AccountStat objects with live data from TikTok or Instagram. This endpoint fetches fresh statistics directly from the platform APIs and creates new stat records in the database. Use this when you need up-to-date metrics instead of historical data. The API automatically determines which platform to query based on the account type.
|
|
480
502
|
|
|
481
503
|
**Key Differences from `getStats()`:**
|
|
482
|
-
- `refreshStats()` fetches **live data** from TikTok API and creates new records
|
|
504
|
+
- `refreshStats()` fetches **live data** from TikTok/Instagram API and creates new records
|
|
483
505
|
- `getStats()` retrieves **historical data** from your database
|
|
484
506
|
|
|
485
507
|
**Example:**
|
|
@@ -556,7 +578,7 @@ const response = await client.accounts.getStatus({
|
|
|
556
578
|
|
|
557
579
|
#### `client.accounts.updateInfo(params)`
|
|
558
580
|
|
|
559
|
-
Update account
|
|
581
|
+
Update account metadata (tag, org_group, user_group).
|
|
560
582
|
|
|
561
583
|
**Endpoint:** `POST /accounts/update-info`
|
|
562
584
|
|
|
@@ -565,15 +587,62 @@ Update account profile information.
|
|
|
565
587
|
| Parameter | Type | Required | Description |
|
|
566
588
|
|-----------|------|----------|-------------|
|
|
567
589
|
| `accountId` | `string` | **Yes** | Account ID to update |
|
|
568
|
-
| `
|
|
590
|
+
| `tag` | `string` | No | New tag value for categorization |
|
|
591
|
+
| `org_group` | `string` | No | New organization group identifier |
|
|
592
|
+
| `user_group` | `string` | No | New user group identifier |
|
|
593
|
+
|
|
594
|
+
**Note:** At least one of `tag`, `org_group`, or `user_group` must be provided.
|
|
595
|
+
|
|
596
|
+
**Returns:** `ApiResponse<{ message: string; account: Account }>`
|
|
597
|
+
|
|
598
|
+
Returns a success message and the updated account object. The update is applied immediately to the database.
|
|
599
|
+
|
|
600
|
+
**Response Object:**
|
|
601
|
+
|
|
602
|
+
```typescript
|
|
603
|
+
{
|
|
604
|
+
message: string; // Success message (e.g., "Account info updated successfully")
|
|
605
|
+
account: Account; // Updated account object with new values
|
|
606
|
+
}
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
**Example:**
|
|
610
|
+
|
|
611
|
+
```typescript
|
|
612
|
+
const response = await client.accounts.updateInfo({
|
|
613
|
+
accountId: 'account-id',
|
|
614
|
+
tag: 'influencer',
|
|
615
|
+
org_group: 'group1',
|
|
616
|
+
user_group: 'users1'
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
if (response.ok) {
|
|
620
|
+
console.log(response.data.account.tag); // 'influencer'
|
|
621
|
+
}
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
---
|
|
625
|
+
|
|
626
|
+
#### `client.accounts.updateSocial(params)`
|
|
627
|
+
|
|
628
|
+
Update account social profile (avatar, nickname, bio).
|
|
629
|
+
|
|
630
|
+
**Endpoint:** `POST /accounts/update-social`
|
|
631
|
+
|
|
632
|
+
**Parameters:**
|
|
633
|
+
|
|
634
|
+
| Parameter | Type | Required | Description |
|
|
635
|
+
|-----------|------|----------|-------------|
|
|
636
|
+
| `accountId` | `string` | **Yes** | Account ID to update |
|
|
569
637
|
| `avatarUrl` | `string` | No | New avatar/profile picture URL |
|
|
570
638
|
| `nickName` | `string` | No | New display name |
|
|
571
639
|
| `bio` | `string` | No | New bio text |
|
|
572
|
-
|
|
640
|
+
|
|
641
|
+
**Important:** Nicknames can only be updated **once every 7 days**. If you attempt to update a nickname before the 7-day period has elapsed, the API will return an error with details about when the next update is allowed.
|
|
573
642
|
|
|
574
643
|
**Returns:** `ApiResponse<{ message: string }>`
|
|
575
644
|
|
|
576
|
-
Returns a success message when the profile update task has been successfully created and queued. The actual profile update will be processed asynchronously.
|
|
645
|
+
Returns a success message when the profile update task has been successfully created and queued. The actual profile update will be processed asynchronously through the GeeLark API.
|
|
577
646
|
|
|
578
647
|
**Response Object:**
|
|
579
648
|
|
|
@@ -583,15 +652,34 @@ Returns a success message when the profile update task has been successfully cre
|
|
|
583
652
|
}
|
|
584
653
|
```
|
|
585
654
|
|
|
655
|
+
**Error Response (Nickname Restriction):**
|
|
656
|
+
|
|
657
|
+
If you attempt to update the nickname too soon:
|
|
658
|
+
|
|
659
|
+
```typescript
|
|
660
|
+
{
|
|
661
|
+
ok: false,
|
|
662
|
+
code: 400,
|
|
663
|
+
message: "Nickname can only be updated once every 7 days. Last update was X days ago. You can update again in Y day(s) on YYYY-MM-DD"
|
|
664
|
+
}
|
|
665
|
+
```
|
|
666
|
+
|
|
586
667
|
**Example:**
|
|
587
668
|
|
|
588
669
|
```typescript
|
|
589
|
-
const response = await client.accounts.
|
|
670
|
+
const response = await client.accounts.updateSocial({
|
|
590
671
|
accountId: 'account-id',
|
|
591
672
|
nickName: 'Cool Creator',
|
|
592
673
|
bio: 'Content creator 🎥',
|
|
593
674
|
avatarUrl: 'https://storage.example.com/avatar.jpg'
|
|
594
675
|
});
|
|
676
|
+
|
|
677
|
+
if (response.ok) {
|
|
678
|
+
console.log(response.data.message);
|
|
679
|
+
} else {
|
|
680
|
+
// Handle nickname restriction error
|
|
681
|
+
console.error(response.message);
|
|
682
|
+
}
|
|
595
683
|
```
|
|
596
684
|
|
|
597
685
|
---
|
|
@@ -687,7 +775,7 @@ Returns an array of Post objects (videos and slideshows) for the specified accou
|
|
|
687
775
|
account_id: string; // Account that posted this
|
|
688
776
|
type: 'video' | 'slideshow'; // Post type
|
|
689
777
|
status: string; // Current post status
|
|
690
|
-
|
|
778
|
+
social_id: string | null; // Platform post ID (TikTok video ID or Instagram reel code)
|
|
691
779
|
caption: string | null; // Post caption/description
|
|
692
780
|
media_urls: string[] | null; // URLs to media files
|
|
693
781
|
music_post_id: string | null; // Associated music/audio ID
|
|
@@ -700,7 +788,7 @@ Returns an array of Post objects (videos and slideshows) for the specified accou
|
|
|
700
788
|
| `account_id` | `string` | ID of the account that created this post |
|
|
701
789
|
| `type` | `'video' \| 'slideshow'` | Type of post content |
|
|
702
790
|
| `status` | `string` | Current status: `'scheduled'`, `'pending'`, `'complete'`, or `'failed'` |
|
|
703
|
-
| `
|
|
791
|
+
| `social_id` | `string \| null` | Platform-specific post ID (TikTok video ID or Instagram reel code, available after posting) |
|
|
704
792
|
| `caption` | `string \| null` | Post caption/description text (max 500 characters) |
|
|
705
793
|
| `media_urls` | `string[] \| null` | Array of URLs to video/image files used in the post |
|
|
706
794
|
| `music_post_id` | `string \| null` | ID of the music/audio track used in the post |
|
|
@@ -855,7 +943,7 @@ if (response.ok) {
|
|
|
855
943
|
|
|
856
944
|
#### `client.posts.refreshStats(params?)`
|
|
857
945
|
|
|
858
|
-
Refresh post statistics by fetching live data from TikTok API.
|
|
946
|
+
Refresh post statistics by fetching live data from TikTok/Instagram API.
|
|
859
947
|
|
|
860
948
|
**Endpoint:** `POST /post/stats/refresh`
|
|
861
949
|
|
|
@@ -867,13 +955,13 @@ Refresh post statistics by fetching live data from TikTok API.
|
|
|
867
955
|
|
|
868
956
|
**Returns:** `ApiResponse<PostStat[]>`
|
|
869
957
|
|
|
870
|
-
Returns an array of newly created PostStat objects with live data from TikTok. This endpoint fetches fresh statistics directly from the
|
|
958
|
+
Returns an array of newly created PostStat objects with live data from TikTok or Instagram. This endpoint fetches fresh statistics directly from the platform APIs and creates new stat records in the database. Use this when you need up-to-date engagement metrics instead of historical data. The API automatically determines which platform to query based on the account type.
|
|
871
959
|
|
|
872
960
|
**Key Differences from `getStats()`:**
|
|
873
|
-
- `refreshStats()` fetches **live data** from TikTok API and creates new records
|
|
961
|
+
- `refreshStats()` fetches **live data** from TikTok/Instagram API and creates new records
|
|
874
962
|
- `getStats()` retrieves **historical data** from your database
|
|
875
963
|
|
|
876
|
-
**Important:** Posts must have a valid `
|
|
964
|
+
**Important:** Posts must have a valid `social_id` (TikTok video ID or Instagram reel code) to refresh statistics. The endpoint uses this ID to fetch live metrics from the platform.
|
|
877
965
|
|
|
878
966
|
**Example:**
|
|
879
967
|
|
package/dist/accounts.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseClient } from './base';
|
|
2
|
-
import type { Account, AccountStat, AccountTask, GetAccountsParams, GetAccountStatsParams, RefreshAccountStatsParams, GetAccountStatusParams, UpdateAccountInfoParams, ApiResponse } from './types';
|
|
2
|
+
import type { Account, AccountStat, AccountTask, GetAccountsParams, GetAccountStatsParams, RefreshAccountStatsParams, GetAccountStatusParams, UpdateAccountInfoParams, UpdateAccountSocialParams, ApiResponse } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Client for managing accounts
|
|
5
5
|
*/
|
|
@@ -13,7 +13,7 @@ export declare class AccountsClient extends BaseClient {
|
|
|
13
13
|
*/
|
|
14
14
|
getStats(params?: GetAccountStatsParams): Promise<ApiResponse<AccountStat[]>>;
|
|
15
15
|
/**
|
|
16
|
-
* Refresh account statistics from TikTok API
|
|
16
|
+
* Refresh account statistics from TikTok/Instagram API
|
|
17
17
|
*/
|
|
18
18
|
refreshStats(params?: RefreshAccountStatsParams): Promise<ApiResponse<AccountStat[]>>;
|
|
19
19
|
/**
|
|
@@ -21,9 +21,17 @@ export declare class AccountsClient extends BaseClient {
|
|
|
21
21
|
*/
|
|
22
22
|
getStatus(params: GetAccountStatusParams): Promise<ApiResponse<AccountTask[]>>;
|
|
23
23
|
/**
|
|
24
|
-
* Update account
|
|
24
|
+
* Update account metadata (tag, org_group, user_group)
|
|
25
25
|
*/
|
|
26
26
|
updateInfo(params: UpdateAccountInfoParams): Promise<ApiResponse<{
|
|
27
27
|
message: string;
|
|
28
|
+
account: Account;
|
|
29
|
+
}>>;
|
|
30
|
+
/**
|
|
31
|
+
* Update account social profile (avatar, nickname, bio)
|
|
32
|
+
* Note: Nickname can only be updated once every 7 days
|
|
33
|
+
*/
|
|
34
|
+
updateSocial(params: UpdateAccountSocialParams): Promise<ApiResponse<{
|
|
35
|
+
message: string;
|
|
28
36
|
}>>;
|
|
29
37
|
}
|
package/dist/accounts.js
CHANGED
|
@@ -19,7 +19,7 @@ class AccountsClient extends base_1.BaseClient {
|
|
|
19
19
|
return this.post('/accounts/stats', params ?? {});
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Refresh account statistics from TikTok API
|
|
22
|
+
* Refresh account statistics from TikTok/Instagram API
|
|
23
23
|
*/
|
|
24
24
|
async refreshStats(params) {
|
|
25
25
|
return this.post('/accounts/stats/refresh', params ?? {});
|
|
@@ -31,10 +31,17 @@ class AccountsClient extends base_1.BaseClient {
|
|
|
31
31
|
return this.post('/accounts/status', params);
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Update account
|
|
34
|
+
* Update account metadata (tag, org_group, user_group)
|
|
35
35
|
*/
|
|
36
36
|
async updateInfo(params) {
|
|
37
37
|
return this.post('/accounts/update-info', params);
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Update account social profile (avatar, nickname, bio)
|
|
41
|
+
* Note: Nickname can only be updated once every 7 days
|
|
42
|
+
*/
|
|
43
|
+
async updateSocial(params) {
|
|
44
|
+
return this.post('/accounts/update-social', params);
|
|
45
|
+
}
|
|
39
46
|
}
|
|
40
47
|
exports.AccountsClient = AccountsClient;
|
package/dist/posts.d.ts
CHANGED
|
@@ -17,7 +17,8 @@ export declare class PostsClient extends BaseClient {
|
|
|
17
17
|
*/
|
|
18
18
|
getStats(params?: GetPostStatsParams): Promise<ApiResponse<PostStat[]>>;
|
|
19
19
|
/**
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
* Refresh post statistics from TikTok/Instagram API
|
|
21
22
|
*/
|
|
22
23
|
refreshStats(params?: RefreshPostStatsParams): Promise<ApiResponse<PostStat[]>>;
|
|
23
24
|
/**
|
package/dist/posts.js
CHANGED
|
@@ -25,7 +25,8 @@ class PostsClient extends base_1.BaseClient {
|
|
|
25
25
|
return this.post('/post/stats', params ?? {});
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
|
|
28
|
+
|
|
29
|
+
* Refresh post statistics from TikTok/Instagram API
|
|
29
30
|
*/
|
|
30
31
|
async refreshStats(params) {
|
|
31
32
|
return this.post('/post/stats/refresh', params ?? {});
|
package/dist/types.d.ts
CHANGED
|
@@ -49,7 +49,6 @@ export interface EditProfileInfo {
|
|
|
49
49
|
avatarUrl?: string;
|
|
50
50
|
nickName?: string;
|
|
51
51
|
bio?: string;
|
|
52
|
-
site?: string;
|
|
53
52
|
}
|
|
54
53
|
/**
|
|
55
54
|
* Task types
|
|
@@ -75,7 +74,7 @@ export interface Post {
|
|
|
75
74
|
account_id: string;
|
|
76
75
|
type: PostType;
|
|
77
76
|
status: string;
|
|
78
|
-
|
|
77
|
+
social_id: string | null;
|
|
79
78
|
caption: string | null;
|
|
80
79
|
media_urls: string[] | null;
|
|
81
80
|
music_post_id: string | null;
|
|
@@ -118,11 +117,15 @@ export interface GetAccountStatusParams {
|
|
|
118
117
|
}
|
|
119
118
|
export interface UpdateAccountInfoParams {
|
|
120
119
|
accountId: string;
|
|
121
|
-
|
|
120
|
+
tag?: string;
|
|
121
|
+
org_group?: string;
|
|
122
|
+
user_group?: string;
|
|
123
|
+
}
|
|
124
|
+
export interface UpdateAccountSocialParams {
|
|
125
|
+
accountId: string;
|
|
122
126
|
avatarUrl?: string;
|
|
123
127
|
nickName?: string;
|
|
124
128
|
bio?: string;
|
|
125
|
-
site?: string;
|
|
126
129
|
}
|
|
127
130
|
export interface GetTasksParams {
|
|
128
131
|
accountIds?: string[];
|