ugcinc 2.4.1 → 2.4.3

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.
Files changed (2) hide show
  1. package/README.md +124 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -77,6 +77,13 @@ For complete API documentation, including all endpoints, parameters, and example
77
77
  - Delete API keys
78
78
  - Edit API key names
79
79
 
80
+ ### Render
81
+ - Render videos from editor configurations (supports video, audio, text, image segments)
82
+ - Render static images from editor configurations (supports text and image segments only)
83
+ - Check render job status
84
+ - Download rendered files (MP4 for videos, PNG/JPEG for images)
85
+ - Type-safe methods enforce correct segment types at compile time
86
+
80
87
  ### Examples
81
88
 
82
89
  **Get accounts with filters:**
@@ -305,6 +312,123 @@ if (response.ok) {
305
312
  }
306
313
  ```
307
314
 
315
+ **Render a video:**
316
+ ```typescript
317
+ // Submit a video render job
318
+ const videoJob = await client.render.renderVideo({
319
+ editor: {
320
+ width: 1080,
321
+ height: 1920,
322
+ fps: 30,
323
+ duration: 5000,
324
+ channels: [
325
+ {
326
+ id: 'background',
327
+ segments: [
328
+ {
329
+ id: 'bg-video',
330
+ type: 'video', // All segment types allowed for video
331
+ source: 'https://example.com/video.mp4',
332
+ order: 0,
333
+ offset: { type: 'absolute', value: 0 },
334
+ xOffset: 0,
335
+ yOffset: 0,
336
+ width: 1080,
337
+ height: 1920
338
+ }
339
+ ]
340
+ },
341
+ {
342
+ id: 'text-layer',
343
+ segments: [
344
+ {
345
+ id: 'title',
346
+ type: 'text',
347
+ source: '',
348
+ text: 'My Video',
349
+ order: 0,
350
+ offset: { type: 'absolute', value: 0 },
351
+ fontSize: 80,
352
+ color: '#FFFFFF'
353
+ }
354
+ ]
355
+ }
356
+ ]
357
+ }
358
+ });
359
+
360
+ // Poll for completion
361
+ let status;
362
+ do {
363
+ await new Promise(resolve => setTimeout(resolve, 5000)); // Wait 5 seconds
364
+ const statusResponse = await client.render.getStatus(videoJob.data.job_id);
365
+ if (statusResponse.ok) {
366
+ status = statusResponse.data;
367
+ console.log(`Status: ${status.status} - ${status.message}`);
368
+ }
369
+ } while (status?.status === 'pending' || status?.status === 'processing');
370
+
371
+ if (status?.status === 'completed') {
372
+ console.log('Video ready:', status.download_url);
373
+ }
374
+ ```
375
+
376
+ **Render a static image:**
377
+ ```typescript
378
+ // Submit an image render job (text and images only, no video/audio)
379
+ const imageJob = await client.render.renderImage({
380
+ editor: {
381
+ width: 1080,
382
+ height: 1920,
383
+ fps: 30, // Required but not used for images
384
+ duration: 1000, // Required but not used for images
385
+ channels: [
386
+ {
387
+ id: 'background',
388
+ segments: [
389
+ {
390
+ id: 'bg-image',
391
+ type: 'image', // Only image and text segments allowed
392
+ source: 'https://example.com/background.jpg',
393
+ order: 0,
394
+ offset: { type: 'absolute', value: 0 },
395
+ xOffset: 0,
396
+ yOffset: 0,
397
+ width: 1080,
398
+ height: 1920
399
+ }
400
+ ]
401
+ },
402
+ {
403
+ id: 'text-layer',
404
+ segments: [
405
+ {
406
+ id: 'title',
407
+ type: 'text',
408
+ source: '',
409
+ text: 'Thumbnail Title',
410
+ order: 0,
411
+ offset: { type: 'absolute', value: 0 },
412
+ fontSize: 100,
413
+ fontWeight: 'bold',
414
+ color: '#FFFFFF',
415
+ strokeColor: '#000000',
416
+ strokeWidth: 4
417
+ }
418
+ ]
419
+ }
420
+ ]
421
+ },
422
+ image_format: 'png' // or 'jpeg'
423
+ });
424
+
425
+ // Check status
426
+ const statusResponse = await client.render.getStatus(imageJob.data.job_id);
427
+ if (statusResponse.ok && statusResponse.data.status === 'completed') {
428
+ console.log('Image ready:', statusResponse.data.download_url);
429
+ }
430
+ ```
431
+
308
432
  ## TypeScript Support
309
433
 
310
434
  This package is written in TypeScript and provides full type definitions:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "description": "TypeScript/JavaScript client for the UGC Inc API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",