@convertrilo/sdk 0.0.8 → 0.0.9
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 +11 -1
- package/dist/src/index.d.ts +9 -0
- package/dist/src/types.d.ts +21 -0
- package/docs/API-INTEGRATION-GUIDE.md +20 -1
- package/openapi.yaml +35 -0
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -46,6 +46,11 @@ OAuth tokens, polling, and webhooks, see
|
|
|
46
46
|
```ts
|
|
47
47
|
const job = await client.onDemandEncode({
|
|
48
48
|
sourceUrl: "https://example.com/input.mp4",
|
|
49
|
+
externalId: "customer-video-123",
|
|
50
|
+
metadata: {
|
|
51
|
+
customerId: "cus_123",
|
|
52
|
+
workflow: "daily-compression",
|
|
53
|
+
},
|
|
49
54
|
codec: "h264",
|
|
50
55
|
resolution: "1080p",
|
|
51
56
|
quality: "better",
|
|
@@ -117,6 +122,11 @@ Queue one job per video in an S3 prefix:
|
|
|
117
122
|
|
|
118
123
|
```ts
|
|
119
124
|
const batch = await client.onDemandIngestFolder({
|
|
125
|
+
externalIdPrefix: "batch-2026-06-09",
|
|
126
|
+
metadata: {
|
|
127
|
+
customerId: "cus_123",
|
|
128
|
+
workflow: "folder-compression",
|
|
129
|
+
},
|
|
120
130
|
sourceS3: {
|
|
121
131
|
bucket: "customer-source-bucket",
|
|
122
132
|
prefix: "incoming/",
|
|
@@ -137,7 +147,7 @@ const batch = await client.onDemandIngestFolder({
|
|
|
137
147
|
});
|
|
138
148
|
|
|
139
149
|
for (const job of batch.jobs || []) {
|
|
140
|
-
console.log(job.jobId, job.fileName);
|
|
150
|
+
console.log(job.jobId, job.externalId, job.fileName);
|
|
141
151
|
}
|
|
142
152
|
```
|
|
143
153
|
|
package/dist/src/index.d.ts
CHANGED
|
@@ -145,6 +145,10 @@ export declare class ConvertriloClient {
|
|
|
145
145
|
abortStream(id: string): Promise<unknown>;
|
|
146
146
|
onDemandEncode(body: paths["/ondemand/encode"]["post"]["requestBody"]["content"]["application/json"]): Promise<{
|
|
147
147
|
jobId: string;
|
|
148
|
+
externalId?: string | null;
|
|
149
|
+
metadata?: {
|
|
150
|
+
[key: string]: unknown;
|
|
151
|
+
} | null;
|
|
148
152
|
status: string;
|
|
149
153
|
estimatedDuration?: number;
|
|
150
154
|
pricing?: {
|
|
@@ -161,11 +165,16 @@ export declare class ConvertriloClient {
|
|
|
161
165
|
message?: string;
|
|
162
166
|
jobs?: {
|
|
163
167
|
jobId?: string;
|
|
168
|
+
externalId?: string | null;
|
|
164
169
|
fileName?: string;
|
|
165
170
|
}[];
|
|
166
171
|
}>;
|
|
167
172
|
onDemandStatus(jobId: string): Promise<{
|
|
168
173
|
jobId?: string;
|
|
174
|
+
externalId?: string | null;
|
|
175
|
+
metadata?: {
|
|
176
|
+
[key: string]: unknown;
|
|
177
|
+
} | null;
|
|
169
178
|
status?: string;
|
|
170
179
|
progress?: number | null;
|
|
171
180
|
encoder?: string | null;
|
package/dist/src/types.d.ts
CHANGED
|
@@ -1812,6 +1812,12 @@ export interface components {
|
|
|
1812
1812
|
OnDemandEncodeRequest: {
|
|
1813
1813
|
/** Format: uri */
|
|
1814
1814
|
sourceUrl: string;
|
|
1815
|
+
/** @description Your stable job identifier for reconciliation in status responses and webhooks. */
|
|
1816
|
+
externalId?: string;
|
|
1817
|
+
/** @description Integration-owned JSON object returned in status responses and webhooks. */
|
|
1818
|
+
metadata?: {
|
|
1819
|
+
[key: string]: unknown;
|
|
1820
|
+
};
|
|
1815
1821
|
/**
|
|
1816
1822
|
* @default h264
|
|
1817
1823
|
* @enum {string}
|
|
@@ -1870,6 +1876,10 @@ export interface components {
|
|
|
1870
1876
|
OnDemandEncodeResponse: {
|
|
1871
1877
|
/** Format: uuid */
|
|
1872
1878
|
jobId: string;
|
|
1879
|
+
externalId?: string | null;
|
|
1880
|
+
metadata?: {
|
|
1881
|
+
[key: string]: unknown;
|
|
1882
|
+
} | null;
|
|
1873
1883
|
status: string;
|
|
1874
1884
|
estimatedDuration?: number;
|
|
1875
1885
|
pricing?: {
|
|
@@ -1885,6 +1895,10 @@ export interface components {
|
|
|
1885
1895
|
OnDemandStatusResponse: {
|
|
1886
1896
|
/** Format: uuid */
|
|
1887
1897
|
jobId?: string;
|
|
1898
|
+
externalId?: string | null;
|
|
1899
|
+
metadata?: {
|
|
1900
|
+
[key: string]: unknown;
|
|
1901
|
+
} | null;
|
|
1888
1902
|
status?: string;
|
|
1889
1903
|
progress?: number | null;
|
|
1890
1904
|
encoder?: string | null;
|
|
@@ -1913,6 +1927,12 @@ export interface components {
|
|
|
1913
1927
|
failureMessage?: string | null;
|
|
1914
1928
|
};
|
|
1915
1929
|
OnDemandFolderIngestRequest: {
|
|
1930
|
+
/** @description Optional prefix used to generate one externalId per queued file as `${externalIdPrefix}:${fileName}`. */
|
|
1931
|
+
externalIdPrefix?: string;
|
|
1932
|
+
/** @description Integration-owned JSON object attached to every queued job and returned in webhooks/status responses. */
|
|
1933
|
+
metadata?: {
|
|
1934
|
+
[key: string]: unknown;
|
|
1935
|
+
};
|
|
1916
1936
|
/**
|
|
1917
1937
|
* @default h264
|
|
1918
1938
|
* @enum {string}
|
|
@@ -1988,6 +2008,7 @@ export interface components {
|
|
|
1988
2008
|
jobs?: {
|
|
1989
2009
|
/** Format: uuid */
|
|
1990
2010
|
jobId?: string;
|
|
2011
|
+
externalId?: string | null;
|
|
1991
2012
|
fileName?: string;
|
|
1992
2013
|
}[];
|
|
1993
2014
|
};
|
|
@@ -53,6 +53,11 @@ Use this when the source video is already available over HTTP(S), and you want C
|
|
|
53
53
|
```ts
|
|
54
54
|
const job = await client.onDemandEncode({
|
|
55
55
|
sourceUrl: "https://example.com/input.mp4",
|
|
56
|
+
externalId: "customer-video-123",
|
|
57
|
+
metadata: {
|
|
58
|
+
customerId: "cus_123",
|
|
59
|
+
workflow: "daily-compression",
|
|
60
|
+
},
|
|
56
61
|
codec: "h264",
|
|
57
62
|
resolution: "1080p",
|
|
58
63
|
quality: "better",
|
|
@@ -69,6 +74,11 @@ curl https://api.convertrilo.com/ondemand/encode \
|
|
|
69
74
|
-H "X-API-Key: $CONVERTRILO_API_KEY" \
|
|
70
75
|
-d '{
|
|
71
76
|
"sourceUrl": "https://example.com/input.mp4",
|
|
77
|
+
"externalId": "customer-video-123",
|
|
78
|
+
"metadata": {
|
|
79
|
+
"customerId": "cus_123",
|
|
80
|
+
"workflow": "daily-compression"
|
|
81
|
+
},
|
|
72
82
|
"codec": "h264",
|
|
73
83
|
"resolution": "1080p",
|
|
74
84
|
"quality": "better"
|
|
@@ -77,6 +87,8 @@ curl https://api.convertrilo.com/ondemand/encode \
|
|
|
77
87
|
|
|
78
88
|
Poll `/ondemand/status/{jobId}` until the job reaches `success`, then read `downloadUrl`.
|
|
79
89
|
|
|
90
|
+
Use `externalId` and `metadata` to reconcile Convertrilo jobs with your own database. They are returned by status responses and managed webhook payloads.
|
|
91
|
+
|
|
80
92
|
## Flow 2: URL Source To S3 Output
|
|
81
93
|
|
|
82
94
|
Use this when your customer wants the encoded output in their own S3-compatible bucket.
|
|
@@ -110,6 +122,11 @@ Source credentials need permission to list the prefix and read objects. Output c
|
|
|
110
122
|
|
|
111
123
|
```ts
|
|
112
124
|
const batch = await client.onDemandIngestFolder({
|
|
125
|
+
externalIdPrefix: "batch-2026-06-09",
|
|
126
|
+
metadata: {
|
|
127
|
+
customerId: "cus_123",
|
|
128
|
+
workflow: "folder-compression",
|
|
129
|
+
},
|
|
113
130
|
sourceS3: {
|
|
114
131
|
bucket: "customer-source-bucket",
|
|
115
132
|
prefix: "incoming/",
|
|
@@ -134,10 +151,12 @@ const batch = await client.onDemandIngestFolder({
|
|
|
134
151
|
});
|
|
135
152
|
|
|
136
153
|
for (const job of batch.jobs || []) {
|
|
137
|
-
console.log(job.jobId, job.fileName);
|
|
154
|
+
console.log(job.jobId, job.externalId, job.fileName);
|
|
138
155
|
}
|
|
139
156
|
```
|
|
140
157
|
|
|
158
|
+
For folder ingest, Convertrilo generates each job `externalId` as `${externalIdPrefix}:${fileName}`.
|
|
159
|
+
|
|
141
160
|
Only files with video extensions are queued. If no video files are found, the API returns `404`.
|
|
142
161
|
|
|
143
162
|
## Flow 4: Google Drive With BYO OAuth Tokens
|
package/openapi.yaml
CHANGED
|
@@ -457,6 +457,14 @@ components:
|
|
|
457
457
|
required: [sourceUrl]
|
|
458
458
|
properties:
|
|
459
459
|
sourceUrl: { type: string, format: uri }
|
|
460
|
+
externalId:
|
|
461
|
+
type: string
|
|
462
|
+
maxLength: 255
|
|
463
|
+
description: Your stable job identifier for reconciliation in status responses and webhooks.
|
|
464
|
+
metadata:
|
|
465
|
+
type: object
|
|
466
|
+
additionalProperties: true
|
|
467
|
+
description: Integration-owned JSON object returned in status responses and webhooks.
|
|
460
468
|
codec: { type: string, enum: [h264, h265, av1], default: h264 }
|
|
461
469
|
resolution:
|
|
462
470
|
{
|
|
@@ -493,6 +501,11 @@ components:
|
|
|
493
501
|
required: [jobId, status, statusUrl]
|
|
494
502
|
properties:
|
|
495
503
|
jobId: { type: string, format: uuid }
|
|
504
|
+
externalId: { type: string, nullable: true }
|
|
505
|
+
metadata:
|
|
506
|
+
type: object
|
|
507
|
+
additionalProperties: true
|
|
508
|
+
nullable: true
|
|
496
509
|
status: { type: string }
|
|
497
510
|
estimatedDuration: { type: integer }
|
|
498
511
|
pricing:
|
|
@@ -509,6 +522,11 @@ components:
|
|
|
509
522
|
type: object
|
|
510
523
|
properties:
|
|
511
524
|
jobId: { type: string, format: uuid }
|
|
525
|
+
externalId: { type: string, nullable: true }
|
|
526
|
+
metadata:
|
|
527
|
+
type: object
|
|
528
|
+
additionalProperties: true
|
|
529
|
+
nullable: true
|
|
512
530
|
status: { type: string }
|
|
513
531
|
progress: { type: number, nullable: true }
|
|
514
532
|
encoder: { type: string, nullable: true }
|
|
@@ -537,6 +555,14 @@ components:
|
|
|
537
555
|
OnDemandFolderIngestRequest:
|
|
538
556
|
type: object
|
|
539
557
|
properties:
|
|
558
|
+
externalIdPrefix:
|
|
559
|
+
type: string
|
|
560
|
+
maxLength: 200
|
|
561
|
+
description: Optional prefix used to generate one externalId per queued file as `${externalIdPrefix}:${fileName}`.
|
|
562
|
+
metadata:
|
|
563
|
+
type: object
|
|
564
|
+
additionalProperties: true
|
|
565
|
+
description: Integration-owned JSON object attached to every queued job and returned in webhooks/status responses.
|
|
540
566
|
codec: { type: string, enum: [h264, h265, av1], default: h264 }
|
|
541
567
|
resolution:
|
|
542
568
|
{
|
|
@@ -589,6 +615,7 @@ components:
|
|
|
589
615
|
type: object
|
|
590
616
|
properties:
|
|
591
617
|
jobId: { type: string, format: uuid }
|
|
618
|
+
externalId: { type: string, nullable: true }
|
|
592
619
|
fileName: { type: string }
|
|
593
620
|
|
|
594
621
|
# Streaming
|
|
@@ -1173,6 +1200,10 @@ paths:
|
|
|
1173
1200
|
summary: URL source to CDN output
|
|
1174
1201
|
value:
|
|
1175
1202
|
sourceUrl: https://example.com/video.mp4
|
|
1203
|
+
externalId: customer-video-123
|
|
1204
|
+
metadata:
|
|
1205
|
+
customerId: cus_123
|
|
1206
|
+
workflow: daily-compression
|
|
1176
1207
|
codec: h264
|
|
1177
1208
|
resolution: 1080p
|
|
1178
1209
|
quality: better
|
|
@@ -1254,6 +1285,10 @@ paths:
|
|
|
1254
1285
|
s3FolderToS3:
|
|
1255
1286
|
summary: S3 folder source to S3 output
|
|
1256
1287
|
value:
|
|
1288
|
+
externalIdPrefix: batch-2026-06-09
|
|
1289
|
+
metadata:
|
|
1290
|
+
customerId: cus_123
|
|
1291
|
+
workflow: folder-compression
|
|
1257
1292
|
sourceS3:
|
|
1258
1293
|
bucket: customer-source-bucket
|
|
1259
1294
|
prefix: incoming/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@convertrilo/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "TypeScript client for the Convertrilo video encoding API",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,6 +44,12 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"clean": "rimraf dist",
|
|
49
|
+
"generate": "openapi-typescript openapi.yaml -o src/types.ts --default-non-nullable false",
|
|
50
|
+
"build": "tsc -p tsconfig.json",
|
|
51
|
+
"prepack": "pnpm run clean && pnpm run generate && pnpm run build"
|
|
52
|
+
},
|
|
47
53
|
"dependencies": {},
|
|
48
54
|
"devDependencies": {
|
|
49
55
|
"@types/node": "^20.11.30",
|
|
@@ -52,10 +58,5 @@
|
|
|
52
58
|
"rimraf": "^5.0.5",
|
|
53
59
|
"tsx": "^4.7.0",
|
|
54
60
|
"typescript": "^5.4.0"
|
|
55
|
-
},
|
|
56
|
-
"scripts": {
|
|
57
|
-
"clean": "rimraf dist",
|
|
58
|
-
"generate": "openapi-typescript openapi.yaml -o src/types.ts --default-non-nullable false",
|
|
59
|
-
"build": "tsc -p tsconfig.json"
|
|
60
61
|
}
|
|
61
|
-
}
|
|
62
|
+
}
|