ugcinc 2.3.0 → 2.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/dist/client.d.ts +5 -0
- package/dist/client.js +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/render.d.ts +76 -0
- package/dist/render.js +89 -0
- package/dist/types.d.ts +137 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { TasksClient } from './tasks';
|
|
|
3
3
|
import { PostsClient } from './posts';
|
|
4
4
|
import { StatsClient } from './stats';
|
|
5
5
|
import { OrganizationClient } from './org';
|
|
6
|
+
import { RenderClient } from './render';
|
|
6
7
|
import type { ClientConfig } from './base';
|
|
7
8
|
/**
|
|
8
9
|
* Main UGC Inc API Client
|
|
@@ -50,5 +51,9 @@ export declare class UGCClient {
|
|
|
50
51
|
* Client for organization operations
|
|
51
52
|
*/
|
|
52
53
|
org: OrganizationClient;
|
|
54
|
+
/**
|
|
55
|
+
* Client for video rendering operations
|
|
56
|
+
*/
|
|
57
|
+
render: RenderClient;
|
|
53
58
|
constructor(config: ClientConfig);
|
|
54
59
|
}
|
package/dist/client.js
CHANGED
|
@@ -6,6 +6,7 @@ const tasks_1 = require("./tasks");
|
|
|
6
6
|
const posts_1 = require("./posts");
|
|
7
7
|
const stats_1 = require("./stats");
|
|
8
8
|
const org_1 = require("./org");
|
|
9
|
+
const render_1 = require("./render");
|
|
9
10
|
/**
|
|
10
11
|
* Main UGC Inc API Client
|
|
11
12
|
*
|
|
@@ -38,6 +39,7 @@ class UGCClient {
|
|
|
38
39
|
this.posts = new posts_1.PostsClient(config);
|
|
39
40
|
this.stats = new stats_1.StatsClient(config);
|
|
40
41
|
this.org = new org_1.OrganizationClient(config);
|
|
42
|
+
this.render = new render_1.RenderClient(config);
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
exports.UGCClient = UGCClient;
|
package/dist/index.d.ts
CHANGED
|
@@ -9,5 +9,6 @@ export { TasksClient } from './tasks';
|
|
|
9
9
|
export { PostsClient } from './posts';
|
|
10
10
|
export { StatsClient } from './stats';
|
|
11
11
|
export { OrganizationClient } from './org';
|
|
12
|
+
export { RenderClient } from './render';
|
|
12
13
|
export type { ClientConfig, } from './base';
|
|
13
|
-
export type { SuccessResponse, ErrorResponse, ApiResponse, Account, AccountStat, AccountTask, EditProfileInfo, Task, TaskType, Post, PostType, PostStat, ApiKey, GetAccountsParams, GetAccountStatsParams, GetAccountStatusParams, UpdateAccountInfoParams, UpdateAccountSocialParams, GetTasksParams, GetPostsParams, CreateSlideshowParams, GetPostStatsParams, GetPostStatusParams, CreateVideoParams, RefreshStatsParams, RefreshStatsResponse, RefreshStatsError, } from './types';
|
|
14
|
+
export type { SuccessResponse, ErrorResponse, ApiResponse, Account, AccountStat, AccountTask, EditProfileInfo, Task, TaskType, Post, PostType, PostStat, ApiKey, EditorConfig, VideoEditorConfig, ImageEditorConfig, EditorChannel, EditorSegment, VideoSegment, AudioSegment, ImageSegment, TextSegment, StaticSegment, RenderJobSubmit, RenderVideoRequest, RenderImageRequest, RenderJobResponse, RenderJobStatus, GetAccountsParams, GetAccountStatsParams, GetAccountStatusParams, UpdateAccountInfoParams, UpdateAccountSocialParams, GetTasksParams, GetPostsParams, CreateSlideshowParams, GetPostStatsParams, GetPostStatusParams, CreateVideoParams, RefreshStatsParams, RefreshStatsResponse, RefreshStatsError, } from './types';
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Official TypeScript/JavaScript client for the UGC Inc API
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.OrganizationClient = exports.StatsClient = exports.PostsClient = exports.TasksClient = exports.AccountsClient = exports.UGCClient = void 0;
|
|
8
|
+
exports.RenderClient = exports.OrganizationClient = exports.StatsClient = exports.PostsClient = exports.TasksClient = exports.AccountsClient = exports.UGCClient = void 0;
|
|
9
9
|
var client_1 = require("./client");
|
|
10
10
|
Object.defineProperty(exports, "UGCClient", { enumerable: true, get: function () { return client_1.UGCClient; } });
|
|
11
11
|
var accounts_1 = require("./accounts");
|
|
@@ -18,3 +18,5 @@ var stats_1 = require("./stats");
|
|
|
18
18
|
Object.defineProperty(exports, "StatsClient", { enumerable: true, get: function () { return stats_1.StatsClient; } });
|
|
19
19
|
var org_1 = require("./org");
|
|
20
20
|
Object.defineProperty(exports, "OrganizationClient", { enumerable: true, get: function () { return org_1.OrganizationClient; } });
|
|
21
|
+
var render_1 = require("./render");
|
|
22
|
+
Object.defineProperty(exports, "RenderClient", { enumerable: true, get: function () { return render_1.RenderClient; } });
|
package/dist/render.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { BaseClient } from './base';
|
|
2
|
+
import type { ApiResponse, RenderJobSubmit, RenderVideoRequest, RenderImageRequest, RenderJobResponse, RenderJobStatus } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Client for video rendering operations
|
|
5
|
+
*/
|
|
6
|
+
export declare class RenderClient extends BaseClient {
|
|
7
|
+
/**
|
|
8
|
+
* Submit a video render job
|
|
9
|
+
* @param params - Video render parameters
|
|
10
|
+
* @returns Job ID and initial status
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const videoJob = await client.render.submitVideo({
|
|
14
|
+
* editor: myVideoEditorConfig, // Can include video/audio/text/image segments
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
submitVideo(params: Omit<RenderVideoRequest, 'output_type'>): Promise<ApiResponse<RenderJobResponse>>;
|
|
19
|
+
/**
|
|
20
|
+
* Submit an image render job (static image with text and images only)
|
|
21
|
+
* @param params - Image render parameters
|
|
22
|
+
* @returns Job ID and initial status
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* const imageJob = await client.render.submitImage({
|
|
26
|
+
* editor: myImageEditorConfig, // Can only include text/image segments
|
|
27
|
+
* image_format: 'png'
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
submitImage(params: Omit<RenderImageRequest, 'output_type'>): Promise<ApiResponse<RenderJobResponse>>;
|
|
32
|
+
/**
|
|
33
|
+
* Submit a render job (generic - use submitVideo or submitImage for type safety)
|
|
34
|
+
* @param params - Render job parameters
|
|
35
|
+
* @returns Job ID and initial status
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* // Less type-safe, prefer submitVideo() or submitImage()
|
|
39
|
+
* const job = await client.render.submit({
|
|
40
|
+
* use_example: true,
|
|
41
|
+
* output_type: 'video'
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* // Poll status separately
|
|
45
|
+
* const status = await client.render.getStatus(job.data.job_id);
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
submit(params: RenderJobSubmit): Promise<ApiResponse<RenderJobResponse>>;
|
|
49
|
+
/**
|
|
50
|
+
* Get the status of a render job
|
|
51
|
+
* @param jobId - The job ID returned from submit()
|
|
52
|
+
* @returns Current job status with progress, stats, and download URL when completed
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* const status = await client.render.getStatus(jobId);
|
|
56
|
+
* if (status.data.status === 'completed') {
|
|
57
|
+
* console.log('Output type:', status.data.output_type); // 'video' or 'image'
|
|
58
|
+
* console.log('Download URL:', status.data.download_url);
|
|
59
|
+
* // Use the download_url to get the file (video or image)
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
getStatus(jobId: string): Promise<ApiResponse<RenderJobStatus>>;
|
|
64
|
+
/**
|
|
65
|
+
* Get the download URL for a completed render job
|
|
66
|
+
* @param jobId - The job ID
|
|
67
|
+
* @returns Download URL that can be used to fetch the file (video or image)
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const url = client.render.getDownloadUrl(jobId);
|
|
71
|
+
* // Use this URL in an <a> tag or to download the file
|
|
72
|
+
* window.location.href = url;
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
getDownloadUrl(jobId: string): string;
|
|
76
|
+
}
|
package/dist/render.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderClient = void 0;
|
|
4
|
+
const base_1 = require("./base");
|
|
5
|
+
/**
|
|
6
|
+
* Client for video rendering operations
|
|
7
|
+
*/
|
|
8
|
+
class RenderClient extends base_1.BaseClient {
|
|
9
|
+
/**
|
|
10
|
+
* Submit a video render job
|
|
11
|
+
* @param params - Video render parameters
|
|
12
|
+
* @returns Job ID and initial status
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const videoJob = await client.render.submitVideo({
|
|
16
|
+
* editor: myVideoEditorConfig, // Can include video/audio/text/image segments
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
async submitVideo(params) {
|
|
21
|
+
return this.post('/render/submit', { ...params, output_type: 'video' });
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Submit an image render job (static image with text and images only)
|
|
25
|
+
* @param params - Image render parameters
|
|
26
|
+
* @returns Job ID and initial status
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* const imageJob = await client.render.submitImage({
|
|
30
|
+
* editor: myImageEditorConfig, // Can only include text/image segments
|
|
31
|
+
* image_format: 'png'
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
async submitImage(params) {
|
|
36
|
+
return this.post('/render/submit', { ...params, output_type: 'image' });
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Submit a render job (generic - use submitVideo or submitImage for type safety)
|
|
40
|
+
* @param params - Render job parameters
|
|
41
|
+
* @returns Job ID and initial status
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* // Less type-safe, prefer submitVideo() or submitImage()
|
|
45
|
+
* const job = await client.render.submit({
|
|
46
|
+
* use_example: true,
|
|
47
|
+
* output_type: 'video'
|
|
48
|
+
* });
|
|
49
|
+
*
|
|
50
|
+
* // Poll status separately
|
|
51
|
+
* const status = await client.render.getStatus(job.data.job_id);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
async submit(params) {
|
|
55
|
+
return this.post('/render/submit', params);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get the status of a render job
|
|
59
|
+
* @param jobId - The job ID returned from submit()
|
|
60
|
+
* @returns Current job status with progress, stats, and download URL when completed
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const status = await client.render.getStatus(jobId);
|
|
64
|
+
* if (status.data.status === 'completed') {
|
|
65
|
+
* console.log('Output type:', status.data.output_type); // 'video' or 'image'
|
|
66
|
+
* console.log('Download URL:', status.data.download_url);
|
|
67
|
+
* // Use the download_url to get the file (video or image)
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
async getStatus(jobId) {
|
|
72
|
+
return this.get(`/render/status?job_id=${jobId}`);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Get the download URL for a completed render job
|
|
76
|
+
* @param jobId - The job ID
|
|
77
|
+
* @returns Download URL that can be used to fetch the file (video or image)
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* const url = client.render.getDownloadUrl(jobId);
|
|
81
|
+
* // Use this URL in an <a> tag or to download the file
|
|
82
|
+
* window.location.href = url;
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
getDownloadUrl(jobId) {
|
|
86
|
+
return `https://api.ugc.inc/render/download?job_id=${jobId}`;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.RenderClient = RenderClient;
|
package/dist/types.d.ts
CHANGED
|
@@ -234,3 +234,140 @@ export interface EditApiKeyParams {
|
|
|
234
234
|
apiKeyId: string;
|
|
235
235
|
name: string;
|
|
236
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Render types
|
|
239
|
+
*/
|
|
240
|
+
interface BaseEditorConfig {
|
|
241
|
+
width: number;
|
|
242
|
+
height: number;
|
|
243
|
+
fps: number;
|
|
244
|
+
duration: number;
|
|
245
|
+
}
|
|
246
|
+
export interface VideoEditorConfig extends BaseEditorConfig {
|
|
247
|
+
channels: Array<{
|
|
248
|
+
id: string;
|
|
249
|
+
segments: EditorSegment[];
|
|
250
|
+
}>;
|
|
251
|
+
}
|
|
252
|
+
export interface ImageEditorConfig extends BaseEditorConfig {
|
|
253
|
+
channels: Array<{
|
|
254
|
+
id: string;
|
|
255
|
+
segments: StaticSegment[];
|
|
256
|
+
}>;
|
|
257
|
+
}
|
|
258
|
+
export interface EditorConfig extends BaseEditorConfig {
|
|
259
|
+
channels: Array<{
|
|
260
|
+
id: string;
|
|
261
|
+
segments: EditorSegment[];
|
|
262
|
+
}>;
|
|
263
|
+
}
|
|
264
|
+
export interface EditorChannel {
|
|
265
|
+
id: string;
|
|
266
|
+
segments: EditorSegment[];
|
|
267
|
+
}
|
|
268
|
+
interface BaseSegmentProps {
|
|
269
|
+
id: string;
|
|
270
|
+
source: string;
|
|
271
|
+
order: number;
|
|
272
|
+
offset: {
|
|
273
|
+
type: 'absolute' | 'relative';
|
|
274
|
+
value: number;
|
|
275
|
+
};
|
|
276
|
+
startTrim?: number;
|
|
277
|
+
endTrim?: number;
|
|
278
|
+
duration?: {
|
|
279
|
+
type: 'absolute' | 'relative';
|
|
280
|
+
value: number;
|
|
281
|
+
};
|
|
282
|
+
xOffset?: number;
|
|
283
|
+
yOffset?: number;
|
|
284
|
+
width?: number;
|
|
285
|
+
height?: number;
|
|
286
|
+
zIndex?: number;
|
|
287
|
+
scale?: number;
|
|
288
|
+
rotation?: number;
|
|
289
|
+
opacity?: number;
|
|
290
|
+
}
|
|
291
|
+
export interface VideoSegment extends BaseSegmentProps {
|
|
292
|
+
type: 'video';
|
|
293
|
+
fit?: 'cover' | 'contain' | 'fill';
|
|
294
|
+
speed?: number;
|
|
295
|
+
volume?: number;
|
|
296
|
+
}
|
|
297
|
+
export interface AudioSegment extends Omit<BaseSegmentProps, 'xOffset' | 'yOffset' | 'width' | 'height' | 'zIndex' | 'scale' | 'rotation' | 'opacity'> {
|
|
298
|
+
type: 'audio';
|
|
299
|
+
volume?: number;
|
|
300
|
+
}
|
|
301
|
+
export interface ImageSegment extends BaseSegmentProps {
|
|
302
|
+
type: 'image';
|
|
303
|
+
fit?: 'cover' | 'contain' | 'fill';
|
|
304
|
+
loop?: boolean;
|
|
305
|
+
}
|
|
306
|
+
export interface TextSegment extends Omit<BaseSegmentProps, 'source'> {
|
|
307
|
+
type: 'text';
|
|
308
|
+
source: '';
|
|
309
|
+
text?: string;
|
|
310
|
+
alignment?: 'left' | 'center' | 'right';
|
|
311
|
+
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
312
|
+
direction?: 'ltr' | 'rtl';
|
|
313
|
+
padding?: number;
|
|
314
|
+
fontType?: string;
|
|
315
|
+
fontSize?: number;
|
|
316
|
+
fontWeight?: string;
|
|
317
|
+
lineHeight?: number;
|
|
318
|
+
letterSpacing?: number;
|
|
319
|
+
textWrap?: string;
|
|
320
|
+
wordBreak?: string;
|
|
321
|
+
color?: string;
|
|
322
|
+
backgroundColor?: string;
|
|
323
|
+
strokeColor?: string;
|
|
324
|
+
strokeWidth?: number;
|
|
325
|
+
}
|
|
326
|
+
export type EditorSegment = VideoSegment | AudioSegment | ImageSegment | TextSegment;
|
|
327
|
+
export type StaticSegment = ImageSegment | TextSegment;
|
|
328
|
+
export interface RenderVideoRequest {
|
|
329
|
+
editor?: VideoEditorConfig;
|
|
330
|
+
use_example?: boolean;
|
|
331
|
+
output_type: 'video';
|
|
332
|
+
}
|
|
333
|
+
export interface RenderImageRequest {
|
|
334
|
+
editor?: ImageEditorConfig;
|
|
335
|
+
use_example?: boolean;
|
|
336
|
+
output_type: 'image';
|
|
337
|
+
image_format?: 'png' | 'jpeg';
|
|
338
|
+
}
|
|
339
|
+
export interface RenderJobSubmit {
|
|
340
|
+
editor?: EditorConfig;
|
|
341
|
+
use_example?: boolean;
|
|
342
|
+
output_type?: 'video' | 'image';
|
|
343
|
+
image_format?: 'png' | 'jpeg';
|
|
344
|
+
}
|
|
345
|
+
export interface RenderJobResponse {
|
|
346
|
+
job_id: string;
|
|
347
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
348
|
+
output_type: 'video' | 'image';
|
|
349
|
+
message: string;
|
|
350
|
+
}
|
|
351
|
+
export interface RenderJobStatus {
|
|
352
|
+
job_id: string;
|
|
353
|
+
status: 'pending' | 'processing' | 'completed' | 'failed';
|
|
354
|
+
output_type: 'video' | 'image';
|
|
355
|
+
progress: number;
|
|
356
|
+
message: string;
|
|
357
|
+
created_at: number;
|
|
358
|
+
updated_at: number;
|
|
359
|
+
download_url?: string;
|
|
360
|
+
video_url?: string;
|
|
361
|
+
size_bytes?: number;
|
|
362
|
+
duration_ms?: number;
|
|
363
|
+
stats?: {
|
|
364
|
+
preload_ms: number;
|
|
365
|
+
audio_ms: number;
|
|
366
|
+
render_ms: number;
|
|
367
|
+
encode_ms: number;
|
|
368
|
+
total_ms: number;
|
|
369
|
+
};
|
|
370
|
+
completed_at?: number;
|
|
371
|
+
error?: string;
|
|
372
|
+
}
|
|
373
|
+
export {};
|