@convertrilo/sdk 0.0.7 → 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 +33 -5
- package/docs/API-INTEGRATION-GUIDE.md +20 -1
- package/openapi.yaml +47 -9
- 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
|
@@ -564,7 +564,7 @@ export interface paths {
|
|
|
564
564
|
};
|
|
565
565
|
/**
|
|
566
566
|
* List webhooks
|
|
567
|
-
* @description List managed webhook subscriptions for the authenticated user. Managed webhook deliveries include HMAC-SHA256 signatures.
|
|
567
|
+
* @description List managed webhook subscriptions for the authenticated user. API keys need the `webhooks:manage` scope. Managed webhook deliveries include HMAC-SHA256 signatures.
|
|
568
568
|
*/
|
|
569
569
|
get: {
|
|
570
570
|
parameters: {
|
|
@@ -591,6 +591,7 @@ export interface paths {
|
|
|
591
591
|
* Create a webhook
|
|
592
592
|
* @description Create a managed webhook subscription. The response includes `secret` exactly once.
|
|
593
593
|
* Store it securely and use it to verify `X-Webhook-Signature`.
|
|
594
|
+
* API keys need the `webhooks:manage` scope.
|
|
594
595
|
*/
|
|
595
596
|
post: {
|
|
596
597
|
parameters: {
|
|
@@ -633,7 +634,7 @@ export interface paths {
|
|
|
633
634
|
put?: never;
|
|
634
635
|
/**
|
|
635
636
|
* Test a webhook
|
|
636
|
-
* @description Sends a `webhook.test` event to the configured URL using the same HMAC signature header as managed deliveries.
|
|
637
|
+
* @description Sends a `webhook.test` event to the configured URL using the same HMAC signature header as managed deliveries. API keys need the `webhooks:manage` scope.
|
|
637
638
|
*/
|
|
638
639
|
post: {
|
|
639
640
|
parameters: {
|
|
@@ -655,7 +656,10 @@ export interface paths {
|
|
|
655
656
|
};
|
|
656
657
|
};
|
|
657
658
|
};
|
|
658
|
-
/**
|
|
659
|
+
/**
|
|
660
|
+
* Delete a webhook
|
|
661
|
+
* @description API keys need the `webhooks:manage` scope.
|
|
662
|
+
*/
|
|
659
663
|
delete: {
|
|
660
664
|
parameters: {
|
|
661
665
|
query?: never;
|
|
@@ -678,7 +682,10 @@ export interface paths {
|
|
|
678
682
|
};
|
|
679
683
|
options?: never;
|
|
680
684
|
head?: never;
|
|
681
|
-
/**
|
|
685
|
+
/**
|
|
686
|
+
* Update a webhook
|
|
687
|
+
* @description API keys need the `webhooks:manage` scope.
|
|
688
|
+
*/
|
|
682
689
|
patch: {
|
|
683
690
|
parameters: {
|
|
684
691
|
query?: never;
|
|
@@ -716,7 +723,7 @@ export interface paths {
|
|
|
716
723
|
};
|
|
717
724
|
/**
|
|
718
725
|
* List webhook delivery attempts
|
|
719
|
-
* @description Returns the 50 most recent managed or test delivery attempts for this webhook.
|
|
726
|
+
* @description Returns the 50 most recent managed or test delivery attempts for this webhook. API keys need the `webhooks:manage` scope.
|
|
720
727
|
*/
|
|
721
728
|
get: {
|
|
722
729
|
parameters: {
|
|
@@ -1805,6 +1812,12 @@ export interface components {
|
|
|
1805
1812
|
OnDemandEncodeRequest: {
|
|
1806
1813
|
/** Format: uri */
|
|
1807
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
|
+
};
|
|
1808
1821
|
/**
|
|
1809
1822
|
* @default h264
|
|
1810
1823
|
* @enum {string}
|
|
@@ -1863,6 +1876,10 @@ export interface components {
|
|
|
1863
1876
|
OnDemandEncodeResponse: {
|
|
1864
1877
|
/** Format: uuid */
|
|
1865
1878
|
jobId: string;
|
|
1879
|
+
externalId?: string | null;
|
|
1880
|
+
metadata?: {
|
|
1881
|
+
[key: string]: unknown;
|
|
1882
|
+
} | null;
|
|
1866
1883
|
status: string;
|
|
1867
1884
|
estimatedDuration?: number;
|
|
1868
1885
|
pricing?: {
|
|
@@ -1878,6 +1895,10 @@ export interface components {
|
|
|
1878
1895
|
OnDemandStatusResponse: {
|
|
1879
1896
|
/** Format: uuid */
|
|
1880
1897
|
jobId?: string;
|
|
1898
|
+
externalId?: string | null;
|
|
1899
|
+
metadata?: {
|
|
1900
|
+
[key: string]: unknown;
|
|
1901
|
+
} | null;
|
|
1881
1902
|
status?: string;
|
|
1882
1903
|
progress?: number | null;
|
|
1883
1904
|
encoder?: string | null;
|
|
@@ -1906,6 +1927,12 @@ export interface components {
|
|
|
1906
1927
|
failureMessage?: string | null;
|
|
1907
1928
|
};
|
|
1908
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
|
+
};
|
|
1909
1936
|
/**
|
|
1910
1937
|
* @default h264
|
|
1911
1938
|
* @enum {string}
|
|
@@ -1981,6 +2008,7 @@ export interface components {
|
|
|
1981
2008
|
jobs?: {
|
|
1982
2009
|
/** Format: uuid */
|
|
1983
2010
|
jobId?: string;
|
|
2011
|
+
externalId?: string | null;
|
|
1984
2012
|
fileName?: string;
|
|
1985
2013
|
}[];
|
|
1986
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
|
|
@@ -839,9 +866,9 @@ paths:
|
|
|
839
866
|
|
|
840
867
|
/webhooks:
|
|
841
868
|
get:
|
|
842
|
-
security: [{ BearerAuth: [] }]
|
|
869
|
+
security: [{ BearerAuth: [] }, { ApiKeyAuth: [] }]
|
|
843
870
|
summary: List webhooks
|
|
844
|
-
description: List managed webhook subscriptions for the authenticated user. Managed webhook deliveries include HMAC-SHA256 signatures.
|
|
871
|
+
description: List managed webhook subscriptions for the authenticated user. API keys need the `webhooks:manage` scope. Managed webhook deliveries include HMAC-SHA256 signatures.
|
|
845
872
|
responses:
|
|
846
873
|
"200":
|
|
847
874
|
description: List of webhooks
|
|
@@ -850,11 +877,12 @@ paths:
|
|
|
850
877
|
schema:
|
|
851
878
|
$ref: "#/components/schemas/WebhookListResponse"
|
|
852
879
|
post:
|
|
853
|
-
security: [{ BearerAuth: [] }]
|
|
880
|
+
security: [{ BearerAuth: [] }, { ApiKeyAuth: [] }]
|
|
854
881
|
summary: Create a webhook
|
|
855
882
|
description: |
|
|
856
883
|
Create a managed webhook subscription. The response includes `secret` exactly once.
|
|
857
884
|
Store it securely and use it to verify `X-Webhook-Signature`.
|
|
885
|
+
API keys need the `webhooks:manage` scope.
|
|
858
886
|
requestBody:
|
|
859
887
|
required: true
|
|
860
888
|
content:
|
|
@@ -876,8 +904,9 @@ paths:
|
|
|
876
904
|
$ref: "#/components/schemas/WebhookResponse"
|
|
877
905
|
/webhooks/{id}:
|
|
878
906
|
patch:
|
|
879
|
-
security: [{ BearerAuth: [] }]
|
|
907
|
+
security: [{ BearerAuth: [] }, { ApiKeyAuth: [] }]
|
|
880
908
|
summary: Update a webhook
|
|
909
|
+
description: API keys need the `webhooks:manage` scope.
|
|
881
910
|
parameters:
|
|
882
911
|
- in: path
|
|
883
912
|
name: id
|
|
@@ -906,8 +935,9 @@ paths:
|
|
|
906
935
|
schema:
|
|
907
936
|
$ref: "#/components/schemas/WebhookResponse"
|
|
908
937
|
delete:
|
|
909
|
-
security: [{ BearerAuth: [] }]
|
|
938
|
+
security: [{ BearerAuth: [] }, { ApiKeyAuth: [] }]
|
|
910
939
|
summary: Delete a webhook
|
|
940
|
+
description: API keys need the `webhooks:manage` scope.
|
|
911
941
|
parameters:
|
|
912
942
|
- in: path
|
|
913
943
|
name: id
|
|
@@ -916,9 +946,9 @@ paths:
|
|
|
916
946
|
responses:
|
|
917
947
|
"204": { description: Deleted }
|
|
918
948
|
post:
|
|
919
|
-
security: [{ BearerAuth: [] }]
|
|
949
|
+
security: [{ BearerAuth: [] }, { ApiKeyAuth: [] }]
|
|
920
950
|
summary: Test a webhook
|
|
921
|
-
description: Sends a `webhook.test` event to the configured URL using the same HMAC signature header as managed deliveries.
|
|
951
|
+
description: Sends a `webhook.test` event to the configured URL using the same HMAC signature header as managed deliveries. API keys need the `webhooks:manage` scope.
|
|
922
952
|
parameters:
|
|
923
953
|
- in: path
|
|
924
954
|
name: id
|
|
@@ -928,9 +958,9 @@ paths:
|
|
|
928
958
|
"200": { description: Test event sent }
|
|
929
959
|
/webhooks/{id}/deliveries:
|
|
930
960
|
get:
|
|
931
|
-
security: [{ BearerAuth: [] }]
|
|
961
|
+
security: [{ BearerAuth: [] }, { ApiKeyAuth: [] }]
|
|
932
962
|
summary: List webhook delivery attempts
|
|
933
|
-
description: Returns the 50 most recent managed or test delivery attempts for this webhook.
|
|
963
|
+
description: Returns the 50 most recent managed or test delivery attempts for this webhook. API keys need the `webhooks:manage` scope.
|
|
934
964
|
parameters:
|
|
935
965
|
- in: path
|
|
936
966
|
name: id
|
|
@@ -1170,6 +1200,10 @@ paths:
|
|
|
1170
1200
|
summary: URL source to CDN output
|
|
1171
1201
|
value:
|
|
1172
1202
|
sourceUrl: https://example.com/video.mp4
|
|
1203
|
+
externalId: customer-video-123
|
|
1204
|
+
metadata:
|
|
1205
|
+
customerId: cus_123
|
|
1206
|
+
workflow: daily-compression
|
|
1173
1207
|
codec: h264
|
|
1174
1208
|
resolution: 1080p
|
|
1175
1209
|
quality: better
|
|
@@ -1251,6 +1285,10 @@ paths:
|
|
|
1251
1285
|
s3FolderToS3:
|
|
1252
1286
|
summary: S3 folder source to S3 output
|
|
1253
1287
|
value:
|
|
1288
|
+
externalIdPrefix: batch-2026-06-09
|
|
1289
|
+
metadata:
|
|
1290
|
+
customerId: cus_123
|
|
1291
|
+
workflow: folder-compression
|
|
1254
1292
|
sourceS3:
|
|
1255
1293
|
bucket: customer-source-bucket
|
|
1256
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
|
+
}
|