ugcinc 4.6.2 → 4.7.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 +20 -1
- package/dist/accounts.d.ts +7 -0
- package/dist/accounts.js +3 -0
- package/dist/base.js +1 -0
- package/dist/posts.d.ts +9 -0
- package/dist/posts.js +3 -0
- package/dist/stats.d.ts +6 -0
- package/dist/tools/accounts.js +2 -0
- package/dist/tools/posts.js +2 -0
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ All client methods return the same response envelope:
|
|
|
58
58
|
|
|
59
59
|
```typescript
|
|
60
60
|
type ApiResponse<T> =
|
|
61
|
-
| { ok: true; code: 200; message: string; data: T }
|
|
61
|
+
| { ok: true; code: 200; message: string; data: T; nextCursor?: string | null }
|
|
62
62
|
| { ok: false; code: number; message: string };
|
|
63
63
|
```
|
|
64
64
|
|
|
@@ -74,6 +74,25 @@ if (posts.ok) {
|
|
|
74
74
|
}
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
## Pagination
|
|
78
|
+
|
|
79
|
+
`accounts.getAccounts()` and `posts.getPosts()` support keyset pagination via `limit`/`cursor`.
|
|
80
|
+
Omit `limit` to fetch everything matching your filters (the default, unpaginated behavior); pass
|
|
81
|
+
`limit` to page through results newest-first, using each response's `nextCursor` to fetch the next
|
|
82
|
+
page (`null`/absent means there are no more pages):
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
let cursor: string | undefined;
|
|
86
|
+
const allPosts = [];
|
|
87
|
+
|
|
88
|
+
do {
|
|
89
|
+
const res = await client.posts.getPosts({ limit: 100, cursor });
|
|
90
|
+
if (!res.ok) break;
|
|
91
|
+
allPosts.push(...res.data);
|
|
92
|
+
cursor = res.nextCursor ?? undefined;
|
|
93
|
+
} while (cursor);
|
|
94
|
+
```
|
|
95
|
+
|
|
77
96
|
## Useful Exports
|
|
78
97
|
|
|
79
98
|
- `UGCClient` for API access
|
package/dist/accounts.d.ts
CHANGED
|
@@ -74,6 +74,10 @@ export interface GetAccountsParams {
|
|
|
74
74
|
org_group?: string;
|
|
75
75
|
user_group?: string;
|
|
76
76
|
status?: 'uninitialized' | 'pending' | 'initialized' | 'setup' | 'warming' | 'warmed' | 'needs_replacement' | 'replacing' | 'failed' | 'deleted' | 'reclaimed';
|
|
77
|
+
/** Max rows to return. Omit to fetch all matching accounts (no pagination). */
|
|
78
|
+
limit?: number;
|
|
79
|
+
/** Opaque cursor from a previous response's `nextCursor`, to fetch the next page. */
|
|
80
|
+
cursor?: string;
|
|
77
81
|
}
|
|
78
82
|
export interface GetAccountStatsParams {
|
|
79
83
|
accountIds?: string[];
|
|
@@ -239,6 +243,9 @@ export interface TroubleshootParams {
|
|
|
239
243
|
export declare class AccountsClient extends BaseClient {
|
|
240
244
|
/**
|
|
241
245
|
* Get accounts with optional filters
|
|
246
|
+
*
|
|
247
|
+
* Pass `limit` to paginate; the response's `nextCursor` (when present) can be
|
|
248
|
+
* passed back as `cursor` to fetch the next page, ordered newest-first.
|
|
242
249
|
*/
|
|
243
250
|
getAccounts(params?: GetAccountsParams): Promise<ApiResponse<Account[]>>;
|
|
244
251
|
/**
|
package/dist/accounts.js
CHANGED
|
@@ -8,6 +8,9 @@ const base_1 = require("./base");
|
|
|
8
8
|
class AccountsClient extends base_1.BaseClient {
|
|
9
9
|
/**
|
|
10
10
|
* Get accounts with optional filters
|
|
11
|
+
*
|
|
12
|
+
* Pass `limit` to paginate; the response's `nextCursor` (when present) can be
|
|
13
|
+
* passed back as `cursor` to fetch the next page, ordered newest-first.
|
|
11
14
|
*/
|
|
12
15
|
async getAccounts(params) {
|
|
13
16
|
return this.post('/accounts', params ?? {});
|
package/dist/base.js
CHANGED
package/dist/posts.d.ts
CHANGED
|
@@ -31,6 +31,11 @@ export interface GetPostsParams {
|
|
|
31
31
|
postIds?: string[];
|
|
32
32
|
startDate?: string;
|
|
33
33
|
endDate?: string;
|
|
34
|
+
includeHidden?: boolean;
|
|
35
|
+
/** Max rows to return. Omit to fetch all matching posts (no pagination). */
|
|
36
|
+
limit?: number;
|
|
37
|
+
/** Opaque cursor from a previous response's `nextCursor`, to fetch the next page. */
|
|
38
|
+
cursor?: string;
|
|
34
39
|
}
|
|
35
40
|
export interface CreateSlideshowParams {
|
|
36
41
|
accountId: string | null;
|
|
@@ -49,6 +54,7 @@ export interface GetPostStatsParams {
|
|
|
49
54
|
postIds?: string[];
|
|
50
55
|
startDate?: string;
|
|
51
56
|
endDate?: string;
|
|
57
|
+
includeHidden?: boolean;
|
|
52
58
|
}
|
|
53
59
|
export interface GetPostStatusParams {
|
|
54
60
|
postId: string;
|
|
@@ -129,6 +135,9 @@ export interface PreviewScheduleResult {
|
|
|
129
135
|
export declare class PostsClient extends BaseClient {
|
|
130
136
|
/**
|
|
131
137
|
* Get posts with optional filters
|
|
138
|
+
*
|
|
139
|
+
* Pass `limit` to paginate; the response's `nextCursor` (when present) can be
|
|
140
|
+
* passed back as `cursor` to fetch the next page, ordered newest-first.
|
|
132
141
|
*/
|
|
133
142
|
getPosts(params?: GetPostsParams): Promise<ApiResponse<Post[]>>;
|
|
134
143
|
/**
|
package/dist/posts.js
CHANGED
|
@@ -8,6 +8,9 @@ const base_1 = require("./base");
|
|
|
8
8
|
class PostsClient extends base_1.BaseClient {
|
|
9
9
|
/**
|
|
10
10
|
* Get posts with optional filters
|
|
11
|
+
*
|
|
12
|
+
* Pass `limit` to paginate; the response's `nextCursor` (when present) can be
|
|
13
|
+
* passed back as `cursor` to fetch the next page, ordered newest-first.
|
|
11
14
|
*/
|
|
12
15
|
async getPosts(params) {
|
|
13
16
|
return this.post('/post', params ?? {});
|
package/dist/stats.d.ts
CHANGED
|
@@ -140,6 +140,9 @@ export interface GetTopAccountsParams {
|
|
|
140
140
|
tag?: string;
|
|
141
141
|
org_group?: string;
|
|
142
142
|
user_group?: string;
|
|
143
|
+
/** Optional ISO date window. When provided, ranks accounts by their latest stat within the range instead of all-time. */
|
|
144
|
+
startDate?: string;
|
|
145
|
+
endDate?: string;
|
|
143
146
|
}
|
|
144
147
|
export interface TopPost {
|
|
145
148
|
post_id: string;
|
|
@@ -158,6 +161,9 @@ export interface GetTopPostsParams {
|
|
|
158
161
|
metric: 'views' | 'likes' | 'comments' | 'shares';
|
|
159
162
|
limit?: number;
|
|
160
163
|
postIds?: string[];
|
|
164
|
+
/** Optional ISO date window. When provided, ranks posts by their latest stat within the range instead of all-time. */
|
|
165
|
+
startDate?: string;
|
|
166
|
+
endDate?: string;
|
|
161
167
|
}
|
|
162
168
|
export interface RefreshStartEvent {
|
|
163
169
|
type: 'start';
|
package/dist/tools/accounts.js
CHANGED
|
@@ -11,6 +11,8 @@ exports.accountTools = [
|
|
|
11
11
|
org_group: zod_1.z.string().optional().describe('Filter by org group'),
|
|
12
12
|
user_group: zod_1.z.string().optional().describe('Filter by user group'),
|
|
13
13
|
status: zod_1.z.enum(['uninitialized', 'pending', 'initialized', 'setup', 'warming', 'warmed', 'needs_replacement', 'replacing', 'failed', 'deleted']).optional().describe('Filter by account status'),
|
|
14
|
+
limit: zod_1.z.number().optional().describe('Max rows to return, for pagination'),
|
|
15
|
+
cursor: zod_1.z.string().optional().describe('Opaque cursor from a previous response\'s nextCursor, to fetch the next page'),
|
|
14
16
|
}).optional().describe('Optional filters'),
|
|
15
17
|
execute: async (client, params) => {
|
|
16
18
|
return client.accounts.getAccounts(params ?? undefined);
|
package/dist/tools/posts.js
CHANGED
|
@@ -11,6 +11,8 @@ exports.postTools = [
|
|
|
11
11
|
postIds: zod_1.z.array(zod_1.z.string()).optional().describe('Filter by specific post IDs'),
|
|
12
12
|
startDate: zod_1.z.string().optional().describe('Start date (ISO 8601)'),
|
|
13
13
|
endDate: zod_1.z.string().optional().describe('End date (ISO 8601)'),
|
|
14
|
+
limit: zod_1.z.number().optional().describe('Max rows to return, for pagination'),
|
|
15
|
+
cursor: zod_1.z.string().optional().describe('Opaque cursor from a previous response\'s nextCursor, to fetch the next page'),
|
|
14
16
|
}).optional(),
|
|
15
17
|
execute: async (client, params) => {
|
|
16
18
|
return client.posts.getPosts(params ?? undefined);
|
package/dist/types.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export interface SuccessResponse<T> {
|
|
|
6
6
|
message: string;
|
|
7
7
|
data: T;
|
|
8
8
|
ok: true;
|
|
9
|
+
/** Present on keyset-paginated endpoints (see `limit`/`cursor` params). Pass back as `cursor` to fetch the next page; `null`/absent means no more pages. */
|
|
10
|
+
nextCursor?: string | null;
|
|
9
11
|
}
|
|
10
12
|
export interface ErrorResponse {
|
|
11
13
|
code: number;
|