-
Notifications
You must be signed in to change notification settings - Fork 5
/
codeSamples.yaml
383 lines (383 loc) · 34.4 KB
/
codeSamples.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
overlay: 1.0.0
info:
title: CodeSamples overlay for typescript target
version: 0.0.0
actions:
- target: $["paths"]["/access-control/signing-key"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getSigningKeys
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.accessControl.getAll();\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/access-control/signing-key"]["post"]
update:
x-codeSamples:
- lang: typescript
label: createSigningKey
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.accessControl.create();\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/access-control/signing-key/{keyId}"]["delete"]
update:
x-codeSamples:
- lang: typescript
label: deleteSigningKey
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.accessControl.delete(\"<value>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/access-control/signing-key/{keyId}"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getSigningKey
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.accessControl.get(\"<value>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/access-control/signing-key/{keyId}"]["patch"]
update:
x-codeSamples:
- lang: typescript
label: updateSigningKey
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.accessControl.update(\"<value>\", {});\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/api/beta/generate/audio-to-text"]["post"]
update:
x-codeSamples:
- lang: typescript
label: genAudioToText
source: "import { Livepeer } from \"livepeer\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.generate.audioToText({\n audio: await openAsBlob(\"example.file\"),\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/api/beta/generate/image-to-image"]["post"]
update:
x-codeSamples:
- lang: typescript
label: genImageToImage
source: "import { Livepeer } from \"livepeer\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.generate.imageToImage({\n prompt: \"<value>\",\n image: await openAsBlob(\"example.file\"),\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/api/beta/generate/image-to-video"]["post"]
update:
x-codeSamples:
- lang: typescript
label: genImageToVideo
source: "import { Livepeer } from \"livepeer\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.generate.imageToVideo({\n image: await openAsBlob(\"example.file\"),\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/api/beta/generate/segment-anything-2"]["post"]
update:
x-codeSamples:
- lang: typescript
label: genSegmentAnything2
source: "import { Livepeer } from \"livepeer\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.generate.segmentAnything2({\n image: await openAsBlob(\"example.file\"),\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/api/beta/generate/text-to-image"]["post"]
update:
x-codeSamples:
- lang: typescript
label: genTextToImage
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.generate.textToImage({\n prompt: \"<value>\",\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/api/beta/generate/upscale"]["post"]
update:
x-codeSamples:
- lang: typescript
label: genUpscale
source: "import { Livepeer } from \"livepeer\";\nimport { openAsBlob } from \"node:fs\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.generate.upscale({\n prompt: \"<value>\",\n image: await openAsBlob(\"example.file\"),\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/asset"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getAssets
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.asset.getAll();\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/asset/request-upload"]["post"]
update:
x-codeSamples:
- lang: typescript
label: requestUpload
source: "import { Livepeer } from \"livepeer\";\nimport { TranscodeProfileEncoder, TranscodeProfileProfile, Type } from \"livepeer/models/components\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.asset.create({\n name: \"filename.mp4\",\n staticMp4: true,\n playbackPolicy: {\n type: Type.Webhook,\n webhookId: \"1bde4o2i6xycudoy\",\n webhookContext: {\n \"streamerId\": \"my-custom-id\",\n },\n refreshInterval: 600,\n },\n profiles: [\n {\n width: 1280,\n name: \"720p\",\n height: 720,\n bitrate: 3000000,\n quality: 23,\n fps: 30,\n fpsDen: 1,\n gop: \"2\",\n profile: TranscodeProfileProfile.H264Baseline,\n encoder: TranscodeProfileEncoder.H264,\n },\n ],\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/asset/upload/url"]["post"]
update:
x-codeSamples:
- lang: typescript
label: uploadAsset
source: "import { Livepeer } from \"livepeer\";\nimport { TranscodeProfileEncoder, TranscodeProfileProfile, Type } from \"livepeer/models/components\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.asset.createViaUrl({\n name: \"filename.mp4\",\n staticMp4: true,\n playbackPolicy: {\n type: Type.Webhook,\n webhookId: \"1bde4o2i6xycudoy\",\n webhookContext: {\n \"streamerId\": \"my-custom-id\",\n },\n refreshInterval: 600,\n },\n url: \"https://s3.amazonaws.com/my-bucket/path/filename.mp4\",\n profiles: [\n {\n width: 1280,\n name: \"720p\",\n height: 720,\n bitrate: 3000000,\n quality: 23,\n fps: 30,\n fpsDen: 1,\n gop: \"2\",\n profile: TranscodeProfileProfile.H264Baseline,\n encoder: TranscodeProfileEncoder.H264,\n },\n ],\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/asset/{assetId}"]["delete"]
update:
x-codeSamples:
- lang: typescript
label: deleteAsset
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.asset.delete(\"<value>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/asset/{assetId}"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getAsset
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.asset.get(\"<value>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/asset/{assetId}"]["patch"]
update:
x-codeSamples:
- lang: typescript
label: updateAsset
source: "import { Livepeer } from \"livepeer\";\nimport { Type } from \"livepeer/models/components\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.asset.update(\"<value>\", {\n name: \"filename.mp4\",\n playbackPolicy: {\n type: Type.Webhook,\n webhookId: \"1bde4o2i6xycudoy\",\n webhookContext: {\n \"streamerId\": \"my-custom-id\",\n },\n refreshInterval: 600,\n },\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/clip"]["post"]
update:
x-codeSamples:
- lang: typescript
label: createClip
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.stream.createClip({\n playbackId: \"eaw4nk06ts2d0mzb\",\n startTime: 1587667174725,\n endTime: 1587667174725,\n name: \"My Clip\",\n sessionId: \"de7818e7-610a-4057-8f6f-b785dc1e6f88\",\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/data/usage/query"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getUsageMetrics
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.metrics.getUsage({});\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/data/views/now"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getRealtimeViewershipNow
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.metrics.getRealtimeViewership();\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/data/views/query"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getViewershipMetrics
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.metrics.getViewership({});\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/data/views/query/creator"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getCreatorViewershipMetrics
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.metrics.getCreatorViewership({});\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/data/views/query/total/{playbackId}"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getPublicViewershipMetrics
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.metrics.getPublicViewership(\"<value>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/multistream/target"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getMultistreamTargets
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.multistream.getAll();\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/multistream/target"]["post"]
update:
x-codeSamples:
- lang: typescript
label: createMultistreamTarget
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.multistream.create({\n url: \"rtmps://live.my-service.tv/channel/secretKey\",\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/multistream/target/{id}"]["delete"]
update:
x-codeSamples:
- lang: typescript
label: deleteMultistreamTarget
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.multistream.delete(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/multistream/target/{id}"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getMultistreamTarget
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.multistream.get(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/multistream/target/{id}"]["patch"]
update:
x-codeSamples:
- lang: typescript
label: updateMultistreamTarget
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.multistream.update(\"<id>\", {\n url: \"rtmps://live.my-service.tv/channel/secretKey\",\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/playback/{id}"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getPlaybackInfo
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.playback.get(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/room"]["post"]
update:
x-codeSamples:
- lang: typescript
label: createRoom
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.room.create();\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/room/{id}"]["delete"]
update:
x-codeSamples:
- lang: typescript
label: deleteRoom
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.room.delete(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/room/{id}"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getRoom
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.room.get(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/room/{id}/egress"]["delete"]
update:
x-codeSamples:
- lang: typescript
label: stopRoomEgress
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.room.stopEgress(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/room/{id}/egress"]["post"]
update:
x-codeSamples:
- lang: typescript
label: startRoomEgress
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.room.startEgress(\"<id>\", {\n streamId: \"aac12556-4d65-4d34-9fb6-d1f0985eb0a9\",\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/room/{id}/user"]["post"]
update:
x-codeSamples:
- lang: typescript
label: createRoomUser
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.room.createUser(\"<id>\", {\n name: \"name\",\n canPublish: true,\n canPublishData: true,\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/room/{id}/user/{userId}"]["delete"]
update:
x-codeSamples:
- lang: typescript
label: deleteRoomUser
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.room.deleteUser(\"<id>\", \"<value>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/room/{id}/user/{userId}"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getRoomUser
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.room.getUser(\"<id>\", \"<value>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/room/{id}/user/{userId}"]["put"]
update:
x-codeSamples:
- lang: typescript
label: updateRoomUser
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.room.updateUser(\"<id>\", \"<value>\", {\n canPublish: true,\n canPublishData: true,\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/session"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getSessions
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.session.getAll();\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/session/{id}"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getSession
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.session.get(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/session/{id}/clips"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getSessionClips
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.session.getClips(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/stream"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getStreams
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.stream.getAll();\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/stream"]["post"]
update:
x-codeSamples:
- lang: typescript
label: createStream
source: "import { Livepeer } from \"livepeer\";\nimport { Profile, TranscodeProfileEncoder, TranscodeProfileProfile, Type } from \"livepeer/models/components\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.stream.create({\n name: \"test_stream\",\n pull: {\n source: \"https://myservice.com/live/stream.flv\",\n headers: {\n \"Authorization\": \"Bearer 123\",\n },\n location: {\n lat: 39.739,\n lon: -104.988,\n },\n },\n playbackPolicy: {\n type: Type.Webhook,\n webhookId: \"1bde4o2i6xycudoy\",\n webhookContext: {\n \"streamerId\": \"my-custom-id\",\n },\n refreshInterval: 600,\n },\n profiles: [\n {\n width: 1280,\n name: \"720p\",\n height: 720,\n bitrate: 3000000,\n fps: 30,\n fpsDen: 1,\n quality: 23,\n gop: \"2\",\n profile: Profile.H264Baseline,\n },\n ],\n record: false,\n recordingSpec: {\n profiles: [\n {\n width: 1280,\n name: \"720p\",\n height: 720,\n bitrate: 3000000,\n quality: 23,\n fps: 30,\n fpsDen: 1,\n gop: \"2\",\n profile: TranscodeProfileProfile.H264Baseline,\n encoder: TranscodeProfileEncoder.H264,\n },\n ],\n },\n multistream: {\n targets: [\n {\n profile: \"720p\",\n videoOnly: false,\n id: \"PUSH123\",\n spec: {\n name: \"My target\",\n url: \"rtmps://live.my-service.tv/channel/secretKey\",\n },\n },\n ],\n },\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/stream/{id}"]["delete"]
update:
x-codeSamples:
- lang: typescript
label: deleteStream
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.stream.delete(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/stream/{id}"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getStream
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.stream.get(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/stream/{id}"]["patch"]
update:
x-codeSamples:
- lang: typescript
label: updateStream
source: "import { Livepeer } from \"livepeer\";\nimport { Profile, TranscodeProfileEncoder, TranscodeProfileProfile, Type } from \"livepeer/models/components\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.stream.update(\"<id>\", {\n record: false,\n multistream: {\n targets: [\n {\n profile: \"720p\",\n videoOnly: false,\n id: \"PUSH123\",\n spec: {\n name: \"My target\",\n url: \"rtmps://live.my-service.tv/channel/secretKey\",\n },\n },\n ],\n },\n playbackPolicy: {\n type: Type.Webhook,\n webhookId: \"1bde4o2i6xycudoy\",\n webhookContext: {\n \"streamerId\": \"my-custom-id\",\n },\n refreshInterval: 600,\n },\n profiles: [\n {\n width: 1280,\n name: \"720p\",\n height: 720,\n bitrate: 3000000,\n fps: 30,\n fpsDen: 1,\n quality: 23,\n gop: \"2\",\n profile: Profile.H264Baseline,\n },\n ],\n recordingSpec: {\n profiles: [\n {\n width: 1280,\n name: \"720p\",\n height: 720,\n bitrate: 3000000,\n quality: 23,\n fps: 30,\n fpsDen: 1,\n gop: \"2\",\n profile: TranscodeProfileProfile.H264Baseline,\n encoder: TranscodeProfileEncoder.H264,\n },\n ],\n },\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/stream/{id}/clips"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getClips
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.stream.getClips(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/stream/{id}/create-multistream-target"]["post"]
update:
x-codeSamples:
- lang: typescript
label: addMultistreamTarget
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.stream.addMultistreamTarget(\"<id>\", {\n profile: \"720p0\",\n videoOnly: false,\n id: \"PUSH123\",\n spec: {\n name: \"My target\",\n url: \"rtmps://live.my-service.tv/channel/secretKey\",\n },\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/stream/{id}/multistream/{targetId}"]["delete"]
update:
x-codeSamples:
- lang: typescript
label: removeMultistreamTarget
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.stream.removeMultistreamTarget(\"<id>\", \"<value>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/stream/{id}/start-pull"]["post"]
update:
x-codeSamples:
- lang: typescript
label: startPullStream
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.stream.startPull(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/stream/{id}/terminate"]["delete"]
update:
x-codeSamples:
- lang: typescript
label: terminateStream
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.stream.terminate(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/stream/{parentId}/sessions"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getRecordedSessions
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.session.getRecorded(\"<value>\", true);\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/task"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getTasks
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.task.getAll();\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/task/{taskId}"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getTask
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.task.get(\"<value>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/transcode"]["post"]
update:
x-codeSamples:
- lang: typescript
label: transcodeVideo
source: "import { Livepeer } from \"livepeer\";\nimport { TranscodePayloadSchemasType, TranscodeProfileEncoder, TranscodeProfileProfile } from \"livepeer/models/components\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.transcode.create({\n input: {\n url: \"https://s3.amazonaws.com/bucket/file.mp4\",\n },\n storage: {\n type: TranscodePayloadSchemasType.S3,\n endpoint: \"https://gateway.storjshare.io\",\n bucket: \"outputbucket\",\n credentials: {\n accessKeyId: \"AKIAIOSFODNN7EXAMPLE\",\n secretAccessKey: \"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\",\n },\n },\n outputs: {\n hls: {\n path: \"/samplevideo/hls\",\n },\n mp4: {\n path: \"/samplevideo/mp4\",\n },\n fmp4: {\n path: \"/samplevideo/fmp4\",\n },\n },\n profiles: [\n {\n width: 1280,\n name: \"720p\",\n height: 720,\n bitrate: 3000000,\n quality: 23,\n fps: 30,\n fpsDen: 1,\n gop: \"2\",\n profile: TranscodeProfileProfile.H264Baseline,\n encoder: TranscodeProfileEncoder.H264,\n },\n ],\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/webhook"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getWebhooks
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.webhook.getAll();\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/webhook"]["post"]
update:
x-codeSamples:
- lang: typescript
label: createWebhook
source: "import { Livepeer } from \"livepeer\";\nimport { Events } from \"livepeer/models/components\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.webhook.create({\n name: \"test_webhook\",\n projectId: \"aac12556-4d65-4d34-9fb6-d1f0985eb0a9\",\n events: [\n Events.StreamStarted,\n Events.StreamIdle,\n ],\n url: \"https://my-service.com/webhook\",\n sharedSecret: \"my-secret\",\n streamId: \"de7818e7-610a-4057-8f6f-b785dc1e6f88\",\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/webhook/{id}"]["delete"]
update:
x-codeSamples:
- lang: typescript
label: deleteWebhook
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.webhook.delete(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/webhook/{id}"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getWebhook
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.webhook.get(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/webhook/{id}"]["put"]
update:
x-codeSamples:
- lang: typescript
label: updateWebhook
source: "import { Livepeer } from \"livepeer\";\nimport { Events } from \"livepeer/models/components\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.webhook.update(\"<id>\", {\n name: \"test_webhook\",\n projectId: \"aac12556-4d65-4d34-9fb6-d1f0985eb0a9\",\n events: [\n Events.StreamStarted,\n Events.StreamIdle,\n ],\n url: \"https://my-service.com/webhook\",\n sharedSecret: \"my-secret\",\n streamId: \"de7818e7-610a-4057-8f6f-b785dc1e6f88\",\n });\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/webhook/{id}/log"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getWebhookLogs
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.webhook.getLogs(\"<id>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/webhook/{id}/log/{logId}"]["get"]
update:
x-codeSamples:
- lang: typescript
label: getWebhookLog
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.webhook.getLog(\"<id>\", \"<value>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"
- target: $["paths"]["/webhook/{id}/log/{logId}/resend"]["post"]
update:
x-codeSamples:
- lang: typescript
label: resendWebhook
source: "import { Livepeer } from \"livepeer\";\n\nconst livepeer = new Livepeer({\n apiKey: \"<YOUR_BEARER_TOKEN_HERE>\",\n});\n\nasync function run() {\n const result = await livepeer.webhook.resendLog(\"<id>\", \"<value>\");\n \n // Handle the result\n console.log(result)\n}\n\nrun();"