ugcinc 1.8.0 → 2.2.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
@@ -50,8 +50,12 @@ For complete API documentation, including all endpoints, parameters, and example
50
50
  - Update social profile (avatar, nickname, bio)
51
51
 
52
52
  ### Posts
53
- - Create video posts
54
- - Create slideshow posts
53
+ - Create video posts (with specific account or auto-select)
54
+ - Create slideshow posts (with specific account or auto-select)
55
+ - **Auto-selection modes:**
56
+ - `strict: true` - Picks least recently posted account, must post at exact time
57
+ - `strict: false` - Picks account with closest available time slot
58
+ - Auto-account selection supports filtering by tag, user_group, and org_group
55
59
  - Get post status (includes platform URL when complete - TikTok or Instagram)
56
60
  - Get posts with filters (by accountIds, postIds, date range)
57
61
  - Get post statistics
@@ -132,11 +136,73 @@ if (response.ok) {
132
136
 
133
137
  **Create a video post:**
134
138
  ```typescript
139
+ // Create video post with specific account
135
140
  const response = await client.posts.createVideo({
136
141
  accountId: 'account-uuid',
137
142
  videoUrl: 'https://example.com/video.mp4',
138
143
  caption: 'Check out this video!',
139
144
  });
145
+
146
+ // Auto-select with strict=true: picks least recently posted account, must post at exact time
147
+ const response = await client.posts.createVideo({
148
+ accountId: null,
149
+ videoUrl: 'https://example.com/video.mp4',
150
+ caption: 'Auto-selected account!',
151
+ postTime: '2024-01-15T10:00:00Z',
152
+ strict: true // Will error if that account can't post at exactly 10:00 AM
153
+ });
154
+
155
+ // Auto-select with strict=false: picks account with closest available time slot
156
+ const response = await client.posts.createVideo({
157
+ accountId: null,
158
+ videoUrl: 'https://example.com/video.mp4',
159
+ caption: 'Posts as soon as possible!',
160
+ postTime: '2024-01-15T10:00:00Z',
161
+ strict: false // Finds account that can post closest to 10:00 AM
162
+ });
163
+
164
+ // Auto-select with filters (tag, user_group, org_group)
165
+ const response = await client.posts.createVideo({
166
+ accountId: null,
167
+ videoUrl: 'https://example.com/video.mp4',
168
+ caption: 'Filtered auto-selection!',
169
+ tag: 'production',
170
+ org_group: 'group1',
171
+ strict: false
172
+ });
173
+ ```
174
+
175
+ **Create a slideshow post:**
176
+ ```typescript
177
+ // Create slideshow with specific account
178
+ const response = await client.posts.createSlideshow({
179
+ accountId: 'account-uuid',
180
+ imageUrls: [
181
+ 'https://example.com/image1.jpg',
182
+ 'https://example.com/image2.jpg',
183
+ 'https://example.com/image3.jpg'
184
+ ],
185
+ caption: 'Amazing slideshow!',
186
+ });
187
+
188
+ // Auto-select with strict=true: picks least recently posted account
189
+ const response = await client.posts.createSlideshow({
190
+ accountId: null,
191
+ imageUrls: ['image1.jpg', 'image2.jpg'],
192
+ caption: 'Posts at exact time or errors',
193
+ postTime: '2024-01-15T14:00:00Z',
194
+ strict: true,
195
+ user_group: 'creators'
196
+ });
197
+
198
+ // Auto-select with strict=false: picks account with closest available time
199
+ const response = await client.posts.createSlideshow({
200
+ accountId: null,
201
+ imageUrls: ['image1.jpg', 'image2.jpg'],
202
+ caption: 'Posts at nearest available time',
203
+ postTime: '2024-01-15T14:00:00Z',
204
+ strict: false
205
+ });
140
206
  ```
141
207
 
142
208
  **Get posts with filters:**
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 {
@@ -142,12 +145,15 @@ export interface GetPostsParams {
142
145
  endDate?: string;
143
146
  }
144
147
  export interface CreateSlideshowParams {
145
- accountId: string;
148
+ accountId: string | null;
146
149
  caption?: string;
147
150
  musicPostId?: string;
148
151
  postTime?: string;
149
152
  imageUrls: string[];
150
153
  strict?: boolean;
154
+ tag?: string;
155
+ user_group?: string;
156
+ org_group?: string;
151
157
  }
152
158
  export interface GetPostStatsParams {
153
159
  postIds?: string[];
@@ -158,16 +164,29 @@ export interface GetPostStatusParams {
158
164
  postId: string;
159
165
  }
160
166
  export interface CreateVideoParams {
161
- accountId: string;
167
+ accountId: string | null;
162
168
  caption?: string;
163
169
  musicPostId?: string;
164
170
  postTime?: string;
165
171
  videoUrl: string;
166
172
  strict?: boolean;
173
+ tag?: string;
174
+ user_group?: string;
175
+ org_group?: string;
167
176
  }
168
177
  export interface DeletePostsParams {
169
178
  postIds: string[];
170
179
  }
180
+ export interface DeletePostsResponse {
181
+ deleted: number;
182
+ deleting: number;
183
+ deletedIds: string[];
184
+ deletingIds: string[];
185
+ errors?: Array<{
186
+ postId: string;
187
+ error: string;
188
+ }>;
189
+ }
171
190
  export interface RetryPostsParams {
172
191
  postIds: string[];
173
192
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "1.8.0",
3
+ "version": "2.2.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",