From a2881021f804fb395d2cecfda2d83b770f75beb3 Mon Sep 17 00:00:00 2001 From: Chase Adams Date: Mon, 20 May 2024 12:20:57 -0700 Subject: [PATCH] fix: code samples --- .speakeasy/workflow.lock | 8 +- codeSamples.yaml | 800 +++++++++++++++++++-------------------- 2 files changed, 404 insertions(+), 404 deletions(-) diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 00d52a3..f925d26 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -2,16 +2,16 @@ speakeasyVersion: 1.293.1 sources: livepeer-studio-api: sourceNamespace: livepeer-studio-api - sourceRevisionDigest: sha256:5fe95adf98d3558833a4413475def3451e55a63465cdbbea94de06c0bf03105c - sourceBlobDigest: sha256:0561ad65098145927f1d60a8ba370296d6e91cbb1430f9880f6a884d594b870e + sourceRevisionDigest: sha256:3871bf226359b14fa14ef5934fb2545bdcc19b74bbac620897478a2f851f07f4 + sourceBlobDigest: sha256:abca49b452693969bce9971bf8edef9bee4a738150d590eb8f73e9080debf4e2 tags: - latest targets: livepeer-ts: source: livepeer-studio-api sourceNamespace: livepeer-studio-api - sourceRevisionDigest: sha256:5fe95adf98d3558833a4413475def3451e55a63465cdbbea94de06c0bf03105c - sourceBlobDigest: sha256:0561ad65098145927f1d60a8ba370296d6e91cbb1430f9880f6a884d594b870e + sourceRevisionDigest: sha256:3871bf226359b14fa14ef5934fb2545bdcc19b74bbac620897478a2f851f07f4 + sourceBlobDigest: sha256:abca49b452693969bce9971bf8edef9bee4a738150d590eb8f73e9080debf4e2 outLocation: . workflow: workflowVersion: 1.0.0 diff --git a/codeSamples.yaml b/codeSamples.yaml index 8cdd522..04047b1 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -3,129 +3,31 @@ info: title: CodeSamples overlay for typescript target version: 0.0.0 actions: - - target: $["paths"]["/stream"]["post"] - update: - x-codeSamples: - - lang: typescript - label: createStream - source: |- - import { Livepeer } from "livepeer"; - import { Profile, Type } from "livepeer/models/components"; - - const livepeer = new Livepeer({ - apiKey: "", - }); - - async function run() { - const result = await livepeer.create({ - name: "test_stream", - pull: { - source: "https://myservice.com/live/stream.flv", - headers: { - "Authorization": "Bearer 123", - }, - location: { - lat: 39.739, - lon: -104.988, - }, - }, - playbackPolicy: { - type: Type.Webhook, - webhookId: "1bde4o2i6xycudoy", - webhookContext: { - "streamerId": "my-custom-id", - }, - refreshInterval: 600, - }, - profiles: [ - { - width: 1280, - name: "720p", - height: 486589, - bitrate: 3000000, - fps: 30, - fpsDen: 1, - quality: 23, - gop: "2", - profile: Profile.H264Baseline, - }, - ], - record: false, - multistream: { - targets: [ - { - profile: "720p", - videoOnly: false, - id: "PUSH123", - spec: { - name: "My target", - url: "rtmps://live.my-service.tv/channel/secretKey", - }, - }, - ], - }, - }); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/multistream/target/{id}"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getMultistreamTarget - source: |- - import { Livepeer } from "livepeer"; - - const livepeer = new Livepeer({ - apiKey: "", - }); - - async function run() { - const result = await livepeer.get(""); - - // Handle the result - console.log(result) - } - - run(); - - target: $["paths"]["/webhook/{id}"]["put"] + - target: $["paths"]["/multistream/target"]["get"] update: x-codeSamples: - lang: typescript - label: updateWebhook + label: getMultistreamTargets source: |- import { Livepeer } from "livepeer"; - import { Events } from "livepeer/models/components"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { - const result = await livepeer.update("", { - name: "test_webhook", - events: [ - Events.StreamStarted, - Events.StreamIdle, - ], - url: "https://my-service.com/webhook", - sharedSecret: "my-secret", - streamId: "de7818e7-610a-4057-8f6f-b785dc1e6f88", - }); + const result = await livepeer.getAll(); // Handle the result console.log(result) } run(); - - target: $["paths"]["/room/{id}/user"]["post"] + - target: $["paths"]["/webhook/{id}/log"]["get"] update: x-codeSamples: - lang: typescript - label: createRoomUser + label: getWebhookLogs source: |- import { Livepeer } from "livepeer"; @@ -134,22 +36,18 @@ actions: }); async function run() { - const result = await livepeer.createUser("", { - name: "name", - canPublish: true, - canPublishData: true, - }); + const result = await livepeer.getLogs(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/room/{id}/user/{userId}"]["delete"] + - target: $["paths"]["/webhook/{id}/log/{logId}"]["get"] update: x-codeSamples: - lang: typescript - label: deleteRoomUser + label: getWebhookLog source: |- import { Livepeer } from "livepeer"; @@ -158,18 +56,18 @@ actions: }); async function run() { - const result = await livepeer.deleteUser("", ""); + const result = await livepeer.getLog("", ""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/access-control/signing-key/{keyId}"]["delete"] + - target: $["paths"]["/webhook/{id}/log/{logId}/resend"]["post"] update: x-codeSamples: - lang: typescript - label: deleteSigningKey + label: resendWebhook source: |- import { Livepeer } from "livepeer"; @@ -178,51 +76,39 @@ actions: }); async function run() { - const result = await livepeer.delete(""); + const result = await livepeer.resendLog("", ""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/transcode"]["post"] + - target: $["paths"]["/asset/upload/url"]["post"] update: x-codeSamples: - lang: typescript - label: transcodeVideo + label: uploadAsset source: |- import { Livepeer } from "livepeer"; - import { TranscodePayloadSchemasType, TranscodeProfileEncoder, TranscodeProfileProfile } from "livepeer/models/components"; + import { TranscodeProfileEncoder, TranscodeProfileProfile, Type } from "livepeer/models/components"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { - const result = await livepeer.create({ - input: { - url: "https://s3.amazonaws.com/bucket/file.mp4", - }, - storage: { - type: TranscodePayloadSchemasType.S3, - endpoint: "https://gateway.storjshare.io", - bucket: "outputbucket", - credentials: { - accessKeyId: "AKIAIOSFODNN7EXAMPLE", - secretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", - }, - }, - outputs: { - hls: { - path: "/samplevideo/hls", - }, - mp4: { - path: "/samplevideo/mp4", - }, - fmp4: { - path: "/samplevideo/fmp4", + const result = await livepeer.createViaUrl({ + name: "filename.mp4", + staticMp4: true, + playbackPolicy: { + type: Type.Webhook, + webhookId: "1bde4o2i6xycudoy", + webhookContext: { + "streamerId": "my-custom-id", }, + refreshInterval: 600, }, + url: "https://s3.amazonaws.com/my-bucket/path/filename.mp4", profiles: [ { width: 1280, @@ -243,11 +129,11 @@ actions: } run(); - - target: $["paths"]["/stream/{id}/terminate"]["delete"] + - target: $["paths"]["/session/{id}/clips"]["get"] update: x-codeSamples: - lang: typescript - label: terminateStream + label: getSessionClips source: |- import { Livepeer } from "livepeer"; @@ -256,18 +142,18 @@ actions: }); async function run() { - const result = await livepeer.terminate(""); + const result = await livepeer.getClips(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/webhook/{id}"]["get"] + - target: $["paths"]["/task"]["get"] update: x-codeSamples: - lang: typescript - label: getWebhook + label: getTasks source: |- import { Livepeer } from "livepeer"; @@ -276,18 +162,18 @@ actions: }); async function run() { - const result = await livepeer.get(""); + const result = await livepeer.getAll(); // Handle the result console.log(result) } run(); - - target: $["paths"]["/room"]["post"] + - target: $["paths"]["/playback/{id}"]["get"] update: x-codeSamples: - lang: typescript - label: createRoom + label: getPlaybackInfo source: |- import { Livepeer } from "livepeer"; @@ -296,18 +182,18 @@ actions: }); async function run() { - const result = await livepeer.create(); + const result = await livepeer.get(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/asset/{assetId}"]["delete"] + - target: $["paths"]["/stream"]["get"] update: x-codeSamples: - lang: typescript - label: deleteAsset + label: getStreams source: |- import { Livepeer } from "livepeer"; @@ -316,18 +202,18 @@ actions: }); async function run() { - const result = await livepeer.delete(""); + const result = await livepeer.getAll(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/room/{id}/egress"]["delete"] + - target: $["paths"]["/stream/{id}"]["get"] update: x-codeSamples: - lang: typescript - label: stopRoomEgress + label: getStream source: |- import { Livepeer } from "livepeer"; @@ -336,18 +222,18 @@ actions: }); async function run() { - const result = await livepeer.stopEgress(""); + const result = await livepeer.get(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/access-control/signing-key/{keyId}"]["get"] + - target: $["paths"]["/session/{id}"]["get"] update: x-codeSamples: - lang: typescript - label: getSigningKey + label: getSession source: |- import { Livepeer } from "livepeer"; @@ -363,11 +249,11 @@ actions: } run(); - - target: $["paths"]["/data/usage/query"]["get"] + - target: $["paths"]["/room/{id}/egress"]["post"] update: x-codeSamples: - lang: typescript - label: getUsageMetrics + label: startRoomEgress source: |- import { Livepeer } from "livepeer"; @@ -376,18 +262,20 @@ actions: }); async function run() { - const result = await livepeer.getUsage({}); + const result = await livepeer.startEgress("", { + streamId: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", + }); // Handle the result console.log(result) } run(); - - target: $["paths"]["/data/views/query"]["get"] + - target: $["paths"]["/multistream/target/{id}"]["patch"] update: x-codeSamples: - lang: typescript - label: getViewershipMetrics + label: updateMultistreamTarget source: |- import { Livepeer } from "livepeer"; @@ -396,18 +284,20 @@ actions: }); async function run() { - const result = await livepeer.getViewership({}); + const result = await livepeer.update("", { + url: "rtmps://live.my-service.tv/channel/secretKey", + }); // Handle the result console.log(result) } run(); - - target: $["paths"]["/stream/{id}"]["get"] + - target: $["paths"]["/webhook/{id}"]["delete"] update: x-codeSamples: - lang: typescript - label: getStream + label: deleteWebhook source: |- import { Livepeer } from "livepeer"; @@ -416,18 +306,18 @@ actions: }); async function run() { - const result = await livepeer.get(""); + const result = await livepeer.delete(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/multistream/target"]["post"] + - target: $["paths"]["/asset"]["get"] update: x-codeSamples: - lang: typescript - label: createMultistreamTarget + label: getAssets source: |- import { Livepeer } from "livepeer"; @@ -436,20 +326,18 @@ actions: }); async function run() { - const result = await livepeer.create({ - url: "rtmps://live.my-service.tv/channel/secretKey", - }); + const result = await livepeer.getAll(); // Handle the result console.log(result) } run(); - - target: $["paths"]["/asset"]["get"] + - target: $["paths"]["/data/views/query/total/{playbackId}"]["get"] update: x-codeSamples: - lang: typescript - label: getAssets + label: getPublicViewershipMetrics source: |- import { Livepeer } from "livepeer"; @@ -458,18 +346,18 @@ actions: }); async function run() { - const result = await livepeer.getAll(); + const result = await livepeer.getPublicViewership(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/data/views/query/total/{playbackId}"]["get"] + - target: $["paths"]["/access-control/signing-key"]["post"] update: x-codeSamples: - lang: typescript - label: getPublicViewershipMetrics + label: createSigningKey source: |- import { Livepeer } from "livepeer"; @@ -478,18 +366,18 @@ actions: }); async function run() { - const result = await livepeer.getPublicViewership(""); + const result = await livepeer.create(); // Handle the result console.log(result) } run(); - - target: $["paths"]["/task"]["get"] + - target: $["paths"]["/webhook/{id}"]["get"] update: x-codeSamples: - lang: typescript - label: getTasks + label: getWebhook source: |- import { Livepeer } from "livepeer"; @@ -498,18 +386,18 @@ actions: }); async function run() { - const result = await livepeer.getAll(); + const result = await livepeer.get(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/stream/{id}/start-pull"]["post"] + - target: $["paths"]["/data/views/query"]["get"] update: x-codeSamples: - lang: typescript - label: startPullStream + label: getViewershipMetrics source: |- import { Livepeer } from "livepeer"; @@ -518,18 +406,18 @@ actions: }); async function run() { - const result = await livepeer.startPull(""); + const result = await livepeer.getViewership({}); // Handle the result console.log(result) } run(); - - target: $["paths"]["/stream/{id}/create-multistream-target"]["post"] + - target: $["paths"]["/multistream/target/{id}"]["get"] update: x-codeSamples: - lang: typescript - label: addMultistreamTarget + label: getMultistreamTarget source: |- import { Livepeer } from "livepeer"; @@ -538,26 +426,18 @@ actions: }); async function run() { - const result = await livepeer.addMultistreamTarget("", { - profile: "720p0", - videoOnly: false, - id: "PUSH123", - spec: { - name: "My target", - url: "rtmps://live.my-service.tv/channel/secretKey", - }, - }); + const result = await livepeer.get(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/webhook/{id}/log"]["get"] + - target: $["paths"]["/data/views/query/creator"]["get"] update: x-codeSamples: - lang: typescript - label: getWebhookLogs + label: getCreatorViewershipMetrics source: |- import { Livepeer } from "livepeer"; @@ -566,18 +446,18 @@ actions: }); async function run() { - const result = await livepeer.getLogs(""); + const result = await livepeer.getCreatorViewership({}); // Handle the result console.log(result) } run(); - - target: $["paths"]["/webhook"]["get"] + - target: $["paths"]["/stream/{id}/create-multistream-target"]["post"] update: x-codeSamples: - lang: typescript - label: getWebhooks + label: addMultistreamTarget source: |- import { Livepeer } from "livepeer"; @@ -586,48 +466,46 @@ actions: }); async function run() { - const result = await livepeer.getAll(); + const result = await livepeer.addMultistreamTarget("", { + profile: "720p0", + videoOnly: false, + id: "PUSH123", + spec: { + name: "My target", + url: "rtmps://live.my-service.tv/channel/secretKey", + }, + }); // Handle the result console.log(result) } run(); - - target: $["paths"]["/webhook"]["post"] + - target: $["paths"]["/room"]["post"] update: x-codeSamples: - lang: typescript - label: createWebhook + label: createRoom source: |- import { Livepeer } from "livepeer"; - import { Events } from "livepeer/models/components"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { - const result = await livepeer.create({ - name: "test_webhook", - events: [ - Events.StreamStarted, - Events.StreamIdle, - ], - url: "https://my-service.com/webhook", - sharedSecret: "my-secret", - streamId: "de7818e7-610a-4057-8f6f-b785dc1e6f88", - }); + const result = await livepeer.create(); // Handle the result console.log(result) } run(); - - target: $["paths"]["/room/{id}/egress"]["post"] + - target: $["paths"]["/room/{id}/user/{userId}"]["put"] update: x-codeSamples: - lang: typescript - label: startRoomEgress + label: updateRoomUser source: |- import { Livepeer } from "livepeer"; @@ -636,8 +514,9 @@ actions: }); async function run() { - const result = await livepeer.startEgress("", { - streamId: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", + const result = await livepeer.updateUser("", "", { + canPublish: true, + canPublishData: true, }); // Handle the result @@ -645,11 +524,11 @@ actions: } run(); - - target: $["paths"]["/multistream/target"]["get"] + - target: $["paths"]["/stream/{id}/multistream/{targetId}"]["delete"] update: x-codeSamples: - lang: typescript - label: getMultistreamTargets + label: removeMultistreamTarget source: |- import { Livepeer } from "livepeer"; @@ -658,30 +537,97 @@ actions: }); async function run() { - const result = await livepeer.getAll(); + const result = await livepeer.removeMultistreamTarget("", ""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/asset/upload/url"]["post"] + - target: $["paths"]["/transcode"]["post"] update: x-codeSamples: - lang: typescript - label: uploadAsset + label: transcodeVideo source: |- import { Livepeer } from "livepeer"; - import { TranscodeProfileEncoder, TranscodeProfileProfile, Type } from "livepeer/models/components"; + import { TranscodePayloadSchemasType, TranscodeProfileEncoder, TranscodeProfileProfile } from "livepeer/models/components"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { - const result = await livepeer.createViaUrl({ - name: "filename.mp4", - staticMp4: true, + const result = await livepeer.create({ + input: { + url: "https://s3.amazonaws.com/bucket/file.mp4", + }, + storage: { + type: TranscodePayloadSchemasType.S3, + endpoint: "https://gateway.storjshare.io", + bucket: "outputbucket", + credentials: { + accessKeyId: "AKIAIOSFODNN7EXAMPLE", + secretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + }, + }, + outputs: { + hls: { + path: "/samplevideo/hls", + }, + mp4: { + path: "/samplevideo/mp4", + }, + fmp4: { + path: "/samplevideo/fmp4", + }, + }, + profiles: [ + { + width: 1280, + name: "720p", + bitrate: 3000000, + quality: 23, + fps: 30, + fpsDen: 1, + gop: "2", + profile: TranscodeProfileProfile.H264Baseline, + encoder: TranscodeProfileEncoder.H264, + }, + ], + }); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/stream"]["post"] + update: + x-codeSamples: + - lang: typescript + label: createStream + source: |- + import { Livepeer } from "livepeer"; + import { Profile, Type } from "livepeer/models/components"; + + const livepeer = new Livepeer({ + apiKey: "", + }); + + async function run() { + const result = await livepeer.create({ + name: "test_stream", + pull: { + source: "https://myservice.com/live/stream.flv", + headers: { + "Authorization": "Bearer 123", + }, + location: { + lat: 39.739, + lon: -104.988, + }, + }, playbackPolicy: { type: Type.Webhook, webhookId: "1bde4o2i6xycudoy", @@ -690,20 +636,33 @@ actions: }, refreshInterval: 600, }, - url: "https://s3.amazonaws.com/my-bucket/path/filename.mp4", profiles: [ { width: 1280, name: "720p", + height: 486589, bitrate: 3000000, - quality: 23, fps: 30, fpsDen: 1, + quality: 23, gop: "2", - profile: TranscodeProfileProfile.H264Baseline, - encoder: TranscodeProfileEncoder.H264, + profile: Profile.H264Baseline, }, ], + record: false, + multistream: { + targets: [ + { + profile: "720p", + videoOnly: false, + id: "PUSH123", + spec: { + name: "My target", + url: "rtmps://live.my-service.tv/channel/secretKey", + }, + }, + ], + }, }); // Handle the result @@ -711,11 +670,11 @@ actions: } run(); - - target: $["paths"]["/room/{id}/user/{userId}"]["get"] + - target: $["paths"]["/stream/{id}"]["delete"] update: x-codeSamples: - lang: typescript - label: getRoomUser + label: deleteStream source: |- import { Livepeer } from "livepeer"; @@ -724,7 +683,7 @@ actions: }); async function run() { - const result = await livepeer.getUser("", ""); + const result = await livepeer.delete(""); // Handle the result console.log(result) @@ -751,30 +710,21 @@ actions: } run(); - - target: $["paths"]["/asset/{assetId}"]["patch"] + - target: $["paths"]["/multistream/target"]["post"] update: x-codeSamples: - lang: typescript - label: updateAsset + label: createMultistreamTarget source: |- import { Livepeer } from "livepeer"; - import { Type } from "livepeer/models/components"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { - const result = await livepeer.update("", { - name: "filename.mp4", - playbackPolicy: { - type: Type.Webhook, - webhookId: "1bde4o2i6xycudoy", - webhookContext: { - "streamerId": "my-custom-id", - }, - refreshInterval: 600, - }, + const result = await livepeer.create({ + url: "rtmps://live.my-service.tv/channel/secretKey", }); // Handle the result @@ -782,11 +732,11 @@ actions: } run(); - - target: $["paths"]["/data/views/query/creator"]["get"] + - target: $["paths"]["/webhook"]["get"] update: x-codeSamples: - lang: typescript - label: getCreatorViewershipMetrics + label: getWebhooks source: |- import { Livepeer } from "livepeer"; @@ -795,7 +745,47 @@ actions: }); async function run() { - const result = await livepeer.getCreatorViewership({}); + const result = await livepeer.getAll(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/session"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getSessions + source: |- + import { Livepeer } from "livepeer"; + + const livepeer = new Livepeer({ + apiKey: "", + }); + + async function run() { + const result = await livepeer.getAll(); + + // Handle the result + console.log(result) + } + + run(); + - target: $["paths"]["/access-control/signing-key/{keyId}"]["get"] + update: + x-codeSamples: + - lang: typescript + label: getSigningKey + source: |- + import { Livepeer } from "livepeer"; + + const livepeer = new Livepeer({ + apiKey: "", + }); + + async function run() { + const result = await livepeer.get(""); // Handle the result console.log(result) @@ -859,11 +849,11 @@ actions: } run(); - - target: $["paths"]["/stream/{id}"]["delete"] + - target: $["paths"]["/stream/{id}/start-pull"]["post"] update: x-codeSamples: - lang: typescript - label: deleteStream + label: startPullStream source: |- import { Livepeer } from "livepeer"; @@ -872,7 +862,7 @@ actions: }); async function run() { - const result = await livepeer.delete(""); + const result = await livepeer.startPull(""); // Handle the result console.log(result) @@ -899,11 +889,11 @@ actions: } run(); - - target: $["paths"]["/webhook/{id}/log/{logId}"]["get"] + - target: $["paths"]["/room/{id}/user"]["post"] update: x-codeSamples: - lang: typescript - label: getWebhookLog + label: createRoomUser source: |- import { Livepeer } from "livepeer"; @@ -912,18 +902,22 @@ actions: }); async function run() { - const result = await livepeer.getLog("", ""); + const result = await livepeer.createUser("", { + name: "name", + canPublish: true, + canPublishData: true, + }); // Handle the result console.log(result) } run(); - - target: $["paths"]["/room/{id}"]["get"] + - target: $["paths"]["/access-control/signing-key"]["get"] update: x-codeSamples: - lang: typescript - label: getRoom + label: getSigningKeys source: |- import { Livepeer } from "livepeer"; @@ -932,18 +926,18 @@ actions: }); async function run() { - const result = await livepeer.get(""); + const result = await livepeer.getAll(); // Handle the result console.log(result) } run(); - - target: $["paths"]["/task/{taskId}"]["get"] + - target: $["paths"]["/access-control/signing-key/{keyId}"]["delete"] update: x-codeSamples: - lang: typescript - label: getTask + label: deleteSigningKey source: |- import { Livepeer } from "livepeer"; @@ -952,18 +946,18 @@ actions: }); async function run() { - const result = await livepeer.get(""); + const result = await livepeer.delete(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/stream/{id}/multistream/{targetId}"]["delete"] + - target: $["paths"]["/task/{taskId}"]["get"] update: x-codeSamples: - lang: typescript - label: removeMultistreamTarget + label: getTask source: |- import { Livepeer } from "livepeer"; @@ -972,98 +966,38 @@ actions: }); async function run() { - const result = await livepeer.removeMultistreamTarget("", ""); + const result = await livepeer.get(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/asset/request-upload"]["post"] + - target: $["paths"]["/room/{id}/user/{userId}"]["get"] update: x-codeSamples: - lang: typescript - label: requestUpload + label: getRoomUser source: |- import { Livepeer } from "livepeer"; - import { - AssetSchemasSourceType, - AssetType, - CreatorIdType, - TranscodeProfileEncoder, - TranscodeProfileProfile, - Type, - } from "livepeer/models/components"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { - const result = await livepeer.create({ - name: "filename.mp4", - projectId: { - type: AssetType.Video, - playbackId: "eaw4nk06ts2d0mzb", - playbackPolicy: { - type: Type.Webhook, - webhookId: "1bde4o2i6xycudoy", - webhookContext: { - "streamerId": "my-custom-id", - }, - refreshInterval: 600, - }, - source: { - type: AssetSchemasSourceType.Recording, - sessionId: "", - }, - creatorId: { - type: CreatorIdType.Unverified, - value: "user123", - }, - name: "filename.mp4", - projectId: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", - hash: [ - { - hash: "9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57", - algorithm: "sha256", - }, - ], - }, - staticMp4: true, - playbackPolicy: { - type: Type.Webhook, - webhookId: "1bde4o2i6xycudoy", - webhookContext: { - "streamerId": "my-custom-id", - }, - refreshInterval: 600, - }, - profiles: [ - { - width: 1280, - name: "720p", - bitrate: 3000000, - quality: 23, - fps: 30, - fpsDen: 1, - gop: "2", - profile: TranscodeProfileProfile.H264Baseline, - encoder: TranscodeProfileEncoder.H264, - }, - ], - }); + const result = await livepeer.getUser("", ""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/session/{id}/clips"]["get"] + - target: $["paths"]["/clip"]["post"] update: x-codeSamples: - lang: typescript - label: getSessionClips + label: createClip source: |- import { Livepeer } from "livepeer"; @@ -1072,18 +1006,24 @@ actions: }); async function run() { - const result = await livepeer.getClips(""); + const result = await livepeer.createClip({ + playbackId: "eaw4nk06ts2d0mzb", + startTime: 1587667174725, + endTime: 1587667174725, + name: "My Clip", + sessionId: "de7818e7-610a-4057-8f6f-b785dc1e6f88", + }); // Handle the result console.log(result) } run(); - - target: $["paths"]["/access-control/signing-key"]["post"] + - target: $["paths"]["/room/{id}/egress"]["delete"] update: x-codeSamples: - lang: typescript - label: createSigningKey + label: stopRoomEgress source: |- import { Livepeer } from "livepeer"; @@ -1092,18 +1032,18 @@ actions: }); async function run() { - const result = await livepeer.create(); + const result = await livepeer.stopEgress(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/stream"]["get"] + - target: $["paths"]["/multistream/target/{id}"]["delete"] update: x-codeSamples: - lang: typescript - label: getStreams + label: deleteMultistreamTarget source: |- import { Livepeer } from "livepeer"; @@ -1112,18 +1052,18 @@ actions: }); async function run() { - const result = await livepeer.getAll(""); + const result = await livepeer.delete(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/playback/{id}"]["get"] + - target: $["paths"]["/access-control/signing-key/{keyId}"]["patch"] update: x-codeSamples: - lang: typescript - label: getPlaybackInfo + label: updateSigningKey source: |- import { Livepeer } from "livepeer"; @@ -1132,18 +1072,18 @@ actions: }); async function run() { - const result = await livepeer.get(""); + const result = await livepeer.update("", {}); // Handle the result console.log(result) } run(); - - target: $["paths"]["/webhook/{id}"]["delete"] + - target: $["paths"]["/data/usage/query"]["get"] update: x-codeSamples: - lang: typescript - label: deleteWebhook + label: getUsageMetrics source: |- import { Livepeer } from "livepeer"; @@ -1152,38 +1092,49 @@ actions: }); async function run() { - const result = await livepeer.delete(""); + const result = await livepeer.getUsage({}); // Handle the result console.log(result) } run(); - - target: $["paths"]["/webhook/{id}/log/{logId}/resend"]["post"] + - target: $["paths"]["/asset/{assetId}"]["patch"] update: x-codeSamples: - lang: typescript - label: resendWebhook + label: updateAsset source: |- import { Livepeer } from "livepeer"; + import { Type } from "livepeer/models/components"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { - const result = await livepeer.resendLog("", ""); + const result = await livepeer.update("", { + name: "filename.mp4", + playbackPolicy: { + type: Type.Webhook, + webhookId: "1bde4o2i6xycudoy", + webhookContext: { + "streamerId": "my-custom-id", + }, + refreshInterval: 600, + }, + }); // Handle the result console.log(result) } run(); - - target: $["paths"]["/access-control/signing-key"]["get"] + - target: $["paths"]["/room/{id}"]["get"] update: x-codeSamples: - lang: typescript - label: getSigningKeys + label: getRoom source: |- import { Livepeer } from "livepeer"; @@ -1192,18 +1143,18 @@ actions: }); async function run() { - const result = await livepeer.getAll(); + const result = await livepeer.get(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/multistream/target/{id}"]["patch"] + - target: $["paths"]["/stream/{id}/terminate"]["delete"] update: x-codeSamples: - lang: typescript - label: updateMultistreamTarget + label: terminateStream source: |- import { Livepeer } from "livepeer"; @@ -1212,20 +1163,18 @@ actions: }); async function run() { - const result = await livepeer.update("", { - url: "rtmps://live.my-service.tv/channel/secretKey", - }); + const result = await livepeer.terminate(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/room/{id}/user/{userId}"]["put"] + - target: $["paths"]["/asset/{assetId}"]["delete"] update: x-codeSamples: - lang: typescript - label: updateRoomUser + label: deleteAsset source: |- import { Livepeer } from "livepeer"; @@ -1234,21 +1183,18 @@ actions: }); async function run() { - const result = await livepeer.updateUser("", "", { - canPublish: true, - canPublishData: true, - }); + const result = await livepeer.delete(""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/access-control/signing-key/{keyId}"]["patch"] + - target: $["paths"]["/stream/{parentId}/sessions"]["get"] update: x-codeSamples: - lang: typescript - label: updateSigningKey + label: getRecordedSessions source: |- import { Livepeer } from "livepeer"; @@ -1257,18 +1203,18 @@ actions: }); async function run() { - const result = await livepeer.update("", {}); + const result = await livepeer.getRecorded("", 1); // Handle the result console.log(result) } run(); - - target: $["paths"]["/session/{id}"]["get"] + - target: $["paths"]["/room/{id}/user/{userId}"]["delete"] update: x-codeSamples: - lang: typescript - label: getSession + label: deleteRoomUser source: |- import { Livepeer } from "livepeer"; @@ -1277,72 +1223,146 @@ actions: }); async function run() { - const result = await livepeer.get(""); + const result = await livepeer.deleteUser("", ""); // Handle the result console.log(result) } run(); - - target: $["paths"]["/stream/{parentId}/sessions"]["get"] + - target: $["paths"]["/webhook"]["post"] update: x-codeSamples: - lang: typescript - label: getRecordedSessions + label: createWebhook source: |- import { Livepeer } from "livepeer"; + import { Events } from "livepeer/models/components"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { - const result = await livepeer.getRecorded("", 1); + const result = await livepeer.create({ + name: "test_webhook", + events: [ + Events.StreamStarted, + Events.StreamIdle, + ], + url: "https://my-service.com/webhook", + sharedSecret: "my-secret", + streamId: "de7818e7-610a-4057-8f6f-b785dc1e6f88", + }); // Handle the result console.log(result) } run(); - - target: $["paths"]["/room/{id}"]["delete"] + - target: $["paths"]["/webhook/{id}"]["put"] update: x-codeSamples: - lang: typescript - label: deleteRoom + label: updateWebhook source: |- import { Livepeer } from "livepeer"; + import { Events } from "livepeer/models/components"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { - const result = await livepeer.delete(""); + const result = await livepeer.update("", { + name: "test_webhook", + events: [ + Events.StreamStarted, + Events.StreamIdle, + ], + url: "https://my-service.com/webhook", + sharedSecret: "my-secret", + streamId: "de7818e7-610a-4057-8f6f-b785dc1e6f88", + }); // Handle the result console.log(result) } run(); - - target: $["paths"]["/clip"]["post"] + - target: $["paths"]["/asset/request-upload"]["post"] update: x-codeSamples: - lang: typescript - label: createClip + label: requestUpload source: |- import { Livepeer } from "livepeer"; + import { + AssetSchemasSourceType, + AssetType, + CreatorIdType, + TranscodeProfileEncoder, + TranscodeProfileProfile, + Type, + } from "livepeer/models/components"; const livepeer = new Livepeer({ apiKey: "", }); async function run() { - const result = await livepeer.createClip({ - playbackId: "eaw4nk06ts2d0mzb", - startTime: 1587667174725, - endTime: 1587667174725, - name: "My Clip", - sessionId: "de7818e7-610a-4057-8f6f-b785dc1e6f88", + const result = await livepeer.create({ + name: "filename.mp4", + projectId: { + type: AssetType.Video, + playbackId: "eaw4nk06ts2d0mzb", + playbackPolicy: { + type: Type.Webhook, + webhookId: "1bde4o2i6xycudoy", + webhookContext: { + "streamerId": "my-custom-id", + }, + refreshInterval: 600, + }, + source: { + type: AssetSchemasSourceType.Recording, + sessionId: "", + }, + creatorId: { + type: CreatorIdType.Unverified, + value: "user123", + }, + name: "filename.mp4", + projectId: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", + hash: [ + { + hash: "9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57", + algorithm: "sha256", + }, + ], + }, + staticMp4: true, + playbackPolicy: { + type: Type.Webhook, + webhookId: "1bde4o2i6xycudoy", + webhookContext: { + "streamerId": "my-custom-id", + }, + refreshInterval: 600, + }, + profiles: [ + { + width: 1280, + name: "720p", + bitrate: 3000000, + quality: 23, + fps: 30, + fpsDen: 1, + gop: "2", + profile: TranscodeProfileProfile.H264Baseline, + encoder: TranscodeProfileEncoder.H264, + }, + ], }); // Handle the result @@ -1350,11 +1370,11 @@ actions: } run(); - - target: $["paths"]["/multistream/target/{id}"]["delete"] + - target: $["paths"]["/room/{id}"]["delete"] update: x-codeSamples: - lang: typescript - label: deleteMultistreamTarget + label: deleteRoom source: |- import { Livepeer } from "livepeer"; @@ -1369,24 +1389,4 @@ actions: console.log(result) } - run(); - - target: $["paths"]["/session"]["get"] - update: - x-codeSamples: - - lang: typescript - label: getSessions - source: |- - import { Livepeer } from "livepeer"; - - const livepeer = new Livepeer({ - apiKey: "", - }); - - async function run() { - const result = await livepeer.getAll(); - - // Handle the result - console.log(result) - } - run();