ugcinc 2.1.0 → 2.3.0

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 CHANGED
@@ -48,6 +48,7 @@ For complete API documentation, including all endpoints, parameters, and example
48
48
  - Get account status (tasks)
49
49
  - Update account info (tags, groups)
50
50
  - Update social profile (avatar, nickname, bio)
51
+ - Delete all posts from accounts (automated batch deletion)
51
52
 
52
53
  ### Posts
53
54
  - Create video posts (with specific account or auto-select)
@@ -102,6 +103,42 @@ if (response.ok) {
102
103
  }
103
104
  ```
104
105
 
106
+ **Delete all posts from accounts:**
107
+ ```typescript
108
+ // Delete all posts from one or more accounts
109
+ // This creates a clear_posts task that automatically:
110
+ // - Finds all complete posts with a social_id
111
+ // - Deletes them one by one from the platform
112
+ // - Verifies each deletion using the platform API
113
+ // - Continues until all posts are deleted
114
+ const response = await client.accounts.deleteAllPosts({
115
+ accountIds: ['account-uuid-1', 'account-uuid-2']
116
+ });
117
+
118
+ if (response.ok) {
119
+ console.log(`Deletion scheduled for ${response.data.successful} account(s)`);
120
+
121
+ if (response.data.failed > 0) {
122
+ console.log(`Failed for ${response.data.failed} account(s)`);
123
+ response.data.errors?.forEach(err => {
124
+ console.log(` - ${err.accountId}: ${err.error}`);
125
+ });
126
+ }
127
+ }
128
+
129
+ // Monitor deletion progress using account status
130
+ const statusResponse = await client.accounts.getStatus({
131
+ accountIds: ['account-uuid-1']
132
+ });
133
+
134
+ if (statusResponse.ok) {
135
+ const clearPostsTask = statusResponse.data.find(task => task.type === 'clear_posts');
136
+ if (clearPostsTask) {
137
+ console.log(`Deletion task status: ${clearPostsTask.status}`);
138
+ }
139
+ }
140
+ ```
141
+
105
142
  **Get your organization's API keys:**
106
143
  ```typescript
107
144
  const response = await client.org.getApiKeys(); // POST /org/api-key
@@ -1,5 +1,5 @@
1
1
  import { BaseClient } from './base';
2
- import type { Account, AccountTask, GetAccountsParams, GetAccountStatusParams, UpdateAccountInfoParams, UpdateAccountSocialParams, ApiResponse } from './types';
2
+ import type { Account, AccountTask, GetAccountsParams, GetAccountStatusParams, UpdateAccountInfoParams, UpdateAccountSocialParams, DeleteAccountPostsParams, DeleteAccountPostsResponse, ApiResponse } from './types';
3
3
  /**
4
4
  * Client for managing accounts
5
5
  */
@@ -26,4 +26,10 @@ export declare class AccountsClient extends BaseClient {
26
26
  updateSocial(params: UpdateAccountSocialParams): Promise<ApiResponse<{
27
27
  message: string;
28
28
  }>>;
29
+ /**
30
+ * Delete all posts from one or more accounts
31
+ * Creates a clear_posts task that automatically deletes all posts from the account(s)
32
+ * Posts are deleted one by one and verified using the platform API
33
+ */
34
+ deleteAllPosts(params: DeleteAccountPostsParams): Promise<ApiResponse<DeleteAccountPostsResponse>>;
29
35
  }
package/dist/accounts.js CHANGED
@@ -31,5 +31,13 @@ class AccountsClient extends base_1.BaseClient {
31
31
  async updateSocial(params) {
32
32
  return this.post('/accounts/update-social', params);
33
33
  }
34
+ /**
35
+ * Delete all posts from one or more accounts
36
+ * Creates a clear_posts task that automatically deletes all posts from the account(s)
37
+ * Posts are deleted one by one and verified using the platform API
38
+ */
39
+ async deleteAllPosts(params) {
40
+ return this.post('/accounts/delete-posts', params);
41
+ }
34
42
  }
35
43
  exports.AccountsClient = AccountsClient;
package/dist/posts.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BaseClient } from './base';
2
- import type { Post, GetPostsParams, CreateSlideshowParams, GetPostStatusParams, CreateVideoParams, DeletePostsParams, RetryPostsParams, ApiResponse } from './types';
2
+ import type { Post, GetPostsParams, CreateSlideshowParams, GetPostStatusParams, CreateVideoParams, DeletePostsParams, DeletePostsResponse, RetryPostsParams, ApiResponse } from './types';
3
3
  /**
4
4
  * Client for managing posts
5
5
  */
@@ -26,12 +26,15 @@ export declare class PostsClient extends BaseClient {
26
26
  createVideo(params: CreateVideoParams): Promise<ApiResponse<Post>>;
27
27
  /**
28
28
  * Delete posts
29
- * Note: Posts with status "complete" (already posted) cannot be deleted
29
+ *
30
+ * Handles both unpublished and published posts:
31
+ * - Unpublished posts (scheduled, pending, failed, retrying) are deleted immediately
32
+ * - Published posts (complete) trigger a deletion flow that removes the post from the social platform
33
+ *
34
+ * For published posts being deleted, the status changes to "deleting" and then "deleted" once complete.
35
+ * Monitor deletion progress using getStatus().
30
36
  */
31
- deletePosts(params: DeletePostsParams): Promise<ApiResponse<{
32
- deleted: number;
33
- ids: string[];
34
- }>>;
37
+ deletePosts(params: DeletePostsParams): Promise<ApiResponse<DeletePostsResponse>>;
35
38
  /**
36
39
  * Retry failed posts
37
40
  * Note: Only posts with status "failed" can be retried
package/dist/posts.js CHANGED
@@ -32,7 +32,13 @@ class PostsClient extends base_1.BaseClient {
32
32
  }
33
33
  /**
34
34
  * Delete posts
35
- * Note: Posts with status "complete" (already posted) cannot be deleted
35
+ *
36
+ * Handles both unpublished and published posts:
37
+ * - Unpublished posts (scheduled, pending, failed, retrying) are deleted immediately
38
+ * - Published posts (complete) trigger a deletion flow that removes the post from the social platform
39
+ *
40
+ * For published posts being deleted, the status changes to "deleting" and then "deleted" once complete.
41
+ * Monitor deletion progress using getStatus().
36
42
  */
37
43
  async deletePosts(params) {
38
44
  return this.post('/post/delete', params);
package/dist/types.d.ts CHANGED
@@ -30,6 +30,9 @@ export interface Account {
30
30
  warmup_enabled: boolean | null;
31
31
  keywords: string | null;
32
32
  profiles: string | null;
33
+ niches: string | null;
34
+ age_range: string | null;
35
+ sex: string | null;
33
36
  status: 'pending' | 'initialized' | 'setup' | 'error';
34
37
  }
35
38
  export interface AccountStat {
@@ -129,6 +132,18 @@ export interface UpdateAccountSocialParams {
129
132
  nickName?: string;
130
133
  bio?: string;
131
134
  }
135
+ export interface DeleteAccountPostsParams {
136
+ accountIds: string[];
137
+ }
138
+ export interface DeleteAccountPostsResponse {
139
+ message: string;
140
+ successful: number;
141
+ failed: number;
142
+ errors?: Array<{
143
+ accountId: string;
144
+ error: string;
145
+ }>;
146
+ }
132
147
  export interface GetTasksParams {
133
148
  accountIds?: string[];
134
149
  startDate?: string;
@@ -174,6 +189,16 @@ export interface CreateVideoParams {
174
189
  export interface DeletePostsParams {
175
190
  postIds: string[];
176
191
  }
192
+ export interface DeletePostsResponse {
193
+ deleted: number;
194
+ deleting: number;
195
+ deletedIds: string[];
196
+ deletingIds: string[];
197
+ errors?: Array<{
198
+ postId: string;
199
+ error: string;
200
+ }>;
201
+ }
177
202
  export interface RetryPostsParams {
178
203
  postIds: string[];
179
204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",