ugcinc 5.3.1 → 5.4.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
@@ -44,7 +44,7 @@ if (res.ok) {
44
44
  - `client.accounts`: list, create, update, troubleshoot, quarantine/release, and manage account lifecycle
45
45
  - `client.posts`: create video/slideshow posts, update them, retry failures, and preview schedule conflicts
46
46
  - `client.media`: upload media, create media records, search profile-picture candidates, search images and videos by keyword (`media.imageSearch`, cursor-paged), manage tags/names, and work with social audio
47
- - `client.stats`: fetch account/post analytics, daily aggregates, top performers, and refresh stats
47
+ - `client.stats`: fetch account/post analytics, daily aggregates, top performers, refresh stats, and check stats freshness
48
48
  - `client.org`: manage organizations, API keys, and integration keys
49
49
  - `client.billing`: inspect subscription state and handle account deactivation, replacements, and refunds
50
50
  - `client.automations`: create, run, publish, export, and monitor automation workflows
@@ -129,6 +129,20 @@ if (page.ok) {
129
129
  }
130
130
  ```
131
131
 
132
+ ## Stats Freshness
133
+
134
+ Post stats refresh on a schedule: accounts that posted in the last 7 days get a full stats
135
+ refresh every 12 hours. `stats.getSyncStatus()` tells you how fresh your stats are.
136
+ `lastSyncedAt` is the time since which every active account has been refreshed (`null` when one
137
+ never has), and `nextSyncAt` is the next scheduled sync:
138
+
139
+ ```typescript
140
+ const status = await client.stats.getSyncStatus();
141
+ if (status.ok) {
142
+ const { lastSyncedAt, nextSyncAt, activeAccounts, currentAccounts, staleAccounts } = status.data;
143
+ }
144
+ ```
145
+
132
146
  ## Caption Overlays
133
147
 
134
148
  Video posts can carry text overlays to display on the video. Pass `captionOverlays` to
package/dist/index.d.ts CHANGED
@@ -33,7 +33,7 @@ export type { ClientConfig } from './base';
33
33
  export type { Account, AccountStatus, AccountStat, AccountTask, QuarantineAccountParams, ReleaseAccountParams, QuarantineAccountResponse, EditProfileInfo, GetAccountsParams, GetAccountStatsParams, GetAccountStatusParams, AccountInfoUpdate, UpdateAccountInfoParams, AccountInfoUpdateResult, UpdateAccountInfoResponse, AccountSocialUpdate, UpdateAccountSocialParams, AccountSocialUpdateResult, UpdateAccountSocialResponse, DeleteAccountPostsParams, DeleteAccountPostsResponse, ResetWarmupParams, ResetWarmupResponse, NicheSwitchUpdate, NicheSwitchParams, NicheSwitchResult, NicheSwitchResponse, CreateAccountInput, CreateAccountsParams, CreateAccountResult, CreateAccountsResponse, TroubleshootFailReason, TroubleshootAccount, TroubleshootParams, } from './accounts';
34
34
  export type { TaskType, Task, GetTasksParams } from './tasks';
35
35
  export type { PostType, PostStatus, Post, PostStat, CaptionOverlay, GetPostsParams, GetPostsPageParams, PostsPage, PostSortField, PostSortDirection, CreateDraftParams, CreateSlideshowParams, GetPostStatsParams, GetPostStatusParams, CreateVideoParams, UpdatePostParams, DeletePostsParams, DeletePostsResponse, RetryPostsParams, SetPostStatusParams, SetPostStatusResponse, PreviewScheduleEntry, PreviewScheduleParams, PreviewScheduleResult, } from './posts';
36
- export type { RefreshStatsParams, RefreshStatsError, RefreshStatsResponse, RefreshStatsProgressResponse, RefreshStartEvent, RefreshProgressEvent, RefreshDoneEvent, RefreshStreamEvent, DailyAggregatedStat, GetDailyAggregatedStatsParams, DailyAccountStat, GetDailyAccountStatsParams, DailyPostStat, GetDailyPostStatsParams, DashboardDailyStat, GetDashboardDailyStatsParams, TopAccount, GetTopAccountsParams, TopPost, GetTopPostsParams, } from './stats';
36
+ export type { RefreshStatsParams, RefreshStatsError, RefreshStatsResponse, RefreshStatsProgressResponse, StatsSyncStatus, RefreshStartEvent, RefreshProgressEvent, RefreshDoneEvent, RefreshStreamEvent, DailyAggregatedStat, GetDailyAggregatedStatsParams, DailyAccountStat, GetDailyAccountStatsParams, DailyPostStat, GetDailyPostStatsParams, DashboardDailyStat, GetDashboardDailyStatsParams, TopAccount, GetTopAccountsParams, TopPost, GetTopPostsParams, } from './stats';
37
37
  export type { Org, ApiKey, DeleteApiKeyParams, EditApiKeyParams, IntegrationKey, IntegrationProvider, UpsertIntegrationKeyParams, DeleteIntegrationKeyParams } from './org';
38
38
  export type { UserMedia, MediaUse, SocialAudio, Media, GetMediaParams, GetSocialAudioParams, UploadMediaParams, UploadMediaResponse, MediaTagUpdate, UpdateMediaTagsParams, MediaTagUpdateResult, UpdateMediaTagsResponse, UpdateMediaTagParams, UpdateMediaNameParams, DeleteMediaParams, DeleteMediaResponse, CreateSocialAudioParams, ImportTextParams, ImportTextResponse, CreateMediaFromUrlParams, GetMediaUseParams, GetMediaUseResponse, FilterMediaParams, FilterMediaResponse, PfpSearchParams, PfpSearchResponse, PfpCandidate, ImageSearchParams, ImageSearchResult, ImageSearchResponse, ImageSearchVideoFormat, } from './media';
39
39
  export type { CommentStatus, Comment, CreateCommentParams, CreateCommentResponse, GetCommentsParams, } from './comments';
package/dist/stats.d.ts CHANGED
@@ -30,6 +30,24 @@ export interface RefreshStatsProgressResponse {
30
30
  totalPosts: number;
31
31
  completedPosts: number;
32
32
  }
33
+ /**
34
+ * How fresh an organization's post stats are. Accounts that posted in the
35
+ * last 7 days get a full stats refresh on every scheduled sync (every 12 hours).
36
+ */
37
+ export interface StatsSyncStatus {
38
+ /** Every active account has had a full stats refresh since this time. Null when one never has. */
39
+ lastSyncedAt: string | null;
40
+ /** The next scheduled sync. Null when it cannot be determined. */
41
+ nextSyncAt: string | null;
42
+ /** The last scheduled sync that ran successfully. */
43
+ lastSweepAt: string | null;
44
+ /** Accounts that posted in the last 7 days. */
45
+ activeAccounts: number;
46
+ /** Active accounts refreshed within the last 14 hours. */
47
+ currentAccounts: number;
48
+ /** Active accounts with no full refresh in the last 26 hours. */
49
+ staleAccounts: number;
50
+ }
33
51
  export interface DailyAggregatedStat {
34
52
  date: Date | string;
35
53
  followers: number;
@@ -386,6 +404,12 @@ export declare class StatsClient extends BaseClient {
386
404
  batchId: string;
387
405
  org_group?: string;
388
406
  }): Promise<ApiResponse<RefreshStatsProgressResponse>>;
407
+ /**
408
+ * Get how fresh the organization's post stats are and when the next scheduled sync runs.
409
+ */
410
+ getSyncStatus(params?: {
411
+ org_group?: string;
412
+ }): Promise<ApiResponse<StatsSyncStatus>>;
389
413
  /**
390
414
  * Refresh stats with NDJSON streaming progress.
391
415
  * Returns the raw Response so the caller can read the stream.
package/dist/stats.js CHANGED
@@ -222,6 +222,17 @@ class StatsClient extends base_1.BaseClient {
222
222
  }
223
223
  return this.get(`/stats/refresh/progress?${searchParams.toString()}`);
224
224
  }
225
+ /**
226
+ * Get how fresh the organization's post stats are and when the next scheduled sync runs.
227
+ */
228
+ async getSyncStatus(params) {
229
+ const searchParams = new URLSearchParams();
230
+ if (params?.org_group) {
231
+ searchParams.set('org_group', params.org_group);
232
+ }
233
+ const query = searchParams.toString();
234
+ return this.get(`/stats/sync-status${query ? `?${query}` : ''}`);
235
+ }
225
236
  /**
226
237
  * Refresh stats with NDJSON streaming progress.
227
238
  * Returns the raw Response so the caller can read the stream.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "5.3.1",
3
+ "version": "5.4.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",