ugcinc 2.2.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/types.d.ts CHANGED
@@ -132,6 +132,18 @@ export interface UpdateAccountSocialParams {
132
132
  nickName?: string;
133
133
  bio?: string;
134
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
+ }
135
147
  export interface GetTasksParams {
136
148
  accountIds?: string[];
137
149
  startDate?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "2.2.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",