From e22329daaf07f6d1ed0e5be14a2e00d863b4c368 Mon Sep 17 00:00:00 2001 From: speakeasybot Date: Tue, 4 Jun 2024 00:25:28 +0000 Subject: [PATCH] ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.299.6 --- .speakeasy/gen.lock | 15 +- .speakeasy/gen.yaml | 2 +- .speakeasy/workflow.lock | 13 +- RELEASES.md | 11 + codeSamples.yaml | 1059 +++++++++-------- docs/models/components/asset.md | 2 +- docs/models/components/assetpatchpayload.md | 2 +- docs/models/components/meta.md | 2 +- .../components/newassetfromurlpayload.md | 2 +- docs/models/components/newassetpayload.md | 2 +- docs/models/components/newstreampayload.md | 2 +- docs/models/components/playbackpolicy.md | 2 +- docs/models/components/stream.md | 2 +- docs/models/components/streampatchpayload.md | 2 +- .../operations/getrecordedsessionsrequest.md | 2 +- docs/models/operations/record.md | 21 + docs/sdks/session/README.md | 7 +- livepeer.go | 6 +- models/components/asset.go | 2 +- models/components/assetpatchpayload.go | 2 +- models/components/newassetfromurlpayload.go | 2 +- models/components/newassetpayload.go | 2 +- models/components/newstreampayload.go | 2 +- models/components/playbackinfo.go | 2 +- models/components/playbackpolicy.go | 2 +- models/components/stream.go | 2 +- models/components/streampatchpayload.go | 2 +- models/operations/getrecordedsessions.go | 72 +- session.go | 2 +- 29 files changed, 678 insertions(+), 568 deletions(-) create mode 100644 RELEASES.md create mode 100644 docs/models/operations/record.md diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 247e303..42cdc4d 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,18 +1,20 @@ lockVersion: 2.0.0 id: 17bba98d-ccbf-4675-8dd5-54aa47cbeeb4 management: - docChecksum: b10c6d403306684b2080504dd2e51041 + docChecksum: b23c9725282eea80900b05121d16fea8 docVersion: 1.0.0 - speakeasyVersion: 1.296.0 - generationVersion: 2.337.1 - releaseVersion: 0.1.9 - configChecksum: 3dc9f5bfc5bdb07b7608d1109f86a92b + speakeasyVersion: 1.299.6 + generationVersion: 2.338.12 + releaseVersion: 0.1.10 + configChecksum: 105ad9c12eb8b1f8ef31f9cef0516454 + repoURL: https://github.com/livepeer/livepeer-go.git + installationURL: https://github.com/livepeer/livepeer-go features: go: additionalDependencies: 0.1.0 additionalProperties: 0.1.2 constsAndDefaults: 0.1.4 - core: 3.4.10 + core: 3.4.11 deprecations: 2.81.1 flattening: 2.81.1 globalSecurity: 2.82.9 @@ -226,6 +228,7 @@ generatedFiles: - docs/models/operations/getsessionsresponse.md - docs/models/operations/getsessionrequest.md - docs/models/operations/getsessionresponse.md + - docs/models/operations/record.md - docs/models/operations/getrecordedsessionsrequest.md - docs/models/operations/getrecordedsessionsresponse.md - docs/models/operations/createroomresponse.md diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 9c44062..1cbc8af 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: true go: - version: 0.1.9 + version: 0.1.10 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index b4c7059..7bc517f 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,18 +1,19 @@ -speakeasyVersion: 1.296.0 +speakeasyVersion: 1.299.6 sources: livepeer-studio-api: sourceNamespace: livepeer-studio-api - sourceRevisionDigest: sha256:fcf3ed26f77d003444f896e48452f794687e85fa5826da252e3c27e91bdc7cec - sourceBlobDigest: sha256:5a97d733e029650c5a9fa556d69518400fe98e9eb87e8a7ad294d6a20e896226 + sourceRevisionDigest: sha256:01b8552c43b63c333a66c8c1dcff5e254d77f2a761281d438c260f8ed58129d9 + sourceBlobDigest: sha256:4511db816d2a664c480b324c01768614ebc3b98a486e5e9536b398c85924d2cb tags: - latest + - main targets: livepeer-go: source: livepeer-studio-api sourceNamespace: livepeer-studio-api - sourceRevisionDigest: sha256:fcf3ed26f77d003444f896e48452f794687e85fa5826da252e3c27e91bdc7cec - sourceBlobDigest: sha256:5a97d733e029650c5a9fa556d69518400fe98e9eb87e8a7ad294d6a20e896226 - outLocation: /Users/chase/git/livepeer/livepeer-go + sourceRevisionDigest: sha256:01b8552c43b63c333a66c8c1dcff5e254d77f2a761281d438c260f8ed58129d9 + sourceBlobDigest: sha256:4511db816d2a664c480b324c01768614ebc3b98a486e5e9536b398c85924d2cb + outLocation: /github/workspace/repo workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/RELEASES.md b/RELEASES.md new file mode 100644 index 0000000..29b9a65 --- /dev/null +++ b/RELEASES.md @@ -0,0 +1,11 @@ + + +## 2024-06-04 00:24:23 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.299.6 (2.338.12) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.1.10] . +### Releases +- [Go v0.1.10] https://github.com/livepeer/livepeer-go/releases/tag/v0.1.10 - . \ No newline at end of file diff --git a/codeSamples.yaml b/codeSamples.yaml index 8c03846..0e3fef3 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -3,17 +3,17 @@ info: title: CodeSamples overlay for go target version: 0.0.0 actions: - - target: $["paths"]["/access-control/signing-key/{keyId}"]["patch"] + - target: $["paths"]["/multistream/target"]["post"] update: x-codeSamples: - lang: go - label: updateSigningKey + label: createMultistreamTarget source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/operations" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -22,23 +22,23 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var keyID string = "" - - requestBody := operations.UpdateSigningKeyRequestBody{} + request := components.MultistreamTargetInput{ + URL: "rtmps://live.my-service.tv/channel/secretKey", + } ctx := context.Background() - res, err := s.AccessControl.Update(ctx, keyID, requestBody) + res, err := s.Multistream.Create(ctx, request) if err != nil { log.Fatal(err) } - if res != nil { + if res.MultistreamTarget != nil { // handle response } } - - target: $["paths"]["/stream/{id}"]["patch"] + - target: $["paths"]["/webhook"]["post"] update: x-codeSamples: - lang: go - label: updateStream + label: createWebhook source: |- package main @@ -53,59 +53,30 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" - - streamPatchPayload := components.StreamPatchPayload{ - Record: livepeergo.Bool(false), - Multistream: &components.Multistream{ - Targets: []components.Target{ - components.Target{ - Profile: "720p", - VideoOnly: livepeergo.Bool(false), - ID: livepeergo.String("PUSH123"), - Spec: &components.TargetSpec{ - Name: livepeergo.String("My target"), - URL: "rtmps://live.my-service.tv/channel/secretKey", - }, - }, - }, - }, - PlaybackPolicy: &components.PlaybackPolicy{ - Type: components.TypeWebhook, - WebhookID: livepeergo.String("1bde4o2i6xycudoy"), - WebhookContext: map[string]any{ - "streamerId": "my-custom-id", - }, - RefreshInterval: livepeergo.Float64(600), - }, - Profiles: []components.FfmpegProfile{ - components.FfmpegProfile{ - Width: 1280, - Name: "720p", - Height: 857478, - Bitrate: 3000000, - Fps: 30, - FpsDen: livepeergo.Int64(1), - Quality: livepeergo.Int64(23), - Gop: livepeergo.String("2"), - Profile: components.ProfileH264Baseline.ToPointer(), - }, + request := components.WebhookInput{ + Name: "test_webhook", + Events: []components.Events{ + components.EventsStreamStarted, + components.EventsStreamIdle, }, + URL: "https://my-service.com/webhook", + SharedSecret: livepeergo.String("my-secret"), + StreamID: livepeergo.String("de7818e7-610a-4057-8f6f-b785dc1e6f88"), } ctx := context.Background() - res, err := s.Stream.Update(ctx, id, streamPatchPayload) + res, err := s.Webhook.Create(ctx, request) if err != nil { log.Fatal(err) } - if res != nil { + if res.Webhook != nil { // handle response } } - - target: $["paths"]["/stream/{id}/clips"]["get"] + - target: $["paths"]["/webhook/{id}/log/{logId}/resend"]["post"] update: x-codeSamples: - lang: go - label: getClips + label: resendWebhook source: |- package main @@ -120,25 +91,28 @@ actions: livepeergo.WithSecurity(""), ) var id string = "" + + var logID string = "" ctx := context.Background() - res, err := s.Stream.GetClips(ctx, id) + res, err := s.Webhook.ResendLog(ctx, id, logID) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res.WebhookLog != nil { // handle response } } - - target: $["paths"]["/stream/{id}"]["get"] + - target: $["paths"]["/room/{id}/user/{userId}"]["put"] update: x-codeSamples: - lang: go - label: getStream + label: updateRoomUser source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -148,26 +122,32 @@ actions: livepeergo.WithSecurity(""), ) var id string = "" + + var userID string = "" + + roomUserUpdatePayload := components.RoomUserUpdatePayload{ + CanPublish: livepeergo.Bool(true), + CanPublishData: livepeergo.Bool(true), + } ctx := context.Background() - res, err := s.Stream.Get(ctx, id) + res, err := s.Room.UpdateUser(ctx, id, userID, roomUserUpdatePayload) if err != nil { log.Fatal(err) } - if res.Stream != nil { + if res != nil { // handle response } } - - target: $["paths"]["/clip"]["post"] + - target: $["paths"]["/stream"]["get"] update: x-codeSamples: - lang: go - label: createClip + label: getStreams source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -176,15 +156,9 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := components.ClipPayload{ - PlaybackID: "eaw4nk06ts2d0mzb", - StartTime: 1587667174725, - EndTime: livepeergo.Float64(1587667174725), - Name: livepeergo.String("My Clip"), - SessionID: livepeergo.String("de7818e7-610a-4057-8f6f-b785dc1e6f88"), - } + var streamsonly *string = livepeergo.String("") ctx := context.Background() - res, err := s.Stream.CreateClip(ctx, request) + res, err := s.Stream.GetAll(ctx, streamsonly) if err != nil { log.Fatal(err) } @@ -192,11 +166,11 @@ actions: // handle response } } - - target: $["paths"]["/task/{taskId}"]["get"] + - target: $["paths"]["/asset/{assetId}"]["delete"] update: x-codeSamples: - lang: go - label: getTask + label: deleteAsset source: |- package main @@ -210,21 +184,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var taskID string = "" + var assetID string = "" ctx := context.Background() - res, err := s.Task.Get(ctx, taskID) + res, err := s.Asset.Delete(ctx, assetID) if err != nil { log.Fatal(err) } - if res.Task != nil { + if res != nil { // handle response } } - - target: $["paths"]["/stream"]["get"] + - target: $["paths"]["/room/{id}"]["get"] update: x-codeSamples: - lang: go - label: getStreams + label: getRoom source: |- package main @@ -238,26 +212,27 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var streamsonly *string = livepeergo.String("") + var id string = "" ctx := context.Background() - res, err := s.Stream.GetAll(ctx, streamsonly) + res, err := s.Room.Get(ctx, id) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res.Room != nil { // handle response } } - - target: $["paths"]["/data/views/query/total/{playbackId}"]["get"] + - target: $["paths"]["/data/views/query"]["get"] update: x-codeSamples: - lang: go - label: getPublicViewershipMetrics + label: getViewershipMetrics source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -266,9 +241,9 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var playbackID string = "" + request := operations.GetViewershipMetricsRequest{} ctx := context.Background() - res, err := s.Metrics.GetPublicViewership(ctx, playbackID) + res, err := s.Metrics.GetViewership(ctx, request) if err != nil { log.Fatal(err) } @@ -276,11 +251,11 @@ actions: // handle response } } - - target: $["paths"]["/multistream/target/{id}"]["delete"] + - target: $["paths"]["/task"]["get"] update: x-codeSamples: - lang: go - label: deleteMultistreamTarget + label: getTasks source: |- package main @@ -294,26 +269,27 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" + ctx := context.Background() - res, err := s.Multistream.Delete(ctx, id) + res, err := s.Task.GetAll(ctx) if err != nil { log.Fatal(err) } - if res != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/room/{id}/egress"]["delete"] + - target: $["paths"]["/stream/{id}"]["patch"] update: x-codeSamples: - lang: go - label: stopRoomEgress + label: updateStream source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -323,8 +299,46 @@ actions: livepeergo.WithSecurity(""), ) var id string = "" + + streamPatchPayload := components.StreamPatchPayload{ + Record: livepeergo.Bool(false), + Multistream: &components.Multistream{ + Targets: []components.Target{ + components.Target{ + Profile: "720p", + VideoOnly: livepeergo.Bool(false), + ID: livepeergo.String("PUSH123"), + Spec: &components.TargetSpec{ + Name: livepeergo.String("My target"), + URL: "rtmps://live.my-service.tv/channel/secretKey", + }, + }, + }, + }, + PlaybackPolicy: &components.PlaybackPolicy{ + Type: components.TypeWebhook, + WebhookID: livepeergo.String("1bde4o2i6xycudoy"), + WebhookContext: map[string]any{ + "streamerId": "my-custom-id", + }, + RefreshInterval: livepeergo.Float64(600), + }, + Profiles: []components.FfmpegProfile{ + components.FfmpegProfile{ + Width: 1280, + Name: "720p", + Height: 857478, + Bitrate: 3000000, + Fps: 30, + FpsDen: livepeergo.Int64(1), + Quality: livepeergo.Int64(23), + Gop: livepeergo.String("2"), + Profile: components.ProfileH264Baseline.ToPointer(), + }, + }, + } ctx := context.Background() - res, err := s.Room.StopEgress(ctx, id) + res, err := s.Stream.Update(ctx, id, streamPatchPayload) if err != nil { log.Fatal(err) } @@ -332,11 +346,11 @@ actions: // handle response } } - - target: $["paths"]["/access-control/signing-key/{keyId}"]["get"] + - target: $["paths"]["/webhook/{id}"]["delete"] update: x-codeSamples: - lang: go - label: getSigningKey + label: deleteWebhook source: |- package main @@ -350,21 +364,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var keyID string = "" + var id string = "" ctx := context.Background() - res, err := s.AccessControl.Get(ctx, keyID) + res, err := s.Webhook.Delete(ctx, id) if err != nil { log.Fatal(err) } - if res.SigningKey != nil { + if res.Webhook != nil { // handle response } } - - target: $["paths"]["/webhook/{id}/log/{logId}"]["get"] + - target: $["paths"]["/room/{id}/user/{userId}"]["get"] update: x-codeSamples: - lang: go - label: getWebhookLog + label: getRoomUser source: |- package main @@ -380,26 +394,27 @@ actions: ) var id string = "" - var logID string = "" + var userID string = "" ctx := context.Background() - res, err := s.Webhook.GetLog(ctx, id, logID) + res, err := s.Room.GetUser(ctx, id, userID) if err != nil { log.Fatal(err) } - if res.WebhookLog != nil { + if res.GetRoomUserResponse != nil { // handle response } } - - target: $["paths"]["/access-control/signing-key"]["get"] + - target: $["paths"]["/data/views/query/creator"]["get"] update: x-codeSamples: - lang: go - label: getSigningKeys + label: getCreatorViewershipMetrics source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -408,9 +423,37 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) + request := operations.GetCreatorViewershipMetricsRequest{} + ctx := context.Background() + res, err := s.Metrics.GetCreatorViewership(ctx, request) + if err != nil { + log.Fatal(err) + } + if res.Data != nil { + // handle response + } + } + - target: $["paths"]["/data/views/query/total/{playbackId}"]["get"] + update: + x-codeSamples: + - lang: go + label: getPublicViewershipMetrics + source: |- + package main + + import( + livepeergo "github.com/livepeer/livepeer-go" + "context" + "log" + ) + func main() { + s := livepeergo.New( + livepeergo.WithSecurity(""), + ) + var playbackID string = "" ctx := context.Background() - res, err := s.AccessControl.GetAll(ctx) + res, err := s.Metrics.GetPublicViewership(ctx, playbackID) if err != nil { log.Fatal(err) } @@ -459,17 +502,16 @@ actions: // handle response } } - - target: $["paths"]["/data/views/query/creator"]["get"] + - target: $["paths"]["/room"]["post"] update: x-codeSamples: - lang: go - label: getCreatorViewershipMetrics + label: createRoom source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -478,21 +520,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := operations.GetCreatorViewershipMetricsRequest{} + ctx := context.Background() - res, err := s.Metrics.GetCreatorViewership(ctx, request) + res, err := s.Room.Create(ctx) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res.CreateRoomResponse != nil { // handle response } } - - target: $["paths"]["/webhook/{id}"]["delete"] + - target: $["paths"]["/access-control/signing-key"]["post"] update: x-codeSamples: - lang: go - label: deleteWebhook + label: createSigningKey source: |- package main @@ -506,27 +548,26 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" + ctx := context.Background() - res, err := s.Webhook.Delete(ctx, id) + res, err := s.AccessControl.Create(ctx) if err != nil { log.Fatal(err) } - if res.Webhook != nil { + if res.SigningKey != nil { // handle response } } - - target: $["paths"]["/asset/request-upload"]["post"] + - target: $["paths"]["/stream/{id}"]["delete"] update: x-codeSamples: - lang: go - label: requestUpload + label: deleteStream source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -535,45 +576,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := components.NewAssetPayload{ - Name: "filename.mp4", - StaticMp4: livepeergo.Bool(true), - PlaybackPolicy: &components.PlaybackPolicy{ - Type: components.TypeWebhook, - WebhookID: livepeergo.String("1bde4o2i6xycudoy"), - WebhookContext: map[string]any{ - "streamerId": "my-custom-id", - }, - RefreshInterval: livepeergo.Float64(600), - }, - Profiles: []components.TranscodeProfile{ - components.TranscodeProfile{ - Width: livepeergo.Int64(1280), - Name: livepeergo.String("720p"), - Bitrate: 3000000, - Quality: livepeergo.Int64(23), - Fps: livepeergo.Int64(30), - FpsDen: livepeergo.Int64(1), - Gop: livepeergo.String("2"), - Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(), - Encoder: components.TranscodeProfileEncoderH264.ToPointer(), - }, - }, - } + var id string = "" ctx := context.Background() - res, err := s.Asset.Create(ctx, request) + res, err := s.Stream.Delete(ctx, id) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res != nil { // handle response } } - - target: $["paths"]["/stream/{id}/multistream/{targetId}"]["delete"] + - target: $["paths"]["/multistream/target"]["get"] update: x-codeSamples: - lang: go - label: removeMultistreamTarget + label: getMultistreamTargets source: |- package main @@ -587,23 +604,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" - var targetID string = "" ctx := context.Background() - res, err := s.Stream.RemoveMultistreamTarget(ctx, id, targetID) + res, err := s.Multistream.GetAll(ctx) if err != nil { log.Fatal(err) } - if res != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/multistream/target/{id}"]["get"] + - target: $["paths"]["/webhook/{id}"]["get"] update: x-codeSamples: - lang: go - label: getMultistreamTarget + label: getWebhook source: |- package main @@ -619,24 +634,25 @@ actions: ) var id string = "" ctx := context.Background() - res, err := s.Multistream.Get(ctx, id) + res, err := s.Webhook.Get(ctx, id) if err != nil { log.Fatal(err) } - if res.MultistreamTarget != nil { + if res.Webhook != nil { // handle response } } - - target: $["paths"]["/room/{id}/user/{userId}"]["get"] + - target: $["paths"]["/asset/upload/url"]["post"] update: x-codeSamples: - lang: go - label: getRoomUser + label: uploadAsset source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -645,23 +661,46 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" - - var userID string = "" + request := components.NewAssetFromURLPayload{ + Name: "filename.mp4", + StaticMp4: livepeergo.Bool(true), + PlaybackPolicy: &components.PlaybackPolicy{ + Type: components.TypeWebhook, + WebhookID: livepeergo.String("1bde4o2i6xycudoy"), + WebhookContext: map[string]any{ + "streamerId": "my-custom-id", + }, + RefreshInterval: livepeergo.Float64(600), + }, + URL: "https://s3.amazonaws.com/my-bucket/path/filename.mp4", + Profiles: []components.TranscodeProfile{ + components.TranscodeProfile{ + Width: livepeergo.Int64(1280), + Name: livepeergo.String("720p"), + Bitrate: 3000000, + Quality: livepeergo.Int64(23), + Fps: livepeergo.Int64(30), + FpsDen: livepeergo.Int64(1), + Gop: livepeergo.String("2"), + Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(), + Encoder: components.TranscodeProfileEncoderH264.ToPointer(), + }, + }, + } ctx := context.Background() - res, err := s.Room.GetUser(ctx, id, userID) + res, err := s.Asset.CreateViaURL(ctx, request) if err != nil { log.Fatal(err) } - if res.GetRoomUserResponse != nil { + if res.TwoHundredApplicationJSONData != nil { // handle response } } - - target: $["paths"]["/task"]["get"] + - target: $["paths"]["/asset/{assetId}"]["get"] update: x-codeSamples: - lang: go - label: getTasks + label: getAsset source: |- package main @@ -675,27 +714,26 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - + var assetID string = "" ctx := context.Background() - res, err := s.Task.GetAll(ctx) + res, err := s.Asset.Get(ctx, assetID) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res.Asset != nil { // handle response } } - - target: $["paths"]["/transcode"]["post"] + - target: $["paths"]["/access-control/signing-key/{keyId}"]["delete"] update: x-codeSamples: - lang: go - label: transcodeVideo + label: deleteSigningKey source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -704,62 +742,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := components.TranscodePayload{ - Input: components.CreateInputInput1( - components.Input1{ - URL: "https://s3.amazonaws.com/bucket/file.mp4", - }, - ), - Storage: components.CreateTranscodePayloadStorageStorage1( - components.Storage1{ - Type: components.StorageTypeS3, - Endpoint: "https://gateway.storjshare.io", - Bucket: "outputbucket", - Credentials: components.StorageCredentials{ - AccessKeyID: "AKIAIOSFODNN7EXAMPLE", - SecretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", - }, - }, - ), - Outputs: components.Outputs{ - Hls: &components.Hls{ - Path: "/samplevideo/hls", - }, - Mp4: &components.Mp4{ - Path: "/samplevideo/mp4", - }, - Fmp4: &components.Fmp4{ - Path: "/samplevideo/fmp4", - }, - }, - Profiles: []components.TranscodeProfile{ - components.TranscodeProfile{ - Width: livepeergo.Int64(1280), - Name: livepeergo.String("720p"), - Bitrate: 3000000, - Quality: livepeergo.Int64(23), - Fps: livepeergo.Int64(30), - FpsDen: livepeergo.Int64(1), - Gop: livepeergo.String("2"), - Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(), - Encoder: components.TranscodeProfileEncoderH264.ToPointer(), - }, - }, - } + var keyID string = "" ctx := context.Background() - res, err := s.Transcode.Create(ctx, request) + res, err := s.AccessControl.Delete(ctx, keyID) if err != nil { log.Fatal(err) } - if res.Task != nil { + if res != nil { // handle response } } - - target: $["paths"]["/stream/{id}"]["delete"] + - target: $["paths"]["/stream/{id}"]["get"] update: x-codeSamples: - lang: go - label: deleteStream + label: getStream source: |- package main @@ -775,19 +772,19 @@ actions: ) var id string = "" ctx := context.Background() - res, err := s.Stream.Delete(ctx, id) + res, err := s.Stream.Get(ctx, id) if err != nil { log.Fatal(err) } - if res != nil { + if res.Stream != nil { // handle response } } - - target: $["paths"]["/stream/{id}/create-multistream-target"]["post"] + - target: $["paths"]["/asset/request-upload"]["post"] update: x-codeSamples: - lang: go - label: addMultistreamTarget + label: requestUpload source: |- package main @@ -802,31 +799,45 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" - - targetAddPayload := components.TargetAddPayload{ - Profile: "720p0", - VideoOnly: livepeergo.Bool(false), - ID: livepeergo.String("PUSH123"), - Spec: &components.TargetAddPayloadSpec{ - Name: livepeergo.String("My target"), - URL: "rtmps://live.my-service.tv/channel/secretKey", + request := components.NewAssetPayload{ + Name: "filename.mp4", + StaticMp4: livepeergo.Bool(true), + PlaybackPolicy: &components.PlaybackPolicy{ + Type: components.TypeWebhook, + WebhookID: livepeergo.String("1bde4o2i6xycudoy"), + WebhookContext: map[string]any{ + "streamerId": "my-custom-id", + }, + RefreshInterval: livepeergo.Float64(600), + }, + Profiles: []components.TranscodeProfile{ + components.TranscodeProfile{ + Width: livepeergo.Int64(1280), + Name: livepeergo.String("720p"), + Bitrate: 3000000, + Quality: livepeergo.Int64(23), + Fps: livepeergo.Int64(30), + FpsDen: livepeergo.Int64(1), + Gop: livepeergo.String("2"), + Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(), + Encoder: components.TranscodeProfileEncoderH264.ToPointer(), + }, }, } ctx := context.Background() - res, err := s.Stream.AddMultistreamTarget(ctx, id, targetAddPayload) + res, err := s.Asset.Create(ctx, request) if err != nil { log.Fatal(err) } - if res != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/webhook/{id}"]["put"] + - target: $["paths"]["/room/{id}/egress"]["post"] update: x-codeSamples: - lang: go - label: updateWebhook + label: startRoomEgress source: |- package main @@ -843,30 +854,23 @@ actions: ) var id string = "" - webhook := components.WebhookInput{ - Name: "test_webhook", - Events: []components.Events{ - components.EventsStreamStarted, - components.EventsStreamIdle, - }, - URL: "https://my-service.com/webhook", - SharedSecret: livepeergo.String("my-secret"), - StreamID: livepeergo.String("de7818e7-610a-4057-8f6f-b785dc1e6f88"), + roomEgressPayload := components.RoomEgressPayload{ + StreamID: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", } ctx := context.Background() - res, err := s.Webhook.Update(ctx, id, webhook) + res, err := s.Room.StartEgress(ctx, id, roomEgressPayload) if err != nil { log.Fatal(err) } - if res.Webhook != nil { + if res != nil { // handle response } } - - target: $["paths"]["/asset"]["get"] + - target: $["paths"]["/multistream/target/{id}"]["delete"] update: x-codeSamples: - lang: go - label: getAssets + label: deleteMultistreamTarget source: |- package main @@ -880,21 +884,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - + var id string = "" ctx := context.Background() - res, err := s.Asset.GetAll(ctx) + res, err := s.Multistream.Delete(ctx, id) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res != nil { // handle response } } - - target: $["paths"]["/stream/{parentId}/sessions"]["get"] + - target: $["paths"]["/webhook/{id}/log/{logId}"]["get"] update: x-codeSamples: - lang: go - label: getRecordedSessions + label: getWebhookLog source: |- package main @@ -908,23 +912,23 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var parentID string = "" + var id string = "" - var record *int64 = livepeergo.Int64(1) + var logID string = "" ctx := context.Background() - res, err := s.Session.GetRecorded(ctx, parentID, record) + res, err := s.Webhook.GetLog(ctx, id, logID) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res.WebhookLog != nil { // handle response } } - - target: $["paths"]["/room"]["post"] + - target: $["paths"]["/room/{id}/user/{userId}"]["delete"] update: x-codeSamples: - lang: go - label: createRoom + label: deleteRoomUser source: |- package main @@ -938,27 +942,28 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) + var id string = "" + var userID string = "" ctx := context.Background() - res, err := s.Room.Create(ctx) + res, err := s.Room.DeleteUser(ctx, id, userID) if err != nil { log.Fatal(err) } - if res.CreateRoomResponse != nil { + if res != nil { // handle response } } - - target: $["paths"]["/data/usage/query"]["get"] + - target: $["paths"]["/webhook"]["get"] update: x-codeSamples: - lang: go - label: getUsageMetrics + label: getWebhooks source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -967,49 +972,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := operations.GetUsageMetricsRequest{} - ctx := context.Background() - res, err := s.Metrics.GetUsage(ctx, request) - if err != nil { - log.Fatal(err) - } - if res.UsageMetric != nil { - // handle response - } - } - - target: $["paths"]["/webhook/{id}"]["get"] - update: - x-codeSamples: - - lang: go - label: getWebhook - source: |- - package main - - import( - livepeergo "github.com/livepeer/livepeer-go" - "context" - "log" - ) - func main() { - s := livepeergo.New( - livepeergo.WithSecurity(""), - ) - var id string = "" ctx := context.Background() - res, err := s.Webhook.Get(ctx, id) + res, err := s.Webhook.GetAll(ctx) if err != nil { log.Fatal(err) } - if res.Webhook != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/asset/{assetId}"]["delete"] + - target: $["paths"]["/room/{id}"]["delete"] update: x-codeSamples: - lang: go - label: deleteAsset + label: deleteRoom source: |- package main @@ -1023,9 +1000,9 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var assetID string = "" + var id string = "" ctx := context.Background() - res, err := s.Asset.Delete(ctx, assetID) + res, err := s.Room.Delete(ctx, id) if err != nil { log.Fatal(err) } @@ -1033,16 +1010,17 @@ actions: // handle response } } - - target: $["paths"]["/session"]["get"] + - target: $["paths"]["/room/{id}/user"]["post"] update: x-codeSamples: - lang: go - label: getSessions + label: createRoomUser source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1051,21 +1029,27 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) + var id string = "" + roomUserPayload := components.RoomUserPayload{ + Name: "name", + CanPublish: livepeergo.Bool(true), + CanPublishData: livepeergo.Bool(true), + } ctx := context.Background() - res, err := s.Session.GetAll(ctx) + res, err := s.Room.CreateUser(ctx, id, roomUserPayload) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res.RoomUserResponse != nil { // handle response } } - - target: $["paths"]["/access-control/signing-key/{keyId}"]["delete"] + - target: $["paths"]["/stream/{id}/multistream/{targetId}"]["delete"] update: x-codeSamples: - lang: go - label: deleteSigningKey + label: removeMultistreamTarget source: |- package main @@ -1079,9 +1063,11 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var keyID string = "" + var id string = "" + + var targetID string = "" ctx := context.Background() - res, err := s.AccessControl.Delete(ctx, keyID) + res, err := s.Stream.RemoveMultistreamTarget(ctx, id, targetID) if err != nil { log.Fatal(err) } @@ -1089,17 +1075,16 @@ actions: // handle response } } - - target: $["paths"]["/asset/upload/url"]["post"] + - target: $["paths"]["/session"]["get"] update: x-codeSamples: - lang: go - label: uploadAsset + label: getSessions source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1108,46 +1093,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := components.NewAssetFromURLPayload{ - Name: "filename.mp4", - StaticMp4: livepeergo.Bool(true), - PlaybackPolicy: &components.PlaybackPolicy{ - Type: components.TypeWebhook, - WebhookID: livepeergo.String("1bde4o2i6xycudoy"), - WebhookContext: map[string]any{ - "streamerId": "my-custom-id", - }, - RefreshInterval: livepeergo.Float64(600), - }, - URL: "https://s3.amazonaws.com/my-bucket/path/filename.mp4", - Profiles: []components.TranscodeProfile{ - components.TranscodeProfile{ - Width: livepeergo.Int64(1280), - Name: livepeergo.String("720p"), - Bitrate: 3000000, - Quality: livepeergo.Int64(23), - Fps: livepeergo.Int64(30), - FpsDen: livepeergo.Int64(1), - Gop: livepeergo.String("2"), - Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(), - Encoder: components.TranscodeProfileEncoderH264.ToPointer(), - }, - }, - } + ctx := context.Background() - res, err := s.Asset.CreateViaURL(ctx, request) + res, err := s.Session.GetAll(ctx) if err != nil { log.Fatal(err) } - if res.TwoHundredApplicationJSONData != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/session/{id}/clips"]["get"] + - target: $["paths"]["/room/{id}/egress"]["delete"] update: x-codeSamples: - lang: go - label: getSessionClips + label: stopRoomEgress source: |- package main @@ -1163,24 +1123,25 @@ actions: ) var id string = "" ctx := context.Background() - res, err := s.Session.GetClips(ctx, id) + res, err := s.Room.StopEgress(ctx, id) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res != nil { // handle response } } - - target: $["paths"]["/webhook"]["get"] + - target: $["paths"]["/access-control/signing-key/{keyId}"]["patch"] update: x-codeSamples: - lang: go - label: getWebhooks + label: updateSigningKey source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -1189,27 +1150,28 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) + var keyID string = "" + requestBody := operations.UpdateSigningKeyRequestBody{} ctx := context.Background() - res, err := s.Webhook.GetAll(ctx) + res, err := s.AccessControl.Update(ctx, keyID, requestBody) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res != nil { // handle response } } - - target: $["paths"]["/room/{id}/user/{userId}"]["put"] + - target: $["paths"]["/stream/{id}/terminate"]["delete"] update: x-codeSamples: - lang: go - label: updateRoomUser + label: terminateStream source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1219,15 +1181,8 @@ actions: livepeergo.WithSecurity(""), ) var id string = "" - - var userID string = "" - - roomUserUpdatePayload := components.RoomUserUpdatePayload{ - CanPublish: livepeergo.Bool(true), - CanPublishData: livepeergo.Bool(true), - } ctx := context.Background() - res, err := s.Room.UpdateUser(ctx, id, userID, roomUserUpdatePayload) + res, err := s.Stream.Terminate(ctx, id) if err != nil { log.Fatal(err) } @@ -1235,16 +1190,17 @@ actions: // handle response } } - - target: $["paths"]["/asset/{assetId}"]["get"] + - target: $["paths"]["/multistream/target/{id}"]["patch"] update: x-codeSamples: - lang: go - label: getAsset + label: updateMultistreamTarget source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1253,26 +1209,31 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var assetID string = "" + var id string = "" + + multistreamTargetPatchPayload := components.MultistreamTargetPatchPayload{ + URL: "rtmps://live.my-service.tv/channel/secretKey", + } ctx := context.Background() - res, err := s.Asset.Get(ctx, assetID) + res, err := s.Multistream.Update(ctx, id, multistreamTargetPatchPayload) if err != nil { log.Fatal(err) } - if res.Asset != nil { + if res != nil { // handle response } } - - target: $["paths"]["/room/{id}"]["get"] + - target: $["paths"]["/webhook/{id}"]["put"] update: x-codeSamples: - lang: go - label: getRoom + label: updateWebhook source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1282,26 +1243,36 @@ actions: livepeergo.WithSecurity(""), ) var id string = "" + + webhook := components.WebhookInput{ + Name: "test_webhook", + Events: []components.Events{ + components.EventsStreamStarted, + components.EventsStreamIdle, + }, + URL: "https://my-service.com/webhook", + SharedSecret: livepeergo.String("my-secret"), + StreamID: livepeergo.String("de7818e7-610a-4057-8f6f-b785dc1e6f88"), + } ctx := context.Background() - res, err := s.Room.Get(ctx, id) + res, err := s.Webhook.Update(ctx, id, webhook) if err != nil { log.Fatal(err) } - if res.Room != nil { + if res.Webhook != nil { // handle response } } - - target: $["paths"]["/room/{id}/egress"]["post"] + - target: $["paths"]["/session/{id}/clips"]["get"] update: x-codeSamples: - lang: go - label: startRoomEgress + label: getSessionClips source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1311,30 +1282,25 @@ actions: livepeergo.WithSecurity(""), ) var id string = "" - - roomEgressPayload := components.RoomEgressPayload{ - StreamID: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", - } ctx := context.Background() - res, err := s.Room.StartEgress(ctx, id, roomEgressPayload) + res, err := s.Session.GetClips(ctx, id) if err != nil { log.Fatal(err) } - if res != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/data/views/query"]["get"] + - target: $["paths"]["/access-control/signing-key/{keyId}"]["get"] update: x-codeSamples: - lang: go - label: getViewershipMetrics + label: getSigningKey source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -1343,21 +1309,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := operations.GetViewershipMetricsRequest{} + var keyID string = "" ctx := context.Background() - res, err := s.Metrics.GetViewership(ctx, request) + res, err := s.AccessControl.Get(ctx, keyID) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res.SigningKey != nil { // handle response } } - - target: $["paths"]["/playback/{id}"]["get"] + - target: $["paths"]["/stream/{id}/clips"]["get"] update: x-codeSamples: - lang: go - label: getPlaybackInfo + label: getClips source: |- package main @@ -1373,19 +1339,19 @@ actions: ) var id string = "" ctx := context.Background() - res, err := s.Playback.Get(ctx, id) + res, err := s.Stream.GetClips(ctx, id) if err != nil { log.Fatal(err) } - if res.PlaybackInfo != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/stream/{id}/start-pull"]["post"] + - target: $["paths"]["/webhook/{id}/log"]["get"] update: x-codeSamples: - lang: go - label: startPullStream + label: getWebhookLogs source: |- package main @@ -1401,24 +1367,25 @@ actions: ) var id string = "" ctx := context.Background() - res, err := s.Stream.StartPull(ctx, id) + res, err := s.Webhook.GetLogs(ctx, id) if err != nil { log.Fatal(err) } - if res != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/multistream/target"]["get"] + - target: $["paths"]["/data/usage/query"]["get"] update: x-codeSamples: - lang: go - label: getMultistreamTargets + label: getUsageMetrics source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -1427,21 +1394,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - + request := operations.GetUsageMetricsRequest{} ctx := context.Background() - res, err := s.Multistream.GetAll(ctx) + res, err := s.Metrics.GetUsage(ctx, request) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res.UsageMetric != nil { // handle response } } - - target: $["paths"]["/room/{id}/user"]["post"] + - target: $["paths"]["/transcode"]["post"] update: x-codeSamples: - lang: go - label: createRoomUser + label: transcodeVideo source: |- package main @@ -1456,32 +1423,68 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" - - roomUserPayload := components.RoomUserPayload{ - Name: "name", - CanPublish: livepeergo.Bool(true), - CanPublishData: livepeergo.Bool(true), - } - ctx := context.Background() - res, err := s.Room.CreateUser(ctx, id, roomUserPayload) - if err != nil { - log.Fatal(err) - } - if res.RoomUserResponse != nil { - // handle response - } - } - - target: $["paths"]["/access-control/signing-key"]["post"] - update: + request := components.TranscodePayload{ + Input: components.CreateInputInput1( + components.Input1{ + URL: "https://s3.amazonaws.com/bucket/file.mp4", + }, + ), + Storage: components.CreateTranscodePayloadStorageStorage1( + components.Storage1{ + Type: components.StorageTypeS3, + Endpoint: "https://gateway.storjshare.io", + Bucket: "outputbucket", + Credentials: components.StorageCredentials{ + AccessKeyID: "AKIAIOSFODNN7EXAMPLE", + SecretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + }, + }, + ), + Outputs: components.Outputs{ + Hls: &components.Hls{ + Path: "/samplevideo/hls", + }, + Mp4: &components.Mp4{ + Path: "/samplevideo/mp4", + }, + Fmp4: &components.Fmp4{ + Path: "/samplevideo/fmp4", + }, + }, + Profiles: []components.TranscodeProfile{ + components.TranscodeProfile{ + Width: livepeergo.Int64(1280), + Name: livepeergo.String("720p"), + Bitrate: 3000000, + Quality: livepeergo.Int64(23), + Fps: livepeergo.Int64(30), + FpsDen: livepeergo.Int64(1), + Gop: livepeergo.String("2"), + Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(), + Encoder: components.TranscodeProfileEncoderH264.ToPointer(), + }, + }, + } + ctx := context.Background() + res, err := s.Transcode.Create(ctx, request) + if err != nil { + log.Fatal(err) + } + if res.Task != nil { + // handle response + } + } + - target: $["paths"]["/stream"]["post"] + update: x-codeSamples: - lang: go - label: createSigningKey + label: createStream source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1490,26 +1493,74 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - + request := components.NewStreamPayload{ + Name: "test_stream", + Pull: &components.Pull{ + Source: "https://myservice.com/live/stream.flv", + Headers: map[string]string{ + "Authorization": "Bearer 123", + }, + Location: &components.Location{ + Lat: 39.739, + Lon: -104.988, + }, + }, + PlaybackPolicy: &components.PlaybackPolicy{ + Type: components.TypeWebhook, + WebhookID: livepeergo.String("1bde4o2i6xycudoy"), + WebhookContext: map[string]any{ + "streamerId": "my-custom-id", + }, + RefreshInterval: livepeergo.Float64(600), + }, + Profiles: []components.FfmpegProfile{ + components.FfmpegProfile{ + Width: 1280, + Name: "720p", + Height: 486589, + Bitrate: 3000000, + Fps: 30, + FpsDen: livepeergo.Int64(1), + Quality: livepeergo.Int64(23), + Gop: livepeergo.String("2"), + Profile: components.ProfileH264Baseline.ToPointer(), + }, + }, + Record: livepeergo.Bool(false), + Multistream: &components.Multistream{ + Targets: []components.Target{ + components.Target{ + Profile: "720p", + VideoOnly: livepeergo.Bool(false), + ID: livepeergo.String("PUSH123"), + Spec: &components.TargetSpec{ + Name: livepeergo.String("My target"), + URL: "rtmps://live.my-service.tv/channel/secretKey", + }, + }, + }, + }, + } ctx := context.Background() - res, err := s.AccessControl.Create(ctx) + res, err := s.Stream.Create(ctx, request) if err != nil { log.Fatal(err) } - if res.SigningKey != nil { + if res.Stream != nil { // handle response } } - - target: $["paths"]["/stream/{id}/terminate"]["delete"] + - target: $["paths"]["/stream/{parentId}/sessions"]["get"] update: x-codeSamples: - lang: go - label: terminateStream + label: getRecordedSessions source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -1518,21 +1569,25 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" + var parentID string = "" + + var record *operations.Record = operations.CreateRecordBoolean( + true, + ) ctx := context.Background() - res, err := s.Stream.Terminate(ctx, id) + res, err := s.Session.GetRecorded(ctx, parentID, record) if err != nil { log.Fatal(err) } - if res != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/webhook/{id}/log/{logId}/resend"]["post"] + - target: $["paths"]["/stream/{id}/start-pull"]["post"] update: x-codeSamples: - lang: go - label: resendWebhook + label: startPullStream source: |- package main @@ -1547,22 +1602,20 @@ actions: livepeergo.WithSecurity(""), ) var id string = "" - - var logID string = "" ctx := context.Background() - res, err := s.Webhook.ResendLog(ctx, id, logID) + res, err := s.Stream.StartPull(ctx, id) if err != nil { log.Fatal(err) } - if res.WebhookLog != nil { + if res != nil { // handle response } } - - target: $["paths"]["/session/{id}"]["get"] + - target: $["paths"]["/access-control/signing-key"]["get"] update: x-codeSamples: - lang: go - label: getSession + label: getSigningKeys source: |- package main @@ -1576,27 +1629,26 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" + ctx := context.Background() - res, err := s.Session.Get(ctx, id) + res, err := s.AccessControl.GetAll(ctx) if err != nil { log.Fatal(err) } - if res.Session != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/multistream/target"]["post"] + - target: $["paths"]["/playback/{id}"]["get"] update: x-codeSamples: - lang: go - label: createMultistreamTarget + label: getPlaybackInfo source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1605,28 +1657,27 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := components.MultistreamTargetInput{ - URL: "rtmps://live.my-service.tv/channel/secretKey", - } + var id string = "" ctx := context.Background() - res, err := s.Multistream.Create(ctx, request) + res, err := s.Playback.Get(ctx, id) if err != nil { log.Fatal(err) } - if res.MultistreamTarget != nil { + if res.PlaybackInfo != nil { // handle response } } - - target: $["paths"]["/webhook/{id}/log"]["get"] + - target: $["paths"]["/stream/{id}/create-multistream-target"]["post"] update: x-codeSamples: - lang: go - label: getWebhookLogs + label: addMultistreamTarget source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1636,26 +1687,35 @@ actions: livepeergo.WithSecurity(""), ) var id string = "" + + targetAddPayload := components.TargetAddPayload{ + Profile: "720p0", + VideoOnly: livepeergo.Bool(false), + ID: livepeergo.String("PUSH123"), + Spec: &components.TargetAddPayloadSpec{ + Name: livepeergo.String("My target"), + URL: "rtmps://live.my-service.tv/channel/secretKey", + }, + } ctx := context.Background() - res, err := s.Webhook.GetLogs(ctx, id) + res, err := s.Stream.AddMultistreamTarget(ctx, id, targetAddPayload) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res != nil { // handle response } } - - target: $["paths"]["/webhook"]["post"] + - target: $["paths"]["/asset"]["get"] update: x-codeSamples: - lang: go - label: createWebhook + label: getAssets source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1664,30 +1724,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := components.WebhookInput{ - Name: "test_webhook", - Events: []components.Events{ - components.EventsStreamStarted, - components.EventsStreamIdle, - }, - URL: "https://my-service.com/webhook", - SharedSecret: livepeergo.String("my-secret"), - StreamID: livepeergo.String("de7818e7-610a-4057-8f6f-b785dc1e6f88"), - } + ctx := context.Background() - res, err := s.Webhook.Create(ctx, request) + res, err := s.Asset.GetAll(ctx) if err != nil { log.Fatal(err) } - if res.Webhook != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/room/{id}"]["delete"] + - target: $["paths"]["/session/{id}"]["get"] update: x-codeSamples: - lang: go - label: deleteRoom + label: getSession source: |- package main @@ -1703,19 +1754,19 @@ actions: ) var id string = "" ctx := context.Background() - res, err := s.Room.Delete(ctx, id) + res, err := s.Session.Get(ctx, id) if err != nil { log.Fatal(err) } - if res != nil { + if res.Session != nil { // handle response } } - - target: $["paths"]["/room/{id}/user/{userId}"]["delete"] + - target: $["paths"]["/task/{taskId}"]["get"] update: x-codeSamples: - lang: go - label: deleteRoomUser + label: getTask source: |- package main @@ -1729,23 +1780,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" - - var userID string = "" + var taskID string = "" ctx := context.Background() - res, err := s.Room.DeleteUser(ctx, id, userID) + res, err := s.Task.Get(ctx, taskID) if err != nil { log.Fatal(err) } - if res != nil { + if res.Task != nil { // handle response } } - - target: $["paths"]["/stream"]["post"] + - target: $["paths"]["/clip"]["post"] update: x-codeSamples: - lang: go - label: createStream + label: createClip source: |- package main @@ -1760,74 +1809,32 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := components.NewStreamPayload{ - Name: "test_stream", - Pull: &components.Pull{ - Source: "https://myservice.com/live/stream.flv", - Headers: map[string]string{ - "Authorization": "Bearer 123", - }, - Location: &components.Location{ - Lat: 39.739, - Lon: -104.988, - }, - }, - PlaybackPolicy: &components.PlaybackPolicy{ - Type: components.TypeWebhook, - WebhookID: livepeergo.String("1bde4o2i6xycudoy"), - WebhookContext: map[string]any{ - "streamerId": "my-custom-id", - }, - RefreshInterval: livepeergo.Float64(600), - }, - Profiles: []components.FfmpegProfile{ - components.FfmpegProfile{ - Width: 1280, - Name: "720p", - Height: 486589, - Bitrate: 3000000, - Fps: 30, - FpsDen: livepeergo.Int64(1), - Quality: livepeergo.Int64(23), - Gop: livepeergo.String("2"), - Profile: components.ProfileH264Baseline.ToPointer(), - }, - }, - Record: livepeergo.Bool(false), - Multistream: &components.Multistream{ - Targets: []components.Target{ - components.Target{ - Profile: "720p", - VideoOnly: livepeergo.Bool(false), - ID: livepeergo.String("PUSH123"), - Spec: &components.TargetSpec{ - Name: livepeergo.String("My target"), - URL: "rtmps://live.my-service.tv/channel/secretKey", - }, - }, - }, - }, + request := components.ClipPayload{ + PlaybackID: "eaw4nk06ts2d0mzb", + StartTime: 1587667174725, + EndTime: livepeergo.Float64(1587667174725), + Name: livepeergo.String("My Clip"), + SessionID: livepeergo.String("de7818e7-610a-4057-8f6f-b785dc1e6f88"), } ctx := context.Background() - res, err := s.Stream.Create(ctx, request) + res, err := s.Stream.CreateClip(ctx, request) if err != nil { log.Fatal(err) } - if res.Stream != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/multistream/target/{id}"]["patch"] + - target: $["paths"]["/multistream/target/{id}"]["get"] update: x-codeSamples: - lang: go - label: updateMultistreamTarget + label: getMultistreamTarget source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1837,16 +1844,12 @@ actions: livepeergo.WithSecurity(""), ) var id string = "" - - multistreamTargetPatchPayload := components.MultistreamTargetPatchPayload{ - URL: "rtmps://live.my-service.tv/channel/secretKey", - } ctx := context.Background() - res, err := s.Multistream.Update(ctx, id, multistreamTargetPatchPayload) + res, err := s.Multistream.Get(ctx, id) if err != nil { log.Fatal(err) } - if res != nil { + if res.MultistreamTarget != nil { // handle response } } diff --git a/docs/models/components/asset.md b/docs/models/components/asset.md index b841884..f5b2818 100644 --- a/docs/models/components/asset.md +++ b/docs/models/components/asset.md @@ -11,7 +11,7 @@ | ~~`UserID`~~ | **string* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | 66E2161C-7670-4D05-B71D-DA2D6979556F | | `PlaybackURL` | **string* | :heavy_minus_sign: | URL for HLS playback. **It is recommended to not use this URL**, and instead use playback IDs with the Playback Info endpoint to retrieve the playback URLs - this URL format is subject to change (e.g. https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8). | https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8 | | `DownloadURL` | **string* | :heavy_minus_sign: | The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. It is not recommended to use this for playback. | https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video | -| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for a asset or stream is public or signed | | +| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | | `Source` | [components.Source](../../models/components/source.md) | :heavy_check_mark: | N/A | | | `CreatorID` | [*components.CreatorID](../../models/components/creatorid.md) | :heavy_minus_sign: | N/A | | | `Storage` | [*components.AssetStorage](../../models/components/assetstorage.md) | :heavy_minus_sign: | N/A | | diff --git a/docs/models/components/assetpatchpayload.md b/docs/models/components/assetpatchpayload.md index 4713c3f..82552ac 100644 --- a/docs/models/components/assetpatchpayload.md +++ b/docs/models/components/assetpatchpayload.md @@ -7,5 +7,5 @@ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | | `Name` | **string* | :heavy_minus_sign: | The name of the asset. This is not necessarily the filename - it can be a custom name or title.
| filename.mp4 | | `CreatorID` | [*components.InputCreatorID](../../models/components/inputcreatorid.md) | :heavy_minus_sign: | N/A | | -| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for a asset or stream is public or signed | | +| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | | `Storage` | [*components.Storage](../../models/components/storage.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/components/meta.md b/docs/models/components/meta.md index 4e46f08..04c971e 100644 --- a/docs/models/components/meta.md +++ b/docs/models/components/meta.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | Example | | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | | `Live` | [*components.Live](../../models/components/live.md) | :heavy_minus_sign: | N/A | 0 | -| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for a asset or stream is public or signed | | +| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | | `Source` | [][components.PlaybackInfoSource](../../models/components/playbackinfosource.md) | :heavy_check_mark: | N/A | | | `DvrPlayback` | [][components.DvrPlayback](../../models/components/dvrplayback.md) | :heavy_minus_sign: | N/A | | | `Attestation` | [*components.Attestation](../../models/components/attestation.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/components/newassetfromurlpayload.md b/docs/models/components/newassetfromurlpayload.md index 5b7a5a9..3f1a16b 100644 --- a/docs/models/components/newassetfromurlpayload.md +++ b/docs/models/components/newassetfromurlpayload.md @@ -7,7 +7,7 @@ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Name` | *string* | :heavy_check_mark: | The name of the asset. This is not necessarily the filename - it can be a custom name or title.
| filename.mp4 | | `StaticMp4` | **bool* | :heavy_minus_sign: | Whether to generate MP4s for the asset. | true | -| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for a asset or stream is public or signed | | +| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | | `CreatorID` | [*components.InputCreatorID](../../models/components/inputcreatorid.md) | :heavy_minus_sign: | N/A | | | `Storage` | [*components.Storage](../../models/components/storage.md) | :heavy_minus_sign: | N/A | | | `URL` | *string* | :heavy_check_mark: | URL where the asset contents can be retrieved, e.g. `https://s3.amazonaws.com/my-bucket/path/filename.mp4`.
For an IPFS source, this should be similar to: `ipfs://{CID}`. For an Arweave
source: `ar://{CID}`.
| https://s3.amazonaws.com/my-bucket/path/filename.mp4 | diff --git a/docs/models/components/newassetpayload.md b/docs/models/components/newassetpayload.md index afa1c85..de22751 100644 --- a/docs/models/components/newassetpayload.md +++ b/docs/models/components/newassetpayload.md @@ -7,7 +7,7 @@ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | | `Name` | *string* | :heavy_check_mark: | The name of the asset. This is not necessarily the filename - it can be a custom name or title.
| filename.mp4 | | `StaticMp4` | **bool* | :heavy_minus_sign: | Whether to generate MP4s for the asset. | true | -| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for a asset or stream is public or signed | | +| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | | `CreatorID` | [*components.InputCreatorID](../../models/components/inputcreatorid.md) | :heavy_minus_sign: | N/A | | | `Storage` | [*components.NewAssetPayloadStorage](../../models/components/newassetpayloadstorage.md) | :heavy_minus_sign: | N/A | | | `Encryption` | [*components.NewAssetPayloadEncryption](../../models/components/newassetpayloadencryption.md) | :heavy_minus_sign: | N/A | | diff --git a/docs/models/components/newstreampayload.md b/docs/models/components/newstreampayload.md index 5b974c7..3b657d0 100644 --- a/docs/models/components/newstreampayload.md +++ b/docs/models/components/newstreampayload.md @@ -8,7 +8,7 @@ | `Name` | *string* | :heavy_check_mark: | N/A | test_stream | | `Pull` | [*components.Pull](../../models/components/pull.md) | :heavy_minus_sign: | Configuration for a stream that should be actively pulled from an
external source, rather than pushed to Livepeer. If specified, the
stream will not have a streamKey. | | | `CreatorID` | [*components.InputCreatorID](../../models/components/inputcreatorid.md) | :heavy_minus_sign: | N/A | | -| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for a asset or stream is public or signed | | +| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | | `Profiles` | [][components.FfmpegProfile](../../models/components/ffmpegprofile.md) | :heavy_check_mark: | N/A | | | `Record` | **bool* | :heavy_minus_sign: | Should this stream be recorded? Uses default settings. For more
customization, create and configure an object store.
| false | | `Multistream` | [*components.Multistream](../../models/components/multistream.md) | :heavy_minus_sign: | N/A | | diff --git a/docs/models/components/playbackpolicy.md b/docs/models/components/playbackpolicy.md index 277ce91..e61cc46 100644 --- a/docs/models/components/playbackpolicy.md +++ b/docs/models/components/playbackpolicy.md @@ -1,6 +1,6 @@ # PlaybackPolicy -Whether the playback policy for a asset or stream is public or signed +Whether the playback policy for an asset or stream is public or signed ## Fields diff --git a/docs/models/components/stream.md b/docs/models/components/stream.md index 5a9a148..312dbf0 100644 --- a/docs/models/components/stream.md +++ b/docs/models/components/stream.md @@ -28,7 +28,7 @@ | `StreamKey` | **string* | :heavy_minus_sign: | Used to form RTMP ingest URL | hgebdhhigq | | `Pull` | [*components.StreamPull](../../models/components/streampull.md) | :heavy_minus_sign: | Configuration for a stream that should be actively pulled from an
external source, rather than pushed to Livepeer. If specified, the
stream will not have a streamKey. | | | `PlaybackID` | **string* | :heavy_minus_sign: | The playback ID to use with the Playback Info endpoint to retrieve playback URLs. | eaw4nk06ts2d0mzb | -| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for a asset or stream is public or signed | | +| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | | `Profiles` | [][components.FfmpegProfile](../../models/components/ffmpegprofile.md) | :heavy_minus_sign: | N/A | | | `Record` | **bool* | :heavy_minus_sign: | Should this stream be recorded? Uses default settings. For more
customization, create and configure an object store.
| false | | `Multistream` | [*components.StreamMultistream](../../models/components/streammultistream.md) | :heavy_minus_sign: | N/A | | diff --git a/docs/models/components/streampatchpayload.md b/docs/models/components/streampatchpayload.md index 1737856..1fb9f4c 100644 --- a/docs/models/components/streampatchpayload.md +++ b/docs/models/components/streampatchpayload.md @@ -9,6 +9,6 @@ | `Record` | **bool* | :heavy_minus_sign: | Should this stream be recorded? Uses default settings. For more
customization, create and configure an object store.
| false | | `Suspended` | **bool* | :heavy_minus_sign: | If currently suspended | | | `Multistream` | [*components.Multistream](../../models/components/multistream.md) | :heavy_minus_sign: | N/A | | -| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for a asset or stream is public or signed | | +| `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | | `Profiles` | [][components.FfmpegProfile](../../models/components/ffmpegprofile.md) | :heavy_minus_sign: | N/A | | | `UserTags` | map[string][components.UserTags](../../models/components/usertags.md) | :heavy_minus_sign: | User input tags associated with the stream | | \ No newline at end of file diff --git a/docs/models/operations/getrecordedsessionsrequest.md b/docs/models/operations/getrecordedsessionsrequest.md index 11457f4..d31d24c 100644 --- a/docs/models/operations/getrecordedsessionsrequest.md +++ b/docs/models/operations/getrecordedsessionsrequest.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | Example | | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | | `ParentID` | *string* | :heavy_check_mark: | ID of the parent stream | | -| `Record` | **int64* | :heavy_minus_sign: | Flag indicating if the response should only include recorded
sessions
| 1 | \ No newline at end of file +| `Record` | [*operations.Record](../../models/operations/record.md) | :heavy_minus_sign: | Flag indicating if the response should only include recorded
sessions
| true | \ No newline at end of file diff --git a/docs/models/operations/record.md b/docs/models/operations/record.md new file mode 100644 index 0000000..daa55ee --- /dev/null +++ b/docs/models/operations/record.md @@ -0,0 +1,21 @@ +# Record + +Flag indicating if the response should only include recorded +sessions + + + +## Supported Types + +### + +```go +record := operations.CreateRecordBoolean(bool{/* values here */}) +``` + +### + +```go +record := operations.CreateRecordInteger(int64{/* values here */}) +``` + diff --git a/docs/sdks/session/README.md b/docs/sdks/session/README.md index 0da3f16..d08205d 100644 --- a/docs/sdks/session/README.md +++ b/docs/sdks/session/README.md @@ -160,6 +160,7 @@ package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -170,7 +171,9 @@ func main() { ) var parentID string = "" - var record *int64 = livepeergo.Int64(1) + var record *operations.Record = operations.CreateRecordBoolean( + true, + ) ctx := context.Background() res, err := s.Session.GetRecorded(ctx, parentID, record) if err != nil { @@ -188,7 +191,7 @@ func main() { | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | | `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | | | `parentID` | *string* | :heavy_check_mark: | ID of the parent stream | | -| `record` | **int64* | :heavy_minus_sign: | Flag indicating if the response should only include recorded
sessions
| 1 | +| `record` | [*operations.Record](../../models/operations/record.md) | :heavy_minus_sign: | Flag indicating if the response should only include recorded
sessions
| true | ### Response diff --git a/livepeer.go b/livepeer.go index ef46229..2d241a3 100644 --- a/livepeer.go +++ b/livepeer.go @@ -159,9 +159,9 @@ func New(opts ...SDKOption) *Livepeer { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "1.0.0", - SDKVersion: "0.1.9", - GenVersion: "2.337.1", - UserAgent: "speakeasy-sdk/go 0.1.9 2.337.1 1.0.0 github.com/livepeer/livepeer-go", + SDKVersion: "0.1.10", + GenVersion: "2.338.12", + UserAgent: "speakeasy-sdk/go 0.1.10 2.338.12 1.0.0 github.com/livepeer/livepeer-go", Hooks: hooks.New(), }, } diff --git a/models/components/asset.go b/models/components/asset.go index 1c32321..e4ff481 100644 --- a/models/components/asset.go +++ b/models/components/asset.go @@ -741,7 +741,7 @@ type Asset struct { PlaybackURL *string `json:"playbackUrl,omitempty"` // The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. It is not recommended to use this for playback. DownloadURL *string `json:"downloadUrl,omitempty"` - // Whether the playback policy for a asset or stream is public or signed + // Whether the playback policy for an asset or stream is public or signed PlaybackPolicy *PlaybackPolicy `json:"playbackPolicy,omitempty"` Source Source `json:"source"` CreatorID *CreatorID `json:"creatorId,omitempty"` diff --git a/models/components/assetpatchpayload.go b/models/components/assetpatchpayload.go index 32cf441..3842ddb 100644 --- a/models/components/assetpatchpayload.go +++ b/models/components/assetpatchpayload.go @@ -7,7 +7,7 @@ type AssetPatchPayload struct { // Name *string `json:"name,omitempty"` CreatorID *InputCreatorID `json:"creatorId,omitempty"` - // Whether the playback policy for a asset or stream is public or signed + // Whether the playback policy for an asset or stream is public or signed PlaybackPolicy *PlaybackPolicy `json:"playbackPolicy,omitempty"` Storage *Storage `json:"storage,omitempty"` } diff --git a/models/components/newassetfromurlpayload.go b/models/components/newassetfromurlpayload.go index a5d05ee..572ae6e 100644 --- a/models/components/newassetfromurlpayload.go +++ b/models/components/newassetfromurlpayload.go @@ -8,7 +8,7 @@ type NewAssetFromURLPayload struct { Name string `json:"name"` // Whether to generate MP4s for the asset. StaticMp4 *bool `json:"staticMp4,omitempty"` - // Whether the playback policy for a asset or stream is public or signed + // Whether the playback policy for an asset or stream is public or signed PlaybackPolicy *PlaybackPolicy `json:"playbackPolicy,omitempty"` CreatorID *InputCreatorID `json:"creatorId,omitempty"` Storage *Storage `json:"storage,omitempty"` diff --git a/models/components/newassetpayload.go b/models/components/newassetpayload.go index 6502ea8..52e4077 100644 --- a/models/components/newassetpayload.go +++ b/models/components/newassetpayload.go @@ -118,7 +118,7 @@ type NewAssetPayload struct { Name string `json:"name"` // Whether to generate MP4s for the asset. StaticMp4 *bool `json:"staticMp4,omitempty"` - // Whether the playback policy for a asset or stream is public or signed + // Whether the playback policy for an asset or stream is public or signed PlaybackPolicy *PlaybackPolicy `json:"playbackPolicy,omitempty"` CreatorID *InputCreatorID `json:"creatorId,omitempty"` Storage *NewAssetPayloadStorage `json:"storage,omitempty"` diff --git a/models/components/newstreampayload.go b/models/components/newstreampayload.go index 2374d1a..cf1cd19 100644 --- a/models/components/newstreampayload.go +++ b/models/components/newstreampayload.go @@ -9,7 +9,7 @@ type NewStreamPayload struct { // stream will not have a streamKey. Pull *Pull `json:"pull,omitempty"` CreatorID *InputCreatorID `json:"creatorId,omitempty"` - // Whether the playback policy for a asset or stream is public or signed + // Whether the playback policy for an asset or stream is public or signed PlaybackPolicy *PlaybackPolicy `json:"playbackPolicy,omitempty"` Profiles []FfmpegProfile `json:"profiles"` // Should this stream be recorded? Uses default settings. For more diff --git a/models/components/playbackinfo.go b/models/components/playbackinfo.go index 07803f6..e5226c9 100644 --- a/models/components/playbackinfo.go +++ b/models/components/playbackinfo.go @@ -282,7 +282,7 @@ func (o *DvrPlayback) GetError() *string { type Meta struct { Live *Live `json:"live,omitempty"` - // Whether the playback policy for a asset or stream is public or signed + // Whether the playback policy for an asset or stream is public or signed PlaybackPolicy *PlaybackPolicy `json:"playbackPolicy,omitempty"` Source []PlaybackInfoSource `json:"source"` DvrPlayback []DvrPlayback `json:"dvrPlayback,omitempty"` diff --git a/models/components/playbackpolicy.go b/models/components/playbackpolicy.go index 71bd5f7..b3ed685 100644 --- a/models/components/playbackpolicy.go +++ b/models/components/playbackpolicy.go @@ -36,7 +36,7 @@ func (e *Type) UnmarshalJSON(data []byte) error { } } -// PlaybackPolicy - Whether the playback policy for a asset or stream is public or signed +// PlaybackPolicy - Whether the playback policy for an asset or stream is public or signed type PlaybackPolicy struct { Type Type `json:"type"` // ID of the webhook to use for playback policy diff --git a/models/components/stream.go b/models/components/stream.go index 4c664eb..4dbd1e3 100644 --- a/models/components/stream.go +++ b/models/components/stream.go @@ -377,7 +377,7 @@ type Stream struct { Pull *StreamPull `json:"pull,omitempty"` // The playback ID to use with the Playback Info endpoint to retrieve playback URLs. PlaybackID *string `json:"playbackId,omitempty"` - // Whether the playback policy for a asset or stream is public or signed + // Whether the playback policy for an asset or stream is public or signed PlaybackPolicy *PlaybackPolicy `json:"playbackPolicy,omitempty"` Profiles []FfmpegProfile `json:"profiles,omitempty"` // Should this stream be recorded? Uses default settings. For more diff --git a/models/components/streampatchpayload.go b/models/components/streampatchpayload.go index c5a627e..f0482b6 100644 --- a/models/components/streampatchpayload.go +++ b/models/components/streampatchpayload.go @@ -11,7 +11,7 @@ type StreamPatchPayload struct { // If currently suspended Suspended *bool `json:"suspended,omitempty"` Multistream *Multistream `json:"multistream,omitempty"` - // Whether the playback policy for a asset or stream is public or signed + // Whether the playback policy for an asset or stream is public or signed PlaybackPolicy *PlaybackPolicy `json:"playbackPolicy,omitempty"` Profiles []FfmpegProfile `json:"profiles,omitempty"` // User input tags associated with the stream diff --git a/models/operations/getrecordedsessions.go b/models/operations/getrecordedsessions.go index 7b32d63..da28624 100644 --- a/models/operations/getrecordedsessions.go +++ b/models/operations/getrecordedsessions.go @@ -3,17 +3,85 @@ package operations import ( + "errors" + "fmt" + "github.com/livepeer/livepeer-go/internal/utils" "github.com/livepeer/livepeer-go/models/components" "github.com/livepeer/livepeer-go/models/sdkerrors" ) +type RecordType string + +const ( + RecordTypeBoolean RecordType = "boolean" + RecordTypeInteger RecordType = "integer" +) + +// Record - Flag indicating if the response should only include recorded +// sessions +type Record struct { + Boolean *bool + Integer *int64 + + Type RecordType +} + +func CreateRecordBoolean(boolean bool) Record { + typ := RecordTypeBoolean + + return Record{ + Boolean: &boolean, + Type: typ, + } +} + +func CreateRecordInteger(integer int64) Record { + typ := RecordTypeInteger + + return Record{ + Integer: &integer, + Type: typ, + } +} + +func (u *Record) UnmarshalJSON(data []byte) error { + + var boolean bool = false + if err := utils.UnmarshalJSON(data, &boolean, "", true, true); err == nil { + u.Boolean = &boolean + u.Type = RecordTypeBoolean + return nil + } + + var integer int64 = int64(0) + if err := utils.UnmarshalJSON(data, &integer, "", true, true); err == nil { + u.Integer = &integer + u.Type = RecordTypeInteger + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for Record", string(data)) +} + +func (u Record) MarshalJSON() ([]byte, error) { + if u.Boolean != nil { + return utils.MarshalJSON(u.Boolean, "", true) + } + + if u.Integer != nil { + return utils.MarshalJSON(u.Integer, "", true) + } + + return nil, errors.New("could not marshal union type Record: all fields are null") +} + type GetRecordedSessionsRequest struct { // ID of the parent stream ParentID string `pathParam:"style=simple,explode=false,name=parentId"` // Flag indicating if the response should only include recorded // sessions // - Record *int64 `queryParam:"style=form,explode=true,name=record"` + Record *Record `queryParam:"style=form,explode=true,name=record"` } func (o *GetRecordedSessionsRequest) GetParentID() string { @@ -23,7 +91,7 @@ func (o *GetRecordedSessionsRequest) GetParentID() string { return o.ParentID } -func (o *GetRecordedSessionsRequest) GetRecord() *int64 { +func (o *GetRecordedSessionsRequest) GetRecord() *Record { if o == nil { return nil } diff --git a/session.go b/session.go index 995189b..d6a1b9d 100644 --- a/session.go +++ b/session.go @@ -348,7 +348,7 @@ func (s *Session) Get(ctx context.Context, id string) (*operations.GetSessionRes } // GetRecorded - Retrieve Recorded Sessions -func (s *Session) GetRecorded(ctx context.Context, parentID string, record *int64) (*operations.GetRecordedSessionsResponse, error) { +func (s *Session) GetRecorded(ctx context.Context, parentID string, record *operations.Record) (*operations.GetRecordedSessionsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getRecordedSessions",