diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 2aeade8..0e51ae8 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 17bba98d-ccbf-4675-8dd5-54aa47cbeeb4 management: - docChecksum: 6c59d7f1dd85a77d4179f4842fe6f332 + docChecksum: c60a9c53ed5d7e9929597ea583b273bf docVersion: 1.0.0 - speakeasyVersion: 1.322.3 - generationVersion: 2.354.2 - releaseVersion: 0.1.12 - configChecksum: 2a12c51e224949245969932308d35510 + speakeasyVersion: 1.326.2 + generationVersion: 2.359.1 + releaseVersion: 0.1.13 + configChecksum: 41068dc9c451a95b6c79bc0bf891df6b repoURL: https://github.com/livepeer/livepeer-go.git installationURL: https://github.com/livepeer/livepeer-go features: @@ -43,6 +43,7 @@ generatedFiles: - livepeer.go - go.mod - models/sdkerrors/sdkerror.go + - retry/config.go - types/bigint.go - types/date.go - types/datetime.go @@ -81,6 +82,7 @@ generatedFiles: - /models/operations/startpullstream.go - /models/operations/terminatestream.go - /models/operations/getusagemetrics.go + - /models/operations/getrealtimeviewershipnow.go - /models/operations/getviewershipmetrics.go - /models/operations/getcreatorviewershipmetrics.go - /models/operations/getpublicviewershipmetrics.go @@ -144,6 +146,7 @@ generatedFiles: - /models/components/recordingspec.go - /models/components/targetaddpayload.go - /models/components/usagemetric.go + - /models/components/realtimeviewershipmetric.go - /models/components/viewershipmetric.go - /models/components/multistreamtarget.go - /models/components/multistreamtargetinput.go @@ -215,10 +218,13 @@ generatedFiles: - docs/models/operations/breakdownby.md - docs/models/operations/getusagemetricsrequest.md - docs/models/operations/getusagemetricsresponse.md + - docs/models/operations/queryparambreakdownby.md + - docs/models/operations/getrealtimeviewershipnowrequest.md + - docs/models/operations/getrealtimeviewershipnowresponse.md - docs/models/operations/from.md - docs/models/operations/to.md - docs/models/operations/queryparamtimestep.md - - docs/models/operations/queryparambreakdownby.md + - docs/models/operations/getviewershipmetricsqueryparambreakdownby.md - docs/models/operations/getviewershipmetricsrequest.md - docs/models/operations/getviewershipmetricsresponse.md - docs/models/operations/queryparamfrom.md @@ -367,6 +373,7 @@ generatedFiles: - docs/models/components/targetaddpayloadspec.md - docs/models/components/targetaddpayload.md - docs/models/components/usagemetric.md + - docs/models/components/realtimeviewershipmetric.md - docs/models/components/viewershipmetric.md - docs/models/components/multistreamtarget.md - docs/models/components/multistreamtargetinput.md diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index e172c17..550329f 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: true go: - version: 0.1.12 + version: 0.1.13 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 8d948cc..5ece290 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,9 +1,9 @@ -speakeasyVersion: 1.326.0 +speakeasyVersion: 1.326.2 sources: livepeer-studio-api: sourceNamespace: livepeer-studio-api - sourceRevisionDigest: sha256:8e34cc1cf037c15d85f81a409409f377f27913fd4de715ca804d07ff3d4cbfc0 - sourceBlobDigest: sha256:a799e76efe10d1504d6001d4b8863d1d8e6e3b19dcd08bc2ca9934ab1366276d + sourceRevisionDigest: sha256:6d6783c5aee8650b7d585a3620a71b14bf9d892f06925c2b5d5da5f33e56074a + sourceBlobDigest: sha256:308bae992c55d3214995e09cd4dc06aac10b28654dc3c25e03a00441673ae380 tags: - latest - main @@ -11,8 +11,8 @@ targets: livepeer-go: source: livepeer-studio-api sourceNamespace: livepeer-studio-api - sourceRevisionDigest: sha256:8e34cc1cf037c15d85f81a409409f377f27913fd4de715ca804d07ff3d4cbfc0 - sourceBlobDigest: sha256:a799e76efe10d1504d6001d4b8863d1d8e6e3b19dcd08bc2ca9934ab1366276d + sourceRevisionDigest: sha256:6d6783c5aee8650b7d585a3620a71b14bf9d892f06925c2b5d5da5f33e56074a + sourceBlobDigest: sha256:308bae992c55d3214995e09cd4dc06aac10b28654dc3c25e03a00441673ae380 outLocation: /github/workspace/repo workflow: workflowVersion: 1.0.0 diff --git a/README.md b/README.md index c822143..9af02ac 100644 --- a/README.md +++ b/README.md @@ -409,6 +409,7 @@ func main() { ### [Metrics](docs/sdks/metrics/README.md) * [GetUsage](docs/sdks/metrics/README.md#getusage) - Query usage metrics +* [GetRealtimeViewership](docs/sdks/metrics/README.md#getrealtimeviewership) - Query realtime viewership * [GetViewership](docs/sdks/metrics/README.md#getviewership) - Query viewership metrics * [GetCreatorViewership](docs/sdks/metrics/README.md#getcreatorviewership) - Query creator viewership metrics * [GetPublicViewership](docs/sdks/metrics/README.md#getpublicviewership) - Query public total views metrics diff --git a/RELEASES.md b/RELEASES.md index c779796..1c53762 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -58,4 +58,14 @@ Based on: ### Generated - [go v0.1.12] . ### Releases -- [Go v0.1.12] https://github.com/livepeer/livepeer-go/releases/tag/v0.1.12 - . \ No newline at end of file +- [Go v0.1.12] https://github.com/livepeer/livepeer-go/releases/tag/v0.1.12 - . + +## 2024-07-04 13:10:08 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.326.2 (2.359.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.1.13] . +### Releases +- [Go v0.1.13] https://github.com/livepeer/livepeer-go/releases/tag/v0.1.13 - . \ No newline at end of file diff --git a/codeSamples.yaml b/codeSamples.yaml index 3dc752c..29d1087 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -3,11 +3,11 @@ info: title: CodeSamples overlay for go target version: 0.0.0 actions: - - target: $["paths"]["/stream"]["get"] + - target: $["paths"]["/multistream/target/{id}"]["get"] update: x-codeSamples: - lang: go - label: getStreams + label: getMultistreamTarget source: |- package main @@ -21,27 +21,26 @@ 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.Multistream.Get(ctx, id) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res.MultistreamTarget != nil { // handle response } } - - target: $["paths"]["/stream/{parentId}/sessions"]["get"] + - target: $["paths"]["/session"]["get"] update: x-codeSamples: - lang: go - label: getRecordedSessions + label: getSessions source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -50,13 +49,9 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var parentID string = "" - var record *operations.Record = operations.CreateRecordBoolean( - true, - ) ctx := context.Background() - res, err := s.Session.GetRecorded(ctx, parentID, record) + res, err := s.Session.GetAll(ctx) if err != nil { log.Fatal(err) } @@ -64,11 +59,11 @@ actions: // handle response } } - - target: $["paths"]["/task/{taskId}"]["get"] + - target: $["paths"]["/data/views/query/total/{playbackId}"]["get"] update: x-codeSamples: - lang: go - label: getTask + label: getPublicViewershipMetrics source: |- package main @@ -82,21 +77,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var taskID string = "" + var playbackID string = "" ctx := context.Background() - res, err := s.Task.Get(ctx, taskID) + res, err := s.Metrics.GetPublicViewership(ctx, playbackID) if err != nil { log.Fatal(err) } - if res.Task != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/asset/{assetId}"]["delete"] + - target: $["paths"]["/multistream/target/{id}"]["delete"] update: x-codeSamples: - lang: go - label: deleteAsset + label: deleteMultistreamTarget source: |- package main @@ -110,9 +105,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.Multistream.Delete(ctx, id) if err != nil { log.Fatal(err) } @@ -120,11 +115,11 @@ actions: // handle response } } - - target: $["paths"]["/multistream/target/{id}"]["get"] + - target: $["paths"]["/room/{id}/user/{userId}"]["get"] update: x-codeSamples: - lang: go - label: getMultistreamTarget + label: getRoomUser source: |- package main @@ -139,20 +134,22 @@ actions: livepeergo.WithSecurity(""), ) var id string = "" + + var userID string = "" ctx := context.Background() - res, err := s.Multistream.Get(ctx, id) + res, err := s.Room.GetUser(ctx, id, userID) if err != nil { log.Fatal(err) } - if res.MultistreamTarget != nil { + if res.GetRoomUserResponse != nil { // handle response } } - - target: $["paths"]["/playback/{id}"]["get"] + - target: $["paths"]["/webhook/{id}/log"]["get"] update: x-codeSamples: - lang: go - label: getPlaybackInfo + label: getWebhookLogs source: |- package main @@ -168,19 +165,19 @@ actions: ) var id string = "" ctx := context.Background() - res, err := s.Playback.Get(ctx, id) + res, err := s.Webhook.GetLogs(ctx, id) if err != nil { log.Fatal(err) } - if res.PlaybackInfo != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/multistream/target/{id}"]["delete"] + - target: $["paths"]["/access-control/signing-key/{keyId}"]["delete"] update: x-codeSamples: - lang: go - label: deleteMultistreamTarget + label: deleteSigningKey source: |- package main @@ -194,9 +191,9 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" + var keyID string = "" ctx := context.Background() - res, err := s.Multistream.Delete(ctx, id) + res, err := s.AccessControl.Delete(ctx, keyID) if err != nil { log.Fatal(err) } @@ -204,16 +201,17 @@ actions: // 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" ) @@ -222,28 +220,52 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" - - var userID string = "" + request := components.NewAssetFromURLPayload{ + Name: "filename.mp4", + PlaybackPolicy: &components.PlaybackPolicy{ + RefreshInterval: livepeergo.Float64(600), + Type: components.TypeWebhook, + WebhookContext: map[string]any{ + "streamerId": "my-custom-id", + }, + WebhookID: livepeergo.String("1bde4o2i6xycudoy"), + }, + Profiles: []components.TranscodeProfile{ + components.TranscodeProfile{ + Bitrate: 3000000, + Encoder: components.EncoderH264.ToPointer(), + Fps: livepeergo.Int64(30), + FpsDen: livepeergo.Int64(1), + Gop: livepeergo.String("2"), + Name: livepeergo.String("720p"), + Profile: components.ProfileH264Baseline.ToPointer(), + Quality: livepeergo.Int64(23), + Width: livepeergo.Int64(1280), + }, + }, + StaticMp4: livepeergo.Bool(true), + URL: "https://s3.amazonaws.com/my-bucket/path/filename.mp4", + } 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"]["/webhook/{id}/log/{logId}/resend"]["post"] + - target: $["paths"]["/multistream/target/{id}"]["patch"] update: x-codeSamples: - lang: go - label: resendWebhook + label: updateMultistreamTarget source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -254,21 +276,51 @@ actions: ) var id string = "" - var logID string = "" + multistreamTargetPatchPayload := components.MultistreamTargetPatchPayload{ + URL: "rtmps://live.my-service.tv/channel/secretKey", + } ctx := context.Background() - res, err := s.Webhook.ResendLog(ctx, id, logID) + res, err := s.Multistream.Update(ctx, id, multistreamTargetPatchPayload) if err != nil { log.Fatal(err) } - if res.WebhookLog != nil { + if res != nil { // handle response } } - - target: $["paths"]["/asset/request-upload"]["post"] + - target: $["paths"]["/task/{taskId}"]["get"] update: x-codeSamples: - lang: go - label: requestUpload + label: getTask + source: |- + package main + + import( + livepeergo "github.com/livepeer/livepeer-go" + "context" + "log" + ) + + func main() { + s := livepeergo.New( + livepeergo.WithSecurity(""), + ) + var taskID string = "" + ctx := context.Background() + res, err := s.Task.Get(ctx, taskID) + if err != nil { + log.Fatal(err) + } + if res.Task != nil { + // handle response + } + } + - target: $["paths"]["/stream/{id}"]["patch"] + update: + x-codeSamples: + - lang: go + label: updateStream source: |- package main @@ -283,8 +335,22 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := components.NewAssetPayload{ - Name: "filename.mp4", + var id string = "" + + streamPatchPayload := components.StreamPatchPayload{ + Multistream: &components.Multistream{ + Targets: []components.Target{ + components.Target{ + ID: livepeergo.String("PUSH123"), + Profile: "720p", + Spec: &components.TargetSpec{ + Name: livepeergo.String("My target"), + URL: "rtmps://live.my-service.tv/channel/secretKey", + }, + VideoOnly: livepeergo.Bool(false), + }, + }, + }, PlaybackPolicy: &components.PlaybackPolicy{ RefreshInterval: livepeergo.Float64(600), Type: components.TypeWebhook, @@ -293,41 +359,56 @@ actions: }, WebhookID: livepeergo.String("1bde4o2i6xycudoy"), }, - Profiles: []components.TranscodeProfile{ - components.TranscodeProfile{ + Profiles: []components.FfmpegProfile{ + components.FfmpegProfile{ Bitrate: 3000000, - Encoder: components.EncoderH264.ToPointer(), - Fps: livepeergo.Int64(30), + Fps: 30, FpsDen: livepeergo.Int64(1), Gop: livepeergo.String("2"), - Name: livepeergo.String("720p"), - Profile: components.ProfileH264Baseline.ToPointer(), + Height: 857478, + Name: "720p", + Profile: components.FfmpegProfileProfileH264Baseline.ToPointer(), Quality: livepeergo.Int64(23), - Width: livepeergo.Int64(1280), + Width: 1280, + }, + }, + Record: livepeergo.Bool(false), + RecordingSpec: &components.RecordingSpec{ + Profiles: []components.TranscodeProfile{ + components.TranscodeProfile{ + Bitrate: 3000000, + Encoder: components.EncoderH264.ToPointer(), + Fps: livepeergo.Int64(30), + FpsDen: livepeergo.Int64(1), + Gop: livepeergo.String("2"), + Name: livepeergo.String("720p"), + Profile: components.ProfileH264Baseline.ToPointer(), + Quality: livepeergo.Int64(23), + Width: livepeergo.Int64(1280), + }, }, }, - StaticMp4: livepeergo.Bool(true), } ctx := context.Background() - res, err := s.Asset.Create(ctx, request) + res, err := s.Stream.Update(ctx, id, streamPatchPayload) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res != nil { // handle response } } - - target: $["paths"]["/room/{id}/user/{userId}"]["put"] + - target: $["paths"]["/data/views/now"]["get"] update: x-codeSamples: - lang: go - label: updateRoomUser + label: getRealtimeViewershipNow source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" + "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -336,28 +417,27 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" + var playbackID *string = livepeergo.String("") - var userID string = "" + var creatorID *string = livepeergo.String("") - roomUserUpdatePayload := components.RoomUserUpdatePayload{ - CanPublish: livepeergo.Bool(true), - CanPublishData: livepeergo.Bool(true), + var breakdownBy []operations.QueryParamBreakdownBy = []operations.QueryParamBreakdownBy{ + operations.QueryParamBreakdownByPlaybackID, } ctx := context.Background() - res, err := s.Room.UpdateUser(ctx, id, userID, roomUserUpdatePayload) + res, err := s.Metrics.GetRealtimeViewership(ctx, playbackID, creatorID, breakdownBy) if err != nil { log.Fatal(err) } - if res != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/room/{id}/user/{userId}"]["delete"] + - target: $["paths"]["/stream/{id}/multistream/{targetId}"]["delete"] update: x-codeSamples: - lang: go - label: deleteRoomUser + label: removeMultistreamTarget source: |- package main @@ -373,9 +453,9 @@ actions: ) var id string = "" - var userID string = "" + var targetID string = "" ctx := context.Background() - res, err := s.Room.DeleteUser(ctx, id, userID) + res, err := s.Stream.RemoveMultistreamTarget(ctx, id, targetID) if err != nil { log.Fatal(err) } @@ -383,11 +463,11 @@ actions: // handle response } } - - target: $["paths"]["/stream/{id}/start-pull"]["post"] + - target: $["paths"]["/session/{id}"]["get"] update: x-codeSamples: - lang: go - label: startPullStream + label: getSession source: |- package main @@ -403,19 +483,19 @@ actions: ) var id string = "" ctx := context.Background() - res, err := s.Stream.StartPull(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"]["/stream/{id}/terminate"]["delete"] + - target: $["paths"]["/stream/{id}"]["delete"] update: x-codeSamples: - lang: go - label: terminateStream + label: deleteStream source: |- package main @@ -431,7 +511,7 @@ actions: ) var id string = "" ctx := context.Background() - res, err := s.Stream.Terminate(ctx, id) + res, err := s.Stream.Delete(ctx, id) if err != nil { log.Fatal(err) } @@ -439,11 +519,11 @@ actions: // handle response } } - - target: $["paths"]["/session/{id}/clips"]["get"] + - target: $["paths"]["/playback/{id}"]["get"] update: x-codeSamples: - lang: go - label: getSessionClips + label: getPlaybackInfo source: |- package main @@ -459,24 +539,25 @@ actions: ) var id string = "" ctx := context.Background() - res, err := s.Session.GetClips(ctx, id) + res, err := s.Playback.Get(ctx, id) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res.PlaybackInfo != nil { // handle response } } - - target: $["paths"]["/webhook"]["get"] + - target: $["paths"]["/transcode"]["post"] update: x-codeSamples: - lang: go - label: getWebhooks + label: transcodeVideo source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -485,21 +566,62 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - - ctx := context.Background() - res, err := s.Webhook.GetAll(ctx) - if err != nil { - log.Fatal(err) - } - if res.Data != nil { - // handle response + request := components.TranscodePayload{ + Input: components.CreateInputInput1( + components.Input1{ + URL: "https://s3.amazonaws.com/bucket/file.mp4", + }, + ), + Outputs: components.Outputs{ + Fmp4: &components.Fmp4{ + Path: "/samplevideo/fmp4", + }, + Hls: &components.Hls{ + Path: "/samplevideo/hls", + }, + Mp4: &components.Mp4{ + Path: "/samplevideo/mp4", + }, + }, + Profiles: []components.TranscodeProfile{ + components.TranscodeProfile{ + Bitrate: 3000000, + Encoder: components.EncoderH264.ToPointer(), + Fps: livepeergo.Int64(30), + FpsDen: livepeergo.Int64(1), + Gop: livepeergo.String("2"), + Name: livepeergo.String("720p"), + Profile: components.ProfileH264Baseline.ToPointer(), + Quality: livepeergo.Int64(23), + Width: livepeergo.Int64(1280), + }, + }, + Storage: components.CreateTranscodePayloadStorageStorage1( + components.Storage1{ + Bucket: "outputbucket", + Credentials: components.StorageCredentials{ + AccessKeyID: "AKIAIOSFODNN7EXAMPLE", + SecretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + }, + Endpoint: "https://gateway.storjshare.io", + Type: components.StorageTypeS3, + }, + ), + } + ctx := context.Background() + res, err := s.Transcode.Create(ctx, request) + if err != nil { + log.Fatal(err) + } + if res.Task != nil { + // handle response } } - - target: $["paths"]["/webhook/{id}/log/{logId}"]["get"] + - target: $["paths"]["/webhook/{id}"]["delete"] update: x-codeSamples: - lang: go - label: getWebhookLog + label: deleteWebhook source: |- package main @@ -514,22 +636,20 @@ actions: livepeergo.WithSecurity(""), ) var id string = "" - - var logID string = "" ctx := context.Background() - res, err := s.Webhook.GetLog(ctx, id, logID) + res, err := s.Webhook.Delete(ctx, id) if err != nil { log.Fatal(err) } - if res.WebhookLog != nil { + if res.Webhook != nil { // handle response } } - - target: $["paths"]["/session"]["get"] + - target: $["paths"]["/webhook/{id}"]["get"] update: x-codeSamples: - lang: go - label: getSessions + label: getWebhook source: |- package main @@ -543,13 +663,13 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - + var id string = "" ctx := context.Background() - res, err := s.Session.GetAll(ctx) + res, err := s.Webhook.Get(ctx, id) if err != nil { log.Fatal(err) } - if res.Data != nil { + if res.Webhook != nil { // handle response } } @@ -581,11 +701,11 @@ actions: // handle response } } - - target: $["paths"]["/clip"]["post"] + - target: $["paths"]["/stream/{id}/create-multistream-target"]["post"] update: x-codeSamples: - lang: go - label: createClip + label: addMultistreamTarget source: |- package main @@ -600,33 +720,37 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := components.ClipPayload{ - EndTime: livepeergo.Float64(1587667174725), - Name: livepeergo.String("My Clip"), - PlaybackID: "eaw4nk06ts2d0mzb", - SessionID: livepeergo.String("de7818e7-610a-4057-8f6f-b785dc1e6f88"), - StartTime: 1587667174725, + var id string = "" + + targetAddPayload := components.TargetAddPayload{ + ID: livepeergo.String("PUSH123"), + Profile: "720p0", + Spec: &components.TargetAddPayloadSpec{ + Name: livepeergo.String("My target"), + URL: "rtmps://live.my-service.tv/channel/secretKey", + }, + VideoOnly: livepeergo.Bool(false), } ctx := context.Background() - res, err := s.Stream.CreateClip(ctx, request) + 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"]["/data/usage/query"]["get"] + - target: $["paths"]["/webhook/{id}"]["put"] update: x-codeSamples: - lang: go - label: getUsageMetrics + label: updateWebhook 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" ) @@ -635,21 +759,33 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := operations.GetUsageMetricsRequest{} + var id string = "" + + webhook := components.WebhookInput{ + Events: []components.Events{ + components.EventsStreamStarted, + components.EventsStreamIdle, + }, + Name: "test_webhook", + ProjectID: livepeergo.String("aac12556-4d65-4d34-9fb6-d1f0985eb0a9"), + SharedSecret: livepeergo.String("my-secret"), + StreamID: livepeergo.String("de7818e7-610a-4057-8f6f-b785dc1e6f88"), + URL: "https://my-service.com/webhook", + } ctx := context.Background() - res, err := s.Metrics.GetUsage(ctx, request) + res, err := s.Webhook.Update(ctx, id, webhook) if err != nil { log.Fatal(err) } - if res.UsageMetric != nil { + if res.Webhook != nil { // handle response } } - - target: $["paths"]["/access-control/signing-key"]["post"] + - target: $["paths"]["/asset/{assetId}"]["delete"] update: x-codeSamples: - lang: go - label: createSigningKey + label: deleteAsset source: |- package main @@ -663,26 +799,27 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - + var assetID string = "" ctx := context.Background() - res, err := s.AccessControl.Create(ctx) + res, err := s.Asset.Delete(ctx, assetID) if err != nil { log.Fatal(err) } - if res.SigningKey != nil { + if res != nil { // handle response } } - - target: $["paths"]["/multistream/target"]["get"] + - target: $["paths"]["/data/views/query/creator"]["get"] update: x-codeSamples: - lang: go - label: getMultistreamTargets + label: getCreatorViewershipMetrics source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -691,9 +828,9 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - + request := operations.GetCreatorViewershipMetricsRequest{} ctx := context.Background() - res, err := s.Multistream.GetAll(ctx) + res, err := s.Metrics.GetCreatorViewership(ctx, request) if err != nil { log.Fatal(err) } @@ -701,11 +838,11 @@ actions: // handle response } } - - target: $["paths"]["/room/{id}"]["delete"] + - target: $["paths"]["/room/{id}/user/{userId}"]["delete"] update: x-codeSamples: - lang: go - label: deleteRoom + label: deleteRoomUser source: |- package main @@ -720,8 +857,10 @@ actions: livepeergo.WithSecurity(""), ) var id string = "" + + var userID string = "" ctx := context.Background() - res, err := s.Room.Delete(ctx, id) + res, err := s.Room.DeleteUser(ctx, id, userID) if err != nil { log.Fatal(err) } @@ -729,11 +868,11 @@ actions: // handle response } } - - target: $["paths"]["/room/{id}/egress"]["post"] + - target: $["paths"]["/room/{id}/user/{userId}"]["put"] update: x-codeSamples: - lang: go - label: startRoomEgress + label: updateRoomUser source: |- package main @@ -750,11 +889,14 @@ actions: ) var id string = "" - roomEgressPayload := components.RoomEgressPayload{ - StreamID: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", + var userID string = "" + + roomUserUpdatePayload := components.RoomUserUpdatePayload{ + CanPublish: livepeergo.Bool(true), + CanPublishData: livepeergo.Bool(true), } ctx := context.Background() - res, err := s.Room.StartEgress(ctx, id, roomEgressPayload) + res, err := s.Room.UpdateUser(ctx, id, userID, roomUserUpdatePayload) if err != nil { log.Fatal(err) } @@ -762,11 +904,11 @@ actions: // handle response } } - - target: $["paths"]["/access-control/signing-key/{keyId}"]["delete"] + - target: $["paths"]["/access-control/signing-key"]["post"] update: x-codeSamples: - lang: go - label: deleteSigningKey + label: createSigningKey source: |- package main @@ -780,27 +922,26 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var keyID string = "" + ctx := context.Background() - res, err := s.AccessControl.Delete(ctx, keyID) + res, err := s.AccessControl.Create(ctx) if err != nil { log.Fatal(err) } - if res != nil { + if res.SigningKey != nil { // handle response } } - - target: $["paths"]["/data/views/query/creator"]["get"] + - target: $["paths"]["/stream/{id}/clips"]["get"] update: x-codeSamples: - lang: go - label: getCreatorViewershipMetrics + label: getClips source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -809,9 +950,9 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := operations.GetCreatorViewershipMetricsRequest{} + var id string = "" ctx := context.Background() - res, err := s.Metrics.GetCreatorViewership(ctx, request) + res, err := s.Stream.GetClips(ctx, id) if err != nil { log.Fatal(err) } @@ -819,11 +960,11 @@ actions: // handle response } } - - target: $["paths"]["/data/views/query/total/{playbackId}"]["get"] + - target: $["paths"]["/multistream/target"]["get"] update: x-codeSamples: - lang: go - label: getPublicViewershipMetrics + label: getMultistreamTargets source: |- package main @@ -837,9 +978,9 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var playbackID string = "" + ctx := context.Background() - res, err := s.Metrics.GetPublicViewership(ctx, playbackID) + res, err := s.Multistream.GetAll(ctx) if err != nil { log.Fatal(err) } @@ -847,11 +988,11 @@ actions: // handle response } } - - target: $["paths"]["/stream/{id}/create-multistream-target"]["post"] + - target: $["paths"]["/multistream/target"]["post"] update: x-codeSamples: - lang: go - label: addMultistreamTarget + label: createMultistreamTarget source: |- package main @@ -866,36 +1007,29 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" - - targetAddPayload := components.TargetAddPayload{ - ID: livepeergo.String("PUSH123"), - Profile: "720p0", - Spec: &components.TargetAddPayloadSpec{ - Name: livepeergo.String("My target"), - URL: "rtmps://live.my-service.tv/channel/secretKey", - }, - VideoOnly: livepeergo.Bool(false), + request := components.MultistreamTargetInput{ + URL: "rtmps://live.my-service.tv/channel/secretKey", } ctx := context.Background() - res, err := s.Stream.AddMultistreamTarget(ctx, id, targetAddPayload) + res, err := s.Multistream.Create(ctx, request) if err != nil { log.Fatal(err) } - if res != nil { + if res.MultistreamTarget != nil { // handle response } } - - target: $["paths"]["/room/{id}"]["get"] + - target: $["paths"]["/asset/{assetId}"]["patch"] update: x-codeSamples: - lang: go - label: getRoom + label: updateAsset source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -904,26 +1038,39 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" + var assetID string = "" + + assetPatchPayload := components.AssetPatchPayload{ + Name: livepeergo.String("filename.mp4"), + PlaybackPolicy: &components.PlaybackPolicy{ + RefreshInterval: livepeergo.Float64(600), + Type: components.TypeWebhook, + WebhookContext: map[string]any{ + "streamerId": "my-custom-id", + }, + WebhookID: livepeergo.String("1bde4o2i6xycudoy"), + }, + } ctx := context.Background() - res, err := s.Room.Get(ctx, id) + res, err := s.Asset.Update(ctx, assetID, assetPatchPayload) if err != nil { log.Fatal(err) } - if res.Room != nil { + if res.Asset != nil { // handle response } } - - target: $["paths"]["/task"]["get"] + - target: $["paths"]["/stream/{parentId}/sessions"]["get"] update: x-codeSamples: - lang: go - label: getTasks + label: getRecordedSessions source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -932,9 +1079,13 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) + var parentID string = "" + var record *operations.Record = operations.CreateRecordBoolean( + true, + ) ctx := context.Background() - res, err := s.Task.GetAll(ctx) + res, err := s.Session.GetRecorded(ctx, parentID, record) if err != nil { log.Fatal(err) } @@ -942,11 +1093,11 @@ actions: // handle response } } - - target: $["paths"]["/transcode"]["post"] + - target: $["paths"]["/webhook"]["post"] update: x-codeSamples: - lang: go - label: transcodeVideo + label: createWebhook source: |- package main @@ -961,62 +1112,31 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := components.TranscodePayload{ - Input: components.CreateInputInput1( - components.Input1{ - URL: "https://s3.amazonaws.com/bucket/file.mp4", - }, - ), - Outputs: components.Outputs{ - Fmp4: &components.Fmp4{ - Path: "/samplevideo/fmp4", - }, - Hls: &components.Hls{ - Path: "/samplevideo/hls", - }, - Mp4: &components.Mp4{ - Path: "/samplevideo/mp4", - }, - }, - Profiles: []components.TranscodeProfile{ - components.TranscodeProfile{ - Bitrate: 3000000, - Encoder: components.EncoderH264.ToPointer(), - Fps: livepeergo.Int64(30), - FpsDen: livepeergo.Int64(1), - Gop: livepeergo.String("2"), - Name: livepeergo.String("720p"), - Profile: components.ProfileH264Baseline.ToPointer(), - Quality: livepeergo.Int64(23), - Width: livepeergo.Int64(1280), - }, + request := components.WebhookInput{ + Events: []components.Events{ + components.EventsStreamStarted, + components.EventsStreamIdle, }, - Storage: components.CreateTranscodePayloadStorageStorage1( - components.Storage1{ - Bucket: "outputbucket", - Credentials: components.StorageCredentials{ - AccessKeyID: "AKIAIOSFODNN7EXAMPLE", - SecretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", - }, - Endpoint: "https://gateway.storjshare.io", - Type: components.StorageTypeS3, - }, - ), + Name: "test_webhook", + ProjectID: livepeergo.String("aac12556-4d65-4d34-9fb6-d1f0985eb0a9"), + SharedSecret: livepeergo.String("my-secret"), + StreamID: livepeergo.String("de7818e7-610a-4057-8f6f-b785dc1e6f88"), + URL: "https://my-service.com/webhook", } ctx := context.Background() - res, err := s.Transcode.Create(ctx, request) + res, err := s.Webhook.Create(ctx, request) if err != nil { log.Fatal(err) } - if res.Task != nil { + if res.Webhook != nil { // handle response } } - - target: $["paths"]["/webhook/{id}"]["delete"] + - target: $["paths"]["/task"]["get"] update: x-codeSamples: - lang: go - label: deleteWebhook + label: getTasks source: |- package main @@ -1030,21 +1150,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" + ctx := context.Background() - res, err := s.Webhook.Delete(ctx, id) + res, err := s.Task.GetAll(ctx) if err != nil { log.Fatal(err) } - if res.Webhook != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/asset/{assetId}"]["get"] + - target: $["paths"]["/webhook/{id}/log/{logId}/resend"]["post"] update: x-codeSamples: - lang: go - label: getAsset + label: resendWebhook source: |- package main @@ -1058,26 +1178,29 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var assetID string = "" + var id string = "" + + var logID string = "" ctx := context.Background() - res, err := s.Asset.Get(ctx, assetID) + res, err := s.Webhook.ResendLog(ctx, id, logID) if err != nil { log.Fatal(err) } - if res.Asset != nil { + if res.WebhookLog != nil { // handle response } } - - target: $["paths"]["/stream/{id}"]["get"] + - target: $["paths"]["/asset/request-upload"]["post"] update: x-codeSamples: - lang: go - label: getStream + label: requestUpload source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1086,26 +1209,51 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" + request := components.NewAssetPayload{ + Name: "filename.mp4", + PlaybackPolicy: &components.PlaybackPolicy{ + RefreshInterval: livepeergo.Float64(600), + Type: components.TypeWebhook, + WebhookContext: map[string]any{ + "streamerId": "my-custom-id", + }, + WebhookID: livepeergo.String("1bde4o2i6xycudoy"), + }, + Profiles: []components.TranscodeProfile{ + components.TranscodeProfile{ + Bitrate: 3000000, + Encoder: components.EncoderH264.ToPointer(), + Fps: livepeergo.Int64(30), + FpsDen: livepeergo.Int64(1), + Gop: livepeergo.String("2"), + Name: livepeergo.String("720p"), + Profile: components.ProfileH264Baseline.ToPointer(), + Quality: livepeergo.Int64(23), + Width: livepeergo.Int64(1280), + }, + }, + StaticMp4: livepeergo.Bool(true), + } ctx := context.Background() - res, err := s.Stream.Get(ctx, id) + res, err := s.Asset.Create(ctx, request) if err != nil { log.Fatal(err) } - if res.Stream != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/stream/{id}/clips"]["get"] + - target: $["paths"]["/clip"]["post"] update: x-codeSamples: - lang: go - label: getClips + label: createClip source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1114,9 +1262,15 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" + request := components.ClipPayload{ + EndTime: livepeergo.Float64(1587667174725), + Name: livepeergo.String("My Clip"), + PlaybackID: "eaw4nk06ts2d0mzb", + SessionID: livepeergo.String("de7818e7-610a-4057-8f6f-b785dc1e6f88"), + StartTime: 1587667174725, + } ctx := context.Background() - res, err := s.Stream.GetClips(ctx, id) + res, err := s.Stream.CreateClip(ctx, request) if err != nil { log.Fatal(err) } @@ -1124,16 +1278,17 @@ actions: // handle response } } - - target: $["paths"]["/webhook/{id}"]["get"] + - target: $["paths"]["/stream"]["post"] update: x-codeSamples: - lang: go - label: getWebhook + label: createStream source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1142,26 +1297,89 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" + request := components.NewStreamPayload{ + Multistream: &components.Multistream{ + Targets: []components.Target{ + components.Target{ + ID: livepeergo.String("PUSH123"), + Profile: "720p", + Spec: &components.TargetSpec{ + Name: livepeergo.String("My target"), + URL: "rtmps://live.my-service.tv/channel/secretKey", + }, + VideoOnly: livepeergo.Bool(false), + }, + }, + }, + Name: "test_stream", + PlaybackPolicy: &components.PlaybackPolicy{ + RefreshInterval: livepeergo.Float64(600), + Type: components.TypeWebhook, + WebhookContext: map[string]any{ + "streamerId": "my-custom-id", + }, + WebhookID: livepeergo.String("1bde4o2i6xycudoy"), + }, + Profiles: []components.FfmpegProfile{ + components.FfmpegProfile{ + Bitrate: 3000000, + Fps: 30, + FpsDen: livepeergo.Int64(1), + Gop: livepeergo.String("2"), + Height: 486589, + Name: "720p", + Profile: components.FfmpegProfileProfileH264Baseline.ToPointer(), + Quality: livepeergo.Int64(23), + Width: 1280, + }, + }, + Pull: &components.Pull{ + Headers: map[string]string{ + "Authorization": "Bearer 123", + }, + Location: &components.Location{ + Lat: 39.739, + Lon: -104.988, + }, + Source: "https://myservice.com/live/stream.flv", + }, + Record: livepeergo.Bool(false), + RecordingSpec: &components.NewStreamPayloadRecordingSpec{ + Profiles: []components.TranscodeProfile{ + components.TranscodeProfile{ + Bitrate: 3000000, + Encoder: components.EncoderH264.ToPointer(), + Fps: livepeergo.Int64(30), + FpsDen: livepeergo.Int64(1), + Gop: livepeergo.String("2"), + Name: livepeergo.String("720p"), + Profile: components.ProfileH264Baseline.ToPointer(), + Quality: livepeergo.Int64(23), + Width: livepeergo.Int64(1280), + }, + }, + }, + } ctx := context.Background() - res, err := s.Webhook.Get(ctx, id) + res, err := s.Stream.Create(ctx, request) if err != nil { log.Fatal(err) } - if res.Webhook != nil { + if res.Stream != nil { // handle response } } - - target: $["paths"]["/stream/{id}/multistream/{targetId}"]["delete"] + - target: $["paths"]["/data/views/query"]["get"] update: x-codeSamples: - lang: go - label: removeMultistreamTarget + label: getViewershipMetrics source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -1170,23 +1388,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" - - var targetID string = "" + request := operations.GetViewershipMetricsRequest{} ctx := context.Background() - res, err := s.Stream.RemoveMultistreamTarget(ctx, id, targetID) + res, err := s.Metrics.GetViewership(ctx, request) if err != nil { log.Fatal(err) } - if res != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/multistream/target"]["post"] + - target: $["paths"]["/room/{id}/egress"]["post"] update: x-codeSamples: - lang: go - label: createMultistreamTarget + label: startRoomEgress source: |- package main @@ -1201,23 +1417,25 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := components.MultistreamTargetInput{ - URL: "rtmps://live.my-service.tv/channel/secretKey", + var id string = "" + + roomEgressPayload := components.RoomEgressPayload{ + StreamID: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", } ctx := context.Background() - res, err := s.Multistream.Create(ctx, request) + res, err := s.Room.StartEgress(ctx, id, roomEgressPayload) if err != nil { log.Fatal(err) } - if res.MultistreamTarget != nil { + if res != nil { // handle response } } - - target: $["paths"]["/room"]["post"] + - target: $["paths"]["/webhook/{id}/log/{logId}"]["get"] update: x-codeSamples: - lang: go - label: createRoom + label: getWebhookLog source: |- package main @@ -1231,27 +1449,28 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) + var id string = "" + var logID string = "" ctx := context.Background() - res, err := s.Room.Create(ctx) + res, err := s.Webhook.GetLog(ctx, id, logID) if err != nil { log.Fatal(err) } - if res.CreateRoomResponse != nil { + if res.WebhookLog != nil { // handle response } } - - target: $["paths"]["/webhook/{id}"]["put"] + - target: $["paths"]["/stream/{id}"]["get"] update: x-codeSamples: - lang: go - label: updateWebhook + label: getStream source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1261,38 +1480,25 @@ actions: livepeergo.WithSecurity(""), ) var id string = "" - - webhook := components.WebhookInput{ - Events: []components.Events{ - components.EventsStreamStarted, - components.EventsStreamIdle, - }, - Name: "test_webhook", - ProjectID: livepeergo.String("aac12556-4d65-4d34-9fb6-d1f0985eb0a9"), - SharedSecret: livepeergo.String("my-secret"), - StreamID: livepeergo.String("de7818e7-610a-4057-8f6f-b785dc1e6f88"), - URL: "https://my-service.com/webhook", - } ctx := context.Background() - res, err := s.Webhook.Update(ctx, id, webhook) + res, err := s.Stream.Get(ctx, id) if err != nil { log.Fatal(err) } - if res.Webhook != nil { + if res.Stream != nil { // handle response } } - - target: $["paths"]["/access-control/signing-key/{keyId}"]["patch"] + - target: $["paths"]["/stream/{id}/start-pull"]["post"] update: x-codeSamples: - lang: go - label: updateSigningKey + label: startPullStream source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -1301,11 +1507,9 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var keyID string = "" - - requestBody := operations.UpdateSigningKeyRequestBody{} + var id string = "" ctx := context.Background() - res, err := s.AccessControl.Update(ctx, keyID, requestBody) + res, err := s.Stream.StartPull(ctx, id) if err != nil { log.Fatal(err) } @@ -1313,108 +1517,44 @@ actions: // handle response } } - - target: $["paths"]["/stream"]["post"] + - target: $["paths"]["/room/{id}/egress"]["delete"] update: x-codeSamples: - lang: go - label: createStream + label: stopRoomEgress source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) - - func main() { - s := livepeergo.New( - livepeergo.WithSecurity(""), - ) - request := components.NewStreamPayload{ - Multistream: &components.Multistream{ - Targets: []components.Target{ - components.Target{ - ID: livepeergo.String("PUSH123"), - Profile: "720p", - Spec: &components.TargetSpec{ - Name: livepeergo.String("My target"), - URL: "rtmps://live.my-service.tv/channel/secretKey", - }, - VideoOnly: livepeergo.Bool(false), - }, - }, - }, - Name: "test_stream", - PlaybackPolicy: &components.PlaybackPolicy{ - RefreshInterval: livepeergo.Float64(600), - Type: components.TypeWebhook, - WebhookContext: map[string]any{ - "streamerId": "my-custom-id", - }, - WebhookID: livepeergo.String("1bde4o2i6xycudoy"), - }, - Profiles: []components.FfmpegProfile{ - components.FfmpegProfile{ - Bitrate: 3000000, - Fps: 30, - FpsDen: livepeergo.Int64(1), - Gop: livepeergo.String("2"), - Height: 486589, - Name: "720p", - Profile: components.FfmpegProfileProfileH264Baseline.ToPointer(), - Quality: livepeergo.Int64(23), - Width: 1280, - }, - }, - Pull: &components.Pull{ - Headers: map[string]string{ - "Authorization": "Bearer 123", - }, - Location: &components.Location{ - Lat: 39.739, - Lon: -104.988, - }, - Source: "https://myservice.com/live/stream.flv", - }, - Record: livepeergo.Bool(false), - RecordingSpec: &components.NewStreamPayloadRecordingSpec{ - Profiles: []components.TranscodeProfile{ - components.TranscodeProfile{ - Bitrate: 3000000, - Encoder: components.EncoderH264.ToPointer(), - Fps: livepeergo.Int64(30), - FpsDen: livepeergo.Int64(1), - Gop: livepeergo.String("2"), - Name: livepeergo.String("720p"), - Profile: components.ProfileH264Baseline.ToPointer(), - Quality: livepeergo.Int64(23), - Width: livepeergo.Int64(1280), - }, - }, - }, - } + + func main() { + s := livepeergo.New( + livepeergo.WithSecurity(""), + ) + var id string = "" ctx := context.Background() - res, err := s.Stream.Create(ctx, request) + res, err := s.Room.StopEgress(ctx, id) if err != nil { log.Fatal(err) } - if res.Stream != nil { + if res != nil { // handle response } } - - target: $["paths"]["/stream/{id}"]["patch"] + - target: $["paths"]["/session/{id}/clips"]["get"] update: x-codeSamples: - lang: go - label: updateStream + label: getSessionClips source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1424,79 +1564,25 @@ actions: livepeergo.WithSecurity(""), ) var id string = "" - - streamPatchPayload := components.StreamPatchPayload{ - Multistream: &components.Multistream{ - Targets: []components.Target{ - components.Target{ - ID: livepeergo.String("PUSH123"), - Profile: "720p", - Spec: &components.TargetSpec{ - Name: livepeergo.String("My target"), - URL: "rtmps://live.my-service.tv/channel/secretKey", - }, - VideoOnly: livepeergo.Bool(false), - }, - }, - }, - PlaybackPolicy: &components.PlaybackPolicy{ - RefreshInterval: livepeergo.Float64(600), - Type: components.TypeWebhook, - WebhookContext: map[string]any{ - "streamerId": "my-custom-id", - }, - WebhookID: livepeergo.String("1bde4o2i6xycudoy"), - }, - Profiles: []components.FfmpegProfile{ - components.FfmpegProfile{ - Bitrate: 3000000, - Fps: 30, - FpsDen: livepeergo.Int64(1), - Gop: livepeergo.String("2"), - Height: 857478, - Name: "720p", - Profile: components.FfmpegProfileProfileH264Baseline.ToPointer(), - Quality: livepeergo.Int64(23), - Width: 1280, - }, - }, - Record: livepeergo.Bool(false), - RecordingSpec: &components.RecordingSpec{ - Profiles: []components.TranscodeProfile{ - components.TranscodeProfile{ - Bitrate: 3000000, - Encoder: components.EncoderH264.ToPointer(), - Fps: livepeergo.Int64(30), - FpsDen: livepeergo.Int64(1), - Gop: livepeergo.String("2"), - Name: livepeergo.String("720p"), - Profile: components.ProfileH264Baseline.ToPointer(), - Quality: livepeergo.Int64(23), - Width: livepeergo.Int64(1280), - }, - }, - }, - } ctx := context.Background() - res, err := s.Stream.Update(ctx, id, streamPatchPayload) + res, err := s.Session.GetClips(ctx, id) if err != nil { log.Fatal(err) } - if res != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/asset/{assetId}"]["patch"] + - target: $["paths"]["/webhook"]["get"] update: x-codeSamples: - lang: go - label: updateAsset + label: getWebhooks source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1505,39 +1591,26 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var assetID string = "" - assetPatchPayload := components.AssetPatchPayload{ - Name: livepeergo.String("filename.mp4"), - PlaybackPolicy: &components.PlaybackPolicy{ - RefreshInterval: livepeergo.Float64(600), - Type: components.TypeWebhook, - WebhookContext: map[string]any{ - "streamerId": "my-custom-id", - }, - WebhookID: livepeergo.String("1bde4o2i6xycudoy"), - }, - } ctx := context.Background() - res, err := s.Asset.Update(ctx, assetID, assetPatchPayload) + res, err := s.Webhook.GetAll(ctx) if err != nil { log.Fatal(err) } - if res.Asset != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/multistream/target/{id}"]["patch"] + - target: $["paths"]["/asset/{assetId}"]["get"] update: x-codeSamples: - lang: go - label: updateMultistreamTarget + label: getAsset source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1546,30 +1619,27 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" - - multistreamTargetPatchPayload := components.MultistreamTargetPatchPayload{ - URL: "rtmps://live.my-service.tv/channel/secretKey", - } + var assetID string = "" ctx := context.Background() - res, err := s.Multistream.Update(ctx, id, multistreamTargetPatchPayload) + res, err := s.Asset.Get(ctx, assetID) if err != nil { log.Fatal(err) } - if res != nil { + if res.Asset != nil { // handle response } } - - target: $["paths"]["/session/{id}"]["get"] + - target: $["paths"]["/data/usage/query"]["get"] update: x-codeSamples: - lang: go - label: getSession + label: getUsageMetrics source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -1578,27 +1648,26 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" + request := operations.GetUsageMetricsRequest{} ctx := context.Background() - res, err := s.Session.Get(ctx, id) + res, err := s.Metrics.GetUsage(ctx, request) if err != nil { log.Fatal(err) } - if res.Session != nil { + if res.UsageMetric != nil { // handle response } } - - target: $["paths"]["/webhook"]["post"] + - target: $["paths"]["/room/{id}"]["delete"] update: x-codeSamples: - lang: go - label: createWebhook + label: deleteRoom source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1607,36 +1676,27 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := components.WebhookInput{ - Events: []components.Events{ - components.EventsStreamStarted, - components.EventsStreamIdle, - }, - Name: "test_webhook", - ProjectID: livepeergo.String("aac12556-4d65-4d34-9fb6-d1f0985eb0a9"), - SharedSecret: livepeergo.String("my-secret"), - StreamID: livepeergo.String("de7818e7-610a-4057-8f6f-b785dc1e6f88"), - URL: "https://my-service.com/webhook", - } + var id string = "" ctx := context.Background() - res, err := s.Webhook.Create(ctx, request) + res, err := s.Room.Delete(ctx, id) if err != nil { log.Fatal(err) } - if res.Webhook != nil { + if res != nil { // handle response } } - - target: $["paths"]["/webhook/{id}/log"]["get"] + - target: $["paths"]["/access-control/signing-key/{keyId}"]["patch"] update: x-codeSamples: - lang: go - label: getWebhookLogs + label: updateSigningKey source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -1645,21 +1705,23 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" + var keyID string = "" + + requestBody := operations.UpdateSigningKeyRequestBody{} ctx := context.Background() - res, err := s.Webhook.GetLogs(ctx, id) + 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"]["/access-control/signing-key/{keyId}"]["get"] + - target: $["paths"]["/room"]["post"] update: x-codeSamples: - lang: go - label: getSigningKey + label: createRoom source: |- package main @@ -1673,27 +1735,26 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var keyID string = "" + ctx := context.Background() - res, err := s.AccessControl.Get(ctx, keyID) + res, err := s.Room.Create(ctx) if err != nil { log.Fatal(err) } - if res.SigningKey != nil { + if res.CreateRoomResponse != nil { // handle response } } - - target: $["paths"]["/data/views/query"]["get"] + - target: $["paths"]["/room/{id}"]["get"] update: x-codeSamples: - lang: go - label: getViewershipMetrics + label: getRoom source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/operations" "context" "log" ) @@ -1702,27 +1763,26 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := operations.GetViewershipMetricsRequest{} + var id string = "" ctx := context.Background() - res, err := s.Metrics.GetViewership(ctx, request) + 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"]["/room/{id}/user"]["post"] + - target: $["paths"]["/asset"]["get"] update: x-codeSamples: - lang: go - label: createRoomUser + label: getAssets source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1731,27 +1791,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" - roomUserPayload := components.RoomUserPayload{ - CanPublish: livepeergo.Bool(true), - CanPublishData: livepeergo.Bool(true), - Name: "name", - } ctx := context.Background() - res, err := s.Room.CreateUser(ctx, id, roomUserPayload) + res, err := s.Asset.GetAll(ctx) if err != nil { log.Fatal(err) } - if res.RoomUserResponse != nil { + if res.Data != nil { // handle response } } - - target: $["paths"]["/room/{id}/egress"]["delete"] + - target: $["paths"]["/stream/{id}/terminate"]["delete"] update: x-codeSamples: - lang: go - label: stopRoomEgress + label: terminateStream source: |- package main @@ -1767,7 +1821,7 @@ actions: ) var id string = "" ctx := context.Background() - res, err := s.Room.StopEgress(ctx, id) + res, err := s.Stream.Terminate(ctx, id) if err != nil { log.Fatal(err) } @@ -1775,16 +1829,17 @@ actions: // handle response } } - - target: $["paths"]["/asset"]["get"] + - target: $["paths"]["/room/{id}/user"]["post"] update: x-codeSamples: - lang: go - label: getAssets + label: createRoomUser source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1793,27 +1848,32 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) + var id string = "" + roomUserPayload := components.RoomUserPayload{ + CanPublish: livepeergo.Bool(true), + CanPublishData: livepeergo.Bool(true), + Name: "name", + } ctx := context.Background() - res, err := s.Asset.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"]["/asset/upload/url"]["post"] + - target: $["paths"]["/access-control/signing-key/{keyId}"]["get"] update: x-codeSamples: - lang: go - label: uploadAsset + label: getSigningKey source: |- package main import( livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -1822,46 +1882,21 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - request := components.NewAssetFromURLPayload{ - Name: "filename.mp4", - PlaybackPolicy: &components.PlaybackPolicy{ - RefreshInterval: livepeergo.Float64(600), - Type: components.TypeWebhook, - WebhookContext: map[string]any{ - "streamerId": "my-custom-id", - }, - WebhookID: livepeergo.String("1bde4o2i6xycudoy"), - }, - Profiles: []components.TranscodeProfile{ - components.TranscodeProfile{ - Bitrate: 3000000, - Encoder: components.EncoderH264.ToPointer(), - Fps: livepeergo.Int64(30), - FpsDen: livepeergo.Int64(1), - Gop: livepeergo.String("2"), - Name: livepeergo.String("720p"), - Profile: components.ProfileH264Baseline.ToPointer(), - Quality: livepeergo.Int64(23), - Width: livepeergo.Int64(1280), - }, - }, - StaticMp4: livepeergo.Bool(true), - URL: "https://s3.amazonaws.com/my-bucket/path/filename.mp4", - } + var keyID string = "" ctx := context.Background() - res, err := s.Asset.CreateViaURL(ctx, request) + res, err := s.AccessControl.Get(ctx, keyID) if err != nil { log.Fatal(err) } - if res.TwoHundredApplicationJSONData != nil { + if res.SigningKey != nil { // handle response } } - - target: $["paths"]["/stream/{id}"]["delete"] + - target: $["paths"]["/stream"]["get"] update: x-codeSamples: - lang: go - label: deleteStream + label: getStreams source: |- package main @@ -1875,13 +1910,13 @@ actions: s := livepeergo.New( livepeergo.WithSecurity(""), ) - var id string = "" + var streamsonly *string = livepeergo.String("") ctx := context.Background() - res, err := s.Stream.Delete(ctx, id) + res, err := s.Stream.GetAll(ctx, streamsonly) if err != nil { log.Fatal(err) } - if res != nil { + if res.Data != nil { // handle response } } diff --git a/docs/models/components/realtimeviewershipmetric.md b/docs/models/components/realtimeviewershipmetric.md new file mode 100644 index 0000000..64a92ba --- /dev/null +++ b/docs/models/components/realtimeviewershipmetric.md @@ -0,0 +1,16 @@ +# RealtimeViewershipMetric + +An individual metric about realtime viewership of a stream/asset. + + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | ------------------------------------------- | +| `Browser` | **string* | :heavy_minus_sign: | The browser used by the viewer. | Safari | +| `Country` | **string* | :heavy_minus_sign: | The country where the viewer is located. | United States | +| `Device` | **string* | :heavy_minus_sign: | The device used by the viewer. | iPhone | +| `ErrorRate` | *float64* | :heavy_check_mark: | The error rate for the stream/asset. | 0.1 | +| `PlaybackID` | **string* | :heavy_minus_sign: | The playback ID associated with the metric. | 1bde4o2i6xycudoy | +| `ViewCount` | *int64* | :heavy_check_mark: | The number of views for the stream/asset. | 100 | \ No newline at end of file diff --git a/docs/models/components/viewershipmetric.md b/docs/models/components/viewershipmetric.md index 65f0195..77d724a 100644 --- a/docs/models/components/viewershipmetric.md +++ b/docs/models/components/viewershipmetric.md @@ -1,6 +1,6 @@ # ViewershipMetric -An individual metric about viewership of an asset. Necessarily, at least +An individual metric about viewership of a stream/asset. Necessarily, at least 1 of playbackId and dStorageUrl will be present, depending on the query. @@ -18,16 +18,16 @@ An individual metric about viewership of an asset. Necessarily, at least | `DStorageURL` | **string* | :heavy_minus_sign: | The URL of the distributed storage used for the asset | ipfs://QmZ4 | | `Device` | **string* | :heavy_minus_sign: | The device used by the viewer. | iPhone | | `DeviceType` | **string* | :heavy_minus_sign: | The type of the device used by the viewer. | mobile | -| `ErrorRate` | **float64* | :heavy_minus_sign: | The error rate for the asset. | 0.1 | +| `ErrorRate` | **float64* | :heavy_minus_sign: | The error rate for the stream/asset. | 0.1 | | `ExitsBeforeStart` | **float64* | :heavy_minus_sign: | The percentage of sessions that existed before the asset started
playing.
| 0.5 | | `Geohash` | **string* | :heavy_minus_sign: | Geographic encoding of the viewers location. Accurate to 3 digits. | 123 | | `Os` | **string* | :heavy_minus_sign: | The operating system used by the viewer. | iOS | | `PlaybackID` | **string* | :heavy_minus_sign: | The playback ID associated with the metric. | 1bde4o2i6xycudoy | -| `PlaytimeMins` | *float64* | :heavy_check_mark: | The total playtime in minutes for the asset. | 10 | +| `PlaytimeMins` | *float64* | :heavy_check_mark: | The total playtime in minutes for the stream/asset. | 10 | | `RebufferRatio` | **float64* | :heavy_minus_sign: | The rebuffering ratio for the asset. | 0.1 | | `Subdivision` | **string* | :heavy_minus_sign: | The subdivision (e.g., state or province) where the viewer is
located.
| California | | `Timestamp` | **float64* | :heavy_minus_sign: | Timestamp (in milliseconds) when the metric was recorded. If the
query contains a time step, this timestamp will point to the
beginning of the time step period.
| 1587667174725 | | `Timezone` | **string* | :heavy_minus_sign: | The timezone where the viewer is located. | America/Los_Angeles | | `TtffMs` | **float64* | :heavy_minus_sign: | The time-to-first-frame (TTFF) in milliseconds. | 100 | -| `ViewCount` | *int64* | :heavy_check_mark: | The number of views for the asset. | 100 | +| `ViewCount` | *int64* | :heavy_check_mark: | The number of views for the stream/asset. | 100 | | `ViewerID` | **string* | :heavy_minus_sign: | The ID of the viewer associated with the metric. | 1bde4o2i6xycudoy | \ No newline at end of file diff --git a/docs/models/operations/getpublicviewershipmetricsdata.md b/docs/models/operations/getpublicviewershipmetricsdata.md index 39e26f0..8dee47c 100644 --- a/docs/models/operations/getpublicviewershipmetricsdata.md +++ b/docs/models/operations/getpublicviewershipmetricsdata.md @@ -11,5 +11,5 @@ asset. Either playbackId or dStorageUrl will be set. | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------- | | `DStorageURL` | **string* | :heavy_minus_sign: | The URL of the distributed storage used for the asset | ipfs://QmZ4 | | `PlaybackID` | **string* | :heavy_minus_sign: | The playback ID associated with the metric. | 1bde4o2i6xycudoy | -| `PlaytimeMins` | **float64* | :heavy_minus_sign: | The total playtime in minutes for the asset. | 10 | -| `ViewCount` | **int64* | :heavy_minus_sign: | The number of views for the asset. | 100 | \ No newline at end of file +| `PlaytimeMins` | **float64* | :heavy_minus_sign: | The total playtime in minutes for the stream/asset. | 10 | +| `ViewCount` | **int64* | :heavy_minus_sign: | The number of views for the stream/asset. | 100 | \ No newline at end of file diff --git a/docs/models/operations/getrealtimeviewershipnowrequest.md b/docs/models/operations/getrealtimeviewershipnowrequest.md new file mode 100644 index 0000000..d41b920 --- /dev/null +++ b/docs/models/operations/getrealtimeviewershipnowrequest.md @@ -0,0 +1,10 @@ +# GetRealtimeViewershipNowRequest + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `PlaybackID` | **string* | :heavy_minus_sign: | The playback ID to filter the query results. This can be a canonical
playback ID from Livepeer assets or streams, or dStorage identifiers
for assets
| +| `CreatorID` | **string* | :heavy_minus_sign: | The creator ID to filter the query results | +| `BreakdownBy` | [][operations.QueryParamBreakdownBy](../../models/operations/queryparambreakdownby.md) | :heavy_minus_sign: | The list of fields to break down the query results. Specify this
query-string multiple times to break down by multiple fields.
| \ No newline at end of file diff --git a/docs/models/operations/getrealtimeviewershipnowresponse.md b/docs/models/operations/getrealtimeviewershipnowresponse.md new file mode 100644 index 0000000..c94667f --- /dev/null +++ b/docs/models/operations/getrealtimeviewershipnowresponse.md @@ -0,0 +1,10 @@ +# GetRealtimeViewershipNowResponse + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `Data` | [][components.RealtimeViewershipMetric](../../models/components/realtimeviewershipmetric.md) | :heavy_minus_sign: | A list of Metric objects | +| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getviewershipmetricsqueryparambreakdownby.md b/docs/models/operations/getviewershipmetricsqueryparambreakdownby.md new file mode 100644 index 0000000..eda1273 --- /dev/null +++ b/docs/models/operations/getviewershipmetricsqueryparambreakdownby.md @@ -0,0 +1,21 @@ +# GetViewershipMetricsQueryParamBreakdownBy + + +## Values + +| Name | Value | +| -------------------------------------------------------- | -------------------------------------------------------- | +| `GetViewershipMetricsQueryParamBreakdownByPlaybackID` | playbackId | +| `GetViewershipMetricsQueryParamBreakdownByDeviceType` | deviceType | +| `GetViewershipMetricsQueryParamBreakdownByDevice` | device | +| `GetViewershipMetricsQueryParamBreakdownByCPU` | cpu | +| `GetViewershipMetricsQueryParamBreakdownByOs` | os | +| `GetViewershipMetricsQueryParamBreakdownByBrowser` | browser | +| `GetViewershipMetricsQueryParamBreakdownByBrowserEngine` | browserEngine | +| `GetViewershipMetricsQueryParamBreakdownByContinent` | continent | +| `GetViewershipMetricsQueryParamBreakdownByCountry` | country | +| `GetViewershipMetricsQueryParamBreakdownBySubdivision` | subdivision | +| `GetViewershipMetricsQueryParamBreakdownByTimezone` | timezone | +| `GetViewershipMetricsQueryParamBreakdownByGeohash` | geohash | +| `GetViewershipMetricsQueryParamBreakdownByViewerID` | viewerId | +| `GetViewershipMetricsQueryParamBreakdownByCreatorID` | creatorId | \ No newline at end of file diff --git a/docs/models/operations/getviewershipmetricsrequest.md b/docs/models/operations/getviewershipmetricsrequest.md index c85baad..670d179 100644 --- a/docs/models/operations/getviewershipmetricsrequest.md +++ b/docs/models/operations/getviewershipmetricsrequest.md @@ -12,4 +12,4 @@ | `AssetID` | **string* | :heavy_minus_sign: | The asset ID to filter metrics for | | `StreamID` | **string* | :heavy_minus_sign: | The stream ID to filter metrics for | | `CreatorID` | **string* | :heavy_minus_sign: | The creator ID to filter the query results | -| `BreakdownBy` | [][operations.QueryParamBreakdownBy](../../models/operations/queryparambreakdownby.md) | :heavy_minus_sign: | The list of fields to break down the query results. Specify this
query-string multiple times to break down by multiple fields.
| \ No newline at end of file +| `BreakdownBy` | [][operations.GetViewershipMetricsQueryParamBreakdownBy](../../models/operations/getviewershipmetricsqueryparambreakdownby.md) | :heavy_minus_sign: | The list of fields to break down the query results. Specify this
query-string multiple times to break down by multiple fields.
| \ No newline at end of file diff --git a/docs/models/operations/queryparambreakdownby.md b/docs/models/operations/queryparambreakdownby.md index 6dacc0e..feafab7 100644 --- a/docs/models/operations/queryparambreakdownby.md +++ b/docs/models/operations/queryparambreakdownby.md @@ -3,19 +3,9 @@ ## Values -| Name | Value | -| ------------------------------------ | ------------------------------------ | -| `QueryParamBreakdownByPlaybackID` | playbackId | -| `QueryParamBreakdownByDeviceType` | deviceType | -| `QueryParamBreakdownByDevice` | device | -| `QueryParamBreakdownByCPU` | cpu | -| `QueryParamBreakdownByOs` | os | -| `QueryParamBreakdownByBrowser` | browser | -| `QueryParamBreakdownByBrowserEngine` | browserEngine | -| `QueryParamBreakdownByContinent` | continent | -| `QueryParamBreakdownByCountry` | country | -| `QueryParamBreakdownBySubdivision` | subdivision | -| `QueryParamBreakdownByTimezone` | timezone | -| `QueryParamBreakdownByGeohash` | geohash | -| `QueryParamBreakdownByViewerID` | viewerId | -| `QueryParamBreakdownByCreatorID` | creatorId | \ No newline at end of file +| Name | Value | +| --------------------------------- | --------------------------------- | +| `QueryParamBreakdownByPlaybackID` | playbackId | +| `QueryParamBreakdownByDevice` | device | +| `QueryParamBreakdownByBrowser` | browser | +| `QueryParamBreakdownByCountry` | country | \ No newline at end of file diff --git a/docs/sdks/metrics/README.md b/docs/sdks/metrics/README.md index 3c51fa7..74ca078 100644 --- a/docs/sdks/metrics/README.md +++ b/docs/sdks/metrics/README.md @@ -8,6 +8,7 @@ Operations related to metrics api ### Available Operations * [GetUsage](#getusage) - Query usage metrics +* [GetRealtimeViewership](#getrealtimeviewership) - Query realtime viewership * [GetViewership](#getviewership) - Query viewership metrics * [GetCreatorViewership](#getcreatorviewership) - Query creator viewership metrics * [GetPublicViewership](#getpublicviewership) - Query public total views metrics @@ -59,6 +60,62 @@ func main() { | ------------------ | ------------------ | ------------------ | | sdkerrors.SDKError | 4xx-5xx | */* | +## GetRealtimeViewership + +Requires a private (non-CORS) API key to be used. + + +### Example Usage + +```go +package main + +import( + livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/operations" + "context" + "log" +) + +func main() { + s := livepeergo.New( + livepeergo.WithSecurity(""), + ) + var playbackID *string = livepeergo.String("") + + var creatorID *string = livepeergo.String("") + + var breakdownBy []operations.QueryParamBreakdownBy = []operations.QueryParamBreakdownBy{ + operations.QueryParamBreakdownByPlaybackID, + } + ctx := context.Background() + res, err := s.Metrics.GetRealtimeViewership(ctx, playbackID, creatorID, breakdownBy) + if err != nil { + log.Fatal(err) + } + if res.Data != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `playbackID` | **string* | :heavy_minus_sign: | The playback ID to filter the query results. This can be a canonical
playback ID from Livepeer assets or streams, or dStorage identifiers
for assets
| +| `creatorID` | **string* | :heavy_minus_sign: | The creator ID to filter the query results | +| `breakdownBy` | [][operations.QueryParamBreakdownBy](../../models/operations/queryparambreakdownby.md) | :heavy_minus_sign: | The list of fields to break down the query results. Specify this
query-string multiple times to break down by multiple fields.
| + + +### Response + +**[*operations.GetRealtimeViewershipNowResponse](../../models/operations/getrealtimeviewershipnowresponse.md), error** +| Error Object | Status Code | Content Type | +| ------------------ | ------------------ | ------------------ | +| sdkerrors.SDKError | 4xx-5xx | */* | + ## GetViewership Requires a private (non-CORS) API key to be used. diff --git a/internal/utils/retries.go b/internal/utils/retries.go index ff39d0d..86eb5cd 100644 --- a/internal/utils/retries.go +++ b/internal/utils/retries.go @@ -6,32 +6,25 @@ import ( "context" "errors" "fmt" + "github.com/cenkalti/backoff/v4" + "github.com/livepeer/livepeer-go/retry" "net/http" "net/url" "strconv" "strings" "time" - - "github.com/cenkalti/backoff/v4" ) var errRequestFailed = errors.New("request failed") -type BackoffStrategy struct { - InitialInterval int - MaxInterval int - Exponent float64 - MaxElapsedTime int -} +// Deprecated: Use retry.BackoffStrategy instead. +type BackoffStrategy = retry.BackoffStrategy -type RetryConfig struct { - Strategy string - Backoff *BackoffStrategy - RetryConnectionErrors bool -} +// Deprecated: Use retry.Config instead. +type RetryConfig = retry.Config type Retries struct { - Config *RetryConfig + Config *retry.Config StatusCodes []string } diff --git a/livepeer.go b/livepeer.go index 5303b28..5e2bf04 100644 --- a/livepeer.go +++ b/livepeer.go @@ -8,6 +8,7 @@ import ( "github.com/livepeer/livepeer-go/internal/hooks" "github.com/livepeer/livepeer-go/internal/utils" "github.com/livepeer/livepeer-go/models/components" + "github.com/livepeer/livepeer-go/retry" "net/http" "time" ) @@ -50,7 +51,7 @@ type sdkConfiguration struct { SDKVersion string GenVersion string UserAgent string - RetryConfig *utils.RetryConfig + RetryConfig *retry.Config Hooks *hooks.Hooks } @@ -147,7 +148,7 @@ func WithSecuritySource(security func(context.Context) (components.Security, err } } -func WithRetryConfig(retryConfig utils.RetryConfig) SDKOption { +func WithRetryConfig(retryConfig retry.Config) SDKOption { return func(sdk *Livepeer) { sdk.sdkConfiguration.RetryConfig = &retryConfig } @@ -159,9 +160,9 @@ func New(opts ...SDKOption) *Livepeer { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "1.0.0", - SDKVersion: "0.1.12", - GenVersion: "2.354.2", - UserAgent: "speakeasy-sdk/go 0.1.12 2.354.2 1.0.0 github.com/livepeer/livepeer-go", + SDKVersion: "0.1.13", + GenVersion: "2.359.1", + UserAgent: "speakeasy-sdk/go 0.1.13 2.359.1 1.0.0 github.com/livepeer/livepeer-go", Hooks: hooks.New(), }, } diff --git a/metrics.go b/metrics.go index e2bbef0..9a0c03a 100644 --- a/metrics.go +++ b/metrics.go @@ -135,6 +135,121 @@ func (s *Metrics) GetUsage(ctx context.Context, request operations.GetUsageMetri } +// GetRealtimeViewership - Query realtime viewership +// Requires a private (non-CORS) API key to be used. +func (s *Metrics) GetRealtimeViewership(ctx context.Context, playbackID *string, creatorID *string, breakdownBy []operations.QueryParamBreakdownBy) (*operations.GetRealtimeViewershipNowResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "getRealtimeViewershipNow", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + request := operations.GetRealtimeViewershipNowRequest{ + PlaybackID: playbackID, + CreatorID: creatorID, + BreakdownBy: breakdownBy, + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := url.JoinPath(baseURL, "/data/views/now") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + req, err := http.NewRequestWithContext(ctx, "GET", opURL, nil) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + + if err := utils.PopulateQueryParams(ctx, req, request, nil); err != nil { + return nil, fmt.Errorf("error populating query params: %w", err) + } + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"4XX", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + + res := &operations.GetRealtimeViewershipNowResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + rawBody, err := io.ReadAll(httpRes.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + httpRes.Body.Close() + httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out []components.RealtimeViewershipMetric + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Data = out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + var out sdkerrors.Error + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.Error = &out + default: + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + // GetViewership - Query viewership metrics // Requires a private (non-CORS) API key to be used. func (s *Metrics) GetViewership(ctx context.Context, request operations.GetViewershipMetricsRequest) (*operations.GetViewershipMetricsResponse, error) { diff --git a/models/components/realtimeviewershipmetric.go b/models/components/realtimeviewershipmetric.go new file mode 100644 index 0000000..e004a20 --- /dev/null +++ b/models/components/realtimeviewershipmetric.go @@ -0,0 +1,61 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package components + +// RealtimeViewershipMetric - An individual metric about realtime viewership of a stream/asset. +type RealtimeViewershipMetric struct { + // The browser used by the viewer. + Browser *string `json:"browser,omitempty"` + // The country where the viewer is located. + Country *string `json:"country,omitempty"` + // The device used by the viewer. + Device *string `json:"device,omitempty"` + // The error rate for the stream/asset. + ErrorRate float64 `json:"errorRate"` + // The playback ID associated with the metric. + PlaybackID *string `json:"playbackId,omitempty"` + // The number of views for the stream/asset. + ViewCount int64 `json:"viewCount"` +} + +func (o *RealtimeViewershipMetric) GetBrowser() *string { + if o == nil { + return nil + } + return o.Browser +} + +func (o *RealtimeViewershipMetric) GetCountry() *string { + if o == nil { + return nil + } + return o.Country +} + +func (o *RealtimeViewershipMetric) GetDevice() *string { + if o == nil { + return nil + } + return o.Device +} + +func (o *RealtimeViewershipMetric) GetErrorRate() float64 { + if o == nil { + return 0.0 + } + return o.ErrorRate +} + +func (o *RealtimeViewershipMetric) GetPlaybackID() *string { + if o == nil { + return nil + } + return o.PlaybackID +} + +func (o *RealtimeViewershipMetric) GetViewCount() int64 { + if o == nil { + return 0 + } + return o.ViewCount +} diff --git a/models/components/viewershipmetric.go b/models/components/viewershipmetric.go index 927c723..4dadbf7 100644 --- a/models/components/viewershipmetric.go +++ b/models/components/viewershipmetric.go @@ -2,7 +2,7 @@ package components -// ViewershipMetric - An individual metric about viewership of an asset. Necessarily, at least +// ViewershipMetric - An individual metric about viewership of a stream/asset. Necessarily, at least // 1 of playbackId and dStorageUrl will be present, depending on the query. type ViewershipMetric struct { // The browser used by the viewer. @@ -23,7 +23,7 @@ type ViewershipMetric struct { Device *string `json:"device,omitempty"` // The type of the device used by the viewer. DeviceType *string `json:"deviceType,omitempty"` - // The error rate for the asset. + // The error rate for the stream/asset. ErrorRate *float64 `json:"errorRate,omitempty"` // The percentage of sessions that existed before the asset started // playing. @@ -35,7 +35,7 @@ type ViewershipMetric struct { Os *string `json:"os,omitempty"` // The playback ID associated with the metric. PlaybackID *string `json:"playbackId,omitempty"` - // The total playtime in minutes for the asset. + // The total playtime in minutes for the stream/asset. PlaytimeMins float64 `json:"playtimeMins"` // The rebuffering ratio for the asset. RebufferRatio *float64 `json:"rebufferRatio,omitempty"` @@ -52,7 +52,7 @@ type ViewershipMetric struct { Timezone *string `json:"timezone,omitempty"` // The time-to-first-frame (TTFF) in milliseconds. TtffMs *float64 `json:"ttffMs,omitempty"` - // The number of views for the asset. + // The number of views for the stream/asset. ViewCount int64 `json:"viewCount"` // The ID of the viewer associated with the metric. ViewerID *string `json:"viewerId,omitempty"` diff --git a/models/operations/getpublicviewershipmetrics.go b/models/operations/getpublicviewershipmetrics.go index 3380dc9..df93527 100644 --- a/models/operations/getpublicviewershipmetrics.go +++ b/models/operations/getpublicviewershipmetrics.go @@ -29,9 +29,9 @@ type GetPublicViewershipMetricsData struct { DStorageURL *string `json:"dStorageUrl,omitempty"` // The playback ID associated with the metric. PlaybackID *string `json:"playbackId,omitempty"` - // The total playtime in minutes for the asset. + // The total playtime in minutes for the stream/asset. PlaytimeMins *float64 `json:"playtimeMins,omitempty"` - // The number of views for the asset. + // The number of views for the stream/asset. ViewCount *int64 `json:"viewCount,omitempty"` } diff --git a/models/operations/getrealtimeviewershipnow.go b/models/operations/getrealtimeviewershipnow.go new file mode 100644 index 0000000..4b11779 --- /dev/null +++ b/models/operations/getrealtimeviewershipnow.go @@ -0,0 +1,106 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package operations + +import ( + "encoding/json" + "fmt" + "github.com/livepeer/livepeer-go/models/components" + "github.com/livepeer/livepeer-go/models/sdkerrors" +) + +type QueryParamBreakdownBy string + +const ( + QueryParamBreakdownByPlaybackID QueryParamBreakdownBy = "playbackId" + QueryParamBreakdownByDevice QueryParamBreakdownBy = "device" + QueryParamBreakdownByBrowser QueryParamBreakdownBy = "browser" + QueryParamBreakdownByCountry QueryParamBreakdownBy = "country" +) + +func (e QueryParamBreakdownBy) ToPointer() *QueryParamBreakdownBy { + return &e +} +func (e *QueryParamBreakdownBy) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "playbackId": + fallthrough + case "device": + fallthrough + case "browser": + fallthrough + case "country": + *e = QueryParamBreakdownBy(v) + return nil + default: + return fmt.Errorf("invalid value for QueryParamBreakdownBy: %v", v) + } +} + +type GetRealtimeViewershipNowRequest struct { + // The playback ID to filter the query results. This can be a canonical + // playback ID from Livepeer assets or streams, or dStorage identifiers + // for assets + // + PlaybackID *string `queryParam:"style=form,explode=true,name=playbackId"` + // The creator ID to filter the query results + CreatorID *string `queryParam:"style=form,explode=true,name=creatorId"` + // The list of fields to break down the query results. Specify this + // query-string multiple times to break down by multiple fields. + // + BreakdownBy []QueryParamBreakdownBy `queryParam:"style=form,explode=true,name=breakdownBy[]"` +} + +func (o *GetRealtimeViewershipNowRequest) GetPlaybackID() *string { + if o == nil { + return nil + } + return o.PlaybackID +} + +func (o *GetRealtimeViewershipNowRequest) GetCreatorID() *string { + if o == nil { + return nil + } + return o.CreatorID +} + +func (o *GetRealtimeViewershipNowRequest) GetBreakdownBy() []QueryParamBreakdownBy { + if o == nil { + return nil + } + return o.BreakdownBy +} + +type GetRealtimeViewershipNowResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // A list of Metric objects + Data []components.RealtimeViewershipMetric + // Error + Error *sdkerrors.Error +} + +func (o *GetRealtimeViewershipNowResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GetRealtimeViewershipNowResponse) GetData() []components.RealtimeViewershipMetric { + if o == nil { + return nil + } + return o.Data +} + +func (o *GetRealtimeViewershipNowResponse) GetError() *sdkerrors.Error { + if o == nil { + return nil + } + return o.Error +} diff --git a/models/operations/getviewershipmetrics.go b/models/operations/getviewershipmetrics.go index ab00f7e..08dc4ca 100644 --- a/models/operations/getviewershipmetrics.go +++ b/models/operations/getviewershipmetrics.go @@ -176,29 +176,29 @@ func (e *QueryParamTimeStep) UnmarshalJSON(data []byte) error { } } -type QueryParamBreakdownBy string +type GetViewershipMetricsQueryParamBreakdownBy string const ( - QueryParamBreakdownByPlaybackID QueryParamBreakdownBy = "playbackId" - QueryParamBreakdownByDeviceType QueryParamBreakdownBy = "deviceType" - QueryParamBreakdownByDevice QueryParamBreakdownBy = "device" - QueryParamBreakdownByCPU QueryParamBreakdownBy = "cpu" - QueryParamBreakdownByOs QueryParamBreakdownBy = "os" - QueryParamBreakdownByBrowser QueryParamBreakdownBy = "browser" - QueryParamBreakdownByBrowserEngine QueryParamBreakdownBy = "browserEngine" - QueryParamBreakdownByContinent QueryParamBreakdownBy = "continent" - QueryParamBreakdownByCountry QueryParamBreakdownBy = "country" - QueryParamBreakdownBySubdivision QueryParamBreakdownBy = "subdivision" - QueryParamBreakdownByTimezone QueryParamBreakdownBy = "timezone" - QueryParamBreakdownByGeohash QueryParamBreakdownBy = "geohash" - QueryParamBreakdownByViewerID QueryParamBreakdownBy = "viewerId" - QueryParamBreakdownByCreatorID QueryParamBreakdownBy = "creatorId" + GetViewershipMetricsQueryParamBreakdownByPlaybackID GetViewershipMetricsQueryParamBreakdownBy = "playbackId" + GetViewershipMetricsQueryParamBreakdownByDeviceType GetViewershipMetricsQueryParamBreakdownBy = "deviceType" + GetViewershipMetricsQueryParamBreakdownByDevice GetViewershipMetricsQueryParamBreakdownBy = "device" + GetViewershipMetricsQueryParamBreakdownByCPU GetViewershipMetricsQueryParamBreakdownBy = "cpu" + GetViewershipMetricsQueryParamBreakdownByOs GetViewershipMetricsQueryParamBreakdownBy = "os" + GetViewershipMetricsQueryParamBreakdownByBrowser GetViewershipMetricsQueryParamBreakdownBy = "browser" + GetViewershipMetricsQueryParamBreakdownByBrowserEngine GetViewershipMetricsQueryParamBreakdownBy = "browserEngine" + GetViewershipMetricsQueryParamBreakdownByContinent GetViewershipMetricsQueryParamBreakdownBy = "continent" + GetViewershipMetricsQueryParamBreakdownByCountry GetViewershipMetricsQueryParamBreakdownBy = "country" + GetViewershipMetricsQueryParamBreakdownBySubdivision GetViewershipMetricsQueryParamBreakdownBy = "subdivision" + GetViewershipMetricsQueryParamBreakdownByTimezone GetViewershipMetricsQueryParamBreakdownBy = "timezone" + GetViewershipMetricsQueryParamBreakdownByGeohash GetViewershipMetricsQueryParamBreakdownBy = "geohash" + GetViewershipMetricsQueryParamBreakdownByViewerID GetViewershipMetricsQueryParamBreakdownBy = "viewerId" + GetViewershipMetricsQueryParamBreakdownByCreatorID GetViewershipMetricsQueryParamBreakdownBy = "creatorId" ) -func (e QueryParamBreakdownBy) ToPointer() *QueryParamBreakdownBy { +func (e GetViewershipMetricsQueryParamBreakdownBy) ToPointer() *GetViewershipMetricsQueryParamBreakdownBy { return &e } -func (e *QueryParamBreakdownBy) UnmarshalJSON(data []byte) error { +func (e *GetViewershipMetricsQueryParamBreakdownBy) UnmarshalJSON(data []byte) error { var v string if err := json.Unmarshal(data, &v); err != nil { return err @@ -231,10 +231,10 @@ func (e *QueryParamBreakdownBy) UnmarshalJSON(data []byte) error { case "viewerId": fallthrough case "creatorId": - *e = QueryParamBreakdownBy(v) + *e = GetViewershipMetricsQueryParamBreakdownBy(v) return nil default: - return fmt.Errorf("invalid value for QueryParamBreakdownBy: %v", v) + return fmt.Errorf("invalid value for GetViewershipMetricsQueryParamBreakdownBy: %v", v) } } @@ -259,7 +259,7 @@ type GetViewershipMetricsRequest struct { // The list of fields to break down the query results. Specify this // query-string multiple times to break down by multiple fields. // - BreakdownBy []QueryParamBreakdownBy `queryParam:"style=form,explode=true,name=breakdownBy[]"` + BreakdownBy []GetViewershipMetricsQueryParamBreakdownBy `queryParam:"style=form,explode=true,name=breakdownBy[]"` } func (o *GetViewershipMetricsRequest) GetPlaybackID() *string { @@ -311,7 +311,7 @@ func (o *GetViewershipMetricsRequest) GetCreatorID() *string { return o.CreatorID } -func (o *GetViewershipMetricsRequest) GetBreakdownBy() []QueryParamBreakdownBy { +func (o *GetViewershipMetricsRequest) GetBreakdownBy() []GetViewershipMetricsQueryParamBreakdownBy { if o == nil { return nil } diff --git a/retry/config.go b/retry/config.go new file mode 100644 index 0000000..dbbd57e --- /dev/null +++ b/retry/config.go @@ -0,0 +1,16 @@ +// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. + +package retry + +type BackoffStrategy struct { + InitialInterval int + MaxInterval int + Exponent float64 + MaxElapsedTime int +} + +type Config struct { + Strategy string + Backoff *BackoffStrategy + RetryConnectionErrors bool +}