diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index d9a1710..97fddeb 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: 0a9791e447b0acd047a206660d89f0d2 + docChecksum: ed7f9c3c7ce4cdc8b3524a59c596ef0b docVersion: 1.0.0 - speakeasyVersion: 1.290.0 - generationVersion: 2.332.1 - releaseVersion: 0.1.6 - configChecksum: 5561829438fe80b718eef8f660f4f06e + speakeasyVersion: 1.293.1 + generationVersion: 2.333.3 + releaseVersion: 0.1.7 + configChecksum: 4d1ec1d46b5cf1b0bd02ab07e4b2888c features: go: additionalDependencies: 0.1.0 @@ -25,7 +25,7 @@ features: nullables: 0.1.0 responseFormat: 0.1.1 sdkHooks: 0.1.0 - unions: 2.85.6 + unions: 2.85.8 generatedFiles: - stream.go - multistream.go @@ -262,6 +262,7 @@ generatedFiles: - docs/models/operations/getpublicviewershipmetricsdata.md - docs/models/operations/getpublicviewershipmetricsresponse.md - docs/models/operations/getusagemetricsqueryparamtimestep.md + - docs/models/operations/getusagemetricsqueryparambreakdownby.md - docs/models/operations/getusagemetricsrequest.md - docs/models/operations/getusagemetricsresponse.md - docs/models/operations/createsigningkeyresponse.md @@ -282,6 +283,7 @@ generatedFiles: - docs/models/sdkerrors/error.md - docs/models/components/three.md - docs/models/components/streamusertags.md + - docs/models/components/ismobile1.md - docs/models/components/streamismobile.md - docs/models/components/streamlocation.md - docs/models/components/streampull.md @@ -307,6 +309,7 @@ generatedFiles: - docs/models/components/inputcreatoridtype.md - docs/models/components/inputcreatorid1.md - docs/models/components/inputcreatorid.md + - docs/models/components/one.md - docs/models/components/ismobile.md - docs/models/components/location.md - docs/models/components/pull.md @@ -317,7 +320,7 @@ generatedFiles: - docs/models/components/assetsourcetype.md - docs/models/components/two.md - docs/models/components/sourcetype.md - - docs/models/components/source1.md + - docs/models/components/assetsource1.md - docs/models/components/assetsource.md - docs/models/components/assetnftmetadatatemplate.md - docs/models/components/assetnftmetadata.md @@ -362,7 +365,7 @@ generatedFiles: - docs/models/components/nftmetadata.md - docs/models/components/spec.md - docs/models/components/source3.md - - docs/models/components/one.md + - docs/models/components/source1.md - docs/models/components/source.md - docs/models/components/assetipfsinput.md - docs/models/components/assetstorageinput.md diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index c721e33..6a81d13 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,8 +12,9 @@ generation: auth: oAuth2ClientCredentialsEnabled: true go: - version: 0.1.6 + version: 0.1.7 additionalDependencies: {} + allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true flattenGlobalSecurity: true imports: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index eb5bc7d..bc69990 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,17 +1,17 @@ -speakeasyVersion: 1.290.0 +speakeasyVersion: 1.293.1 sources: livepeer-studio-api: sourceNamespace: livepeer-studio-api - sourceRevisionDigest: sha256:5306a71bee03f0cee007dab92f5e4141c5c071ba9c87834c50dd814dde91bb6d - sourceBlobDigest: sha256:4f054ea02e79a633fd01ef1c579aa39fa820df6a2cce0a64ef8fc4c8cd3021d0 + sourceRevisionDigest: sha256:ed3a24e70cf74aa7ed881aa3d73cb267e0647fefc279963105662a9aa2bb5864 + sourceBlobDigest: sha256:461dbcf221bde4fa18927d27b9fea500bcae05cdbee9daccfb251e4428f29675 tags: - latest targets: livepeer-go: source: livepeer-studio-api sourceNamespace: livepeer-studio-api - sourceRevisionDigest: sha256:5306a71bee03f0cee007dab92f5e4141c5c071ba9c87834c50dd814dde91bb6d - sourceBlobDigest: sha256:4f054ea02e79a633fd01ef1c579aa39fa820df6a2cce0a64ef8fc4c8cd3021d0 + sourceRevisionDigest: sha256:ed3a24e70cf74aa7ed881aa3d73cb267e0647fefc279963105662a9aa2bb5864 + sourceBlobDigest: sha256:461dbcf221bde4fa18927d27b9fea500bcae05cdbee9daccfb251e4428f29675 outLocation: /Users/chase/git/livepeer/livepeer-go workflow: workflowVersion: 1.0.0 @@ -19,7 +19,7 @@ workflow: sources: livepeer-studio-api: inputs: - - location: https://raw.githubusercontent.com/livepeer/studio/sk/schema-fixes/packages/api/src/schema/api-schema.yaml + - location: https://raw.githubusercontent.com/livepeer/studio/master/packages/api/src/schema/api-schema.yaml overlays: - location: ./overlay.yaml registry: @@ -28,3 +28,5 @@ workflow: livepeer-go: target: go source: livepeer-studio-api + codeSamples: + output: codeSamples.yaml diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 770f5d8..9b90766 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -3,7 +3,7 @@ speakeasyVersion: latest sources: livepeer-studio-api: inputs: - - location: https://raw.githubusercontent.com/livepeer/studio/sk/schema-fixes/packages/api/src/schema/api-schema.yaml + - location: https://raw.githubusercontent.com/livepeer/studio/master/packages/api/src/schema/api-schema.yaml overlays: - location: ./overlay.yaml registry: @@ -12,3 +12,5 @@ targets: livepeer-go: target: go source: livepeer-studio-api + codeSamples: + output: codeSamples.yaml diff --git a/README.md b/README.md index 75c3017..30ad8b2 100644 --- a/README.md +++ b/README.md @@ -156,7 +156,6 @@ import ( "context" "errors" livepeergo "github.com/livepeer/livepeer-go" - "github.com/livepeer/livepeer-go/models/components" "github.com/livepeer/livepeer-go/models/sdkerrors" "log" ) diff --git a/asset.go b/asset.go index 342f6fe..69c8861 100644 --- a/asset.go +++ b/asset.go @@ -276,7 +276,7 @@ func (s *Asset) Create(ctx context.Context, request components.NewAssetPayload) httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) switch { - case httpRes.StatusCode == 201: + case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): var out operations.RequestUploadData diff --git a/codeSamples.yaml b/codeSamples.yaml new file mode 100644 index 0000000..e9d70ec --- /dev/null +++ b/codeSamples.yaml @@ -0,0 +1,341 @@ +overlay: 1.0.0 +info: + title: CodeSamples overlay for go target + version: 0.0.0 +actions: + - target: $["paths"]["/access-control/signing-key"]["post"] + update: + x-codeSamples: + - lang: go + label: createSigningKey + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n\n \n ctx := context.Background()\n res, err := s.Create(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.SigningKey != nil {\n // handle response\n }\n}" + - target: $["paths"]["/access-control/signing-key/{keyId}"]["get"] + update: + x-codeSamples: + - lang: go + label: getSigningKey + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var keyID string = \"\"\n \n ctx := context.Background()\n res, err := s.Get(ctx, keyID)\n if err != nil {\n log.Fatal(err)\n }\n if res.SigningKey != nil {\n // handle response\n }\n}" + - target: $["paths"]["/task/{taskId}"]["get"] + update: + x-codeSamples: + - lang: go + label: getTask + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var taskID string = \"\"\n \n ctx := context.Background()\n res, err := s.Get(ctx, taskID)\n if err != nil {\n log.Fatal(err)\n }\n if res.Task != nil {\n // handle response\n }\n}" + - target: $["paths"]["/data/views/query"]["get"] + update: + x-codeSamples: + - lang: go + label: getViewershipMetrics + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/operations\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n request := operations.GetViewershipMetricsRequest{}\n \n ctx := context.Background()\n res, err := s.GetViewership(ctx, request)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/multistream/target/{id}"]["patch"] + update: + x-codeSamples: + - lang: go + label: updateMultistreamTarget + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n\n multistreamTargetPatchPayload := components.MultistreamTargetPatchPayload{\n URL: \"rtmps://live.my-service.tv/channel/secretKey\",\n }\n \n ctx := context.Background()\n res, err := s.Update(ctx, id, multistreamTargetPatchPayload)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/asset/request-upload"]["post"] + update: + x-codeSamples: + - lang: go + label: requestUpload + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n request := components.NewAssetPayload{\n Name: \"filename.mp4\",\n ProjectID: &components.AssetInput{\n Type: components.AssetTypeVideo.ToPointer(),\n PlaybackID: livepeergo.String(\"eaw4nk06ts2d0mzb\"),\n PlaybackPolicy: &components.PlaybackPolicy{\n Type: components.TypeWebhook,\n WebhookID: livepeergo.String(\"1bde4o2i6xycudoy\"),\n WebhookContext: map[string]any{\n \"streamerId\": \"my-custom-id\",\n },\n RefreshInterval: livepeergo.Float64(600),\n },\n Source: components.CreateSourceTwo(\n components.Two{\n Type: components.AssetSourceTypeRecording,\n SessionID: \"\",\n },\n ),\n CreatorID: components.CreateCreatorIDCreatorID1(\n components.CreatorID1{\n Type: components.CreatorIDTypeUnverified,\n Value: \"user123\",\n },\n ),\n Name: \"filename.mp4\",\n ProjectID: livepeergo.String(\"aac12556-4d65-4d34-9fb6-d1f0985eb0a9\"),\n Hash: []components.Hash{\n components.Hash{\n Hash: livepeergo.String(\"9b560b28b85378a5004117539196ab24e21bbd75b0e9eb1a8bc7c5fd80dc5b57\"),\n Algorithm: livepeergo.String(\"sha256\"),\n },\n },\n },\n StaticMp4: livepeergo.Bool(true),\n PlaybackPolicy: &components.PlaybackPolicy{\n Type: components.TypeWebhook,\n WebhookID: livepeergo.String(\"1bde4o2i6xycudoy\"),\n WebhookContext: map[string]any{\n \"streamerId\": \"my-custom-id\",\n },\n RefreshInterval: livepeergo.Float64(600),\n },\n Profiles: []components.TranscodeProfile{\n components.TranscodeProfile{\n Width: livepeergo.Int64(1280),\n Name: livepeergo.String(\"720p\"),\n Bitrate: 3000000,\n Quality: livepeergo.Int64(23),\n Fps: livepeergo.Int64(30),\n FpsDen: livepeergo.Int64(1),\n Gop: livepeergo.String(\"2\"),\n Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(),\n Encoder: components.TranscodeProfileEncoderH264.ToPointer(),\n },\n },\n }\n \n ctx := context.Background()\n res, err := s.Create(ctx, request)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/room/{id}/user/{userId}"]["put"] + update: + x-codeSamples: + - lang: go + label: updateRoomUser + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n\n var userID string = \"\"\n\n roomUserUpdatePayload := components.RoomUserUpdatePayload{\n CanPublish: livepeergo.Bool(true),\n CanPublishData: livepeergo.Bool(true),\n }\n \n ctx := context.Background()\n res, err := s.UpdateUser(ctx, id, userID, roomUserUpdatePayload)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/task"]["get"] + update: + x-codeSamples: + - lang: go + label: getTasks + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n\n \n ctx := context.Background()\n res, err := s.GetAll(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/multistream/target/{id}"]["get"] + update: + x-codeSamples: + - lang: go + label: getMultistreamTarget + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.Get(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res.MultistreamTarget != nil {\n // handle response\n }\n}" + - target: $["paths"]["/asset/{assetId}"]["patch"] + update: + x-codeSamples: + - lang: go + label: updateAsset + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var assetID string = \"\"\n\n assetPatchPayload := components.AssetPatchPayload{\n Name: livepeergo.String(\"filename.mp4\"),\n PlaybackPolicy: &components.PlaybackPolicy{\n Type: components.TypeWebhook,\n WebhookID: livepeergo.String(\"1bde4o2i6xycudoy\"),\n WebhookContext: map[string]any{\n \"streamerId\": \"my-custom-id\",\n },\n RefreshInterval: livepeergo.Float64(600),\n },\n }\n \n ctx := context.Background()\n res, err := s.Update(ctx, assetID, assetPatchPayload)\n if err != nil {\n log.Fatal(err)\n }\n if res.Asset != nil {\n // handle response\n }\n}" + - target: $["paths"]["/clip"]["post"] + update: + x-codeSamples: + - lang: go + label: createClip + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n request := components.ClipPayload{\n PlaybackID: \"eaw4nk06ts2d0mzb\",\n StartTime: 1587667174725,\n EndTime: livepeergo.Float64(1587667174725),\n Name: livepeergo.String(\"My Clip\"),\n SessionID: livepeergo.String(\"de7818e7-610a-4057-8f6f-b785dc1e6f88\"),\n }\n \n ctx := context.Background()\n res, err := s.CreateClip(ctx, request)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/access-control/signing-key/{keyId}"]["patch"] + update: + x-codeSamples: + - lang: go + label: updateSigningKey + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/operations\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var keyID string = \"\"\n\n requestBody := operations.UpdateSigningKeyRequestBody{}\n \n ctx := context.Background()\n res, err := s.Update(ctx, keyID, requestBody)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/stream"]["get"] + update: + x-codeSamples: + - lang: go + label: getStreams + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var streamsonly *string = livepeergo.String(\"\")\n \n ctx := context.Background()\n res, err := s.GetAll(ctx, streamsonly)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/stream/{id}/clips"]["get"] + update: + x-codeSamples: + - lang: go + label: getClips + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.GetClips(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/webhook/{id}"]["get"] + update: + x-codeSamples: + - lang: go + label: getWebhook + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.Get(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res.Webhook != nil {\n // handle response\n }\n}" + - target: $["paths"]["/stream/{parentId}/sessions"]["get"] + update: + x-codeSamples: + - lang: go + label: getRecordedSessions + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var parentID string = \"\"\n\n var record *int64 = livepeergo.Int64(1)\n \n ctx := context.Background()\n res, err := s.GetRecorded(ctx, parentID, record)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/room"]["post"] + update: + x-codeSamples: + - lang: go + label: createRoom + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n\n \n ctx := context.Background()\n res, err := s.Create(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.CreateRoomResponse != nil {\n // handle response\n }\n}" + - target: $["paths"]["/room/{id}/egress"]["delete"] + update: + x-codeSamples: + - lang: go + label: stopRoomEgress + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.StopEgress(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/access-control/signing-key/{keyId}"]["delete"] + update: + x-codeSamples: + - lang: go + label: deleteSigningKey + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var keyID string = \"\"\n \n ctx := context.Background()\n res, err := s.Delete(ctx, keyID)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/stream/{id}/start-pull"]["post"] + update: + x-codeSamples: + - lang: go + label: startPullStream + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.StartPull(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/room/{id}/user/{userId}"]["delete"] + update: + x-codeSamples: + - lang: go + label: deleteRoomUser + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n\n var userID string = \"\"\n \n ctx := context.Background()\n res, err := s.DeleteUser(ctx, id, userID)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/stream/{id}/multistream/{targetId}"]["delete"] + update: + x-codeSamples: + - lang: go + label: removeMultistreamTarget + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n\n var targetID string = \"\"\n \n ctx := context.Background()\n res, err := s.RemoveMultistreamTarget(ctx, id, targetID)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/multistream/target"]["post"] + update: + x-codeSamples: + - lang: go + label: createMultistreamTarget + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n request := components.MultistreamTargetInput{\n URL: \"rtmps://live.my-service.tv/channel/secretKey\",\n }\n \n ctx := context.Background()\n res, err := s.Create(ctx, request)\n if err != nil {\n log.Fatal(err)\n }\n if res.MultistreamTarget != nil {\n // handle response\n }\n}" + - target: $["paths"]["/data/views/query/creator"]["get"] + update: + x-codeSamples: + - lang: go + label: getCreatorViewershipMetrics + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/operations\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n request := operations.GetCreatorViewershipMetricsRequest{}\n \n ctx := context.Background()\n res, err := s.GetCreatorViewership(ctx, request)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/data/views/query/total/{playbackId}"]["get"] + update: + x-codeSamples: + - lang: go + label: getPublicViewershipMetrics + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var playbackID string = \"\"\n \n ctx := context.Background()\n res, err := s.GetPublicViewership(ctx, playbackID)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/stream/{id}/create-multistream-target"]["post"] + update: + x-codeSamples: + - lang: go + label: addMultistreamTarget + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n\n targetAddPayload := components.TargetAddPayload{\n Profile: \"720p0\",\n VideoOnly: livepeergo.Bool(false),\n ID: livepeergo.String(\"PUSH123\"),\n Spec: &components.TargetAddPayloadSpec{\n Name: livepeergo.String(\"My target\"),\n URL: \"rtmps://live.my-service.tv/channel/secretKey\",\n },\n }\n \n ctx := context.Background()\n res, err := s.AddMultistreamTarget(ctx, id, targetAddPayload)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/webhook"]["post"] + update: + x-codeSamples: + - lang: go + label: createWebhook + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n request := components.WebhookInput{\n Name: \"test_webhook\",\n Events: []components.Events{\n components.EventsStreamStarted,\n components.EventsStreamIdle,\n },\n URL: \"https://my-service.com/webhook\",\n SharedSecret: livepeergo.String(\"my-secret\"),\n StreamID: livepeergo.String(\"de7818e7-610a-4057-8f6f-b785dc1e6f88\"),\n }\n \n ctx := context.Background()\n res, err := s.Create(ctx, request)\n if err != nil {\n log.Fatal(err)\n }\n if res.Webhook != nil {\n // handle response\n }\n}" + - target: $["paths"]["/webhook/{id}/log/{logId}"]["get"] + update: + x-codeSamples: + - lang: go + label: getWebhookLog + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n\n var logID string = \"\"\n \n ctx := context.Background()\n res, err := s.GetLog(ctx, id, logID)\n if err != nil {\n log.Fatal(err)\n }\n if res.WebhookLog != nil {\n // handle response\n }\n}" + - target: $["paths"]["/session/{id}"]["get"] + update: + x-codeSamples: + - lang: go + label: getSession + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.Get(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res.Session != nil {\n // handle response\n }\n}" + - target: $["paths"]["/stream/{id}"]["patch"] + update: + x-codeSamples: + - lang: go + label: updateStream + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n\n streamPatchPayload := components.StreamPatchPayload{\n Record: livepeergo.Bool(false),\n Multistream: &components.Multistream{\n Targets: []components.Target{\n components.Target{\n Profile: \"720p\",\n VideoOnly: livepeergo.Bool(false),\n ID: livepeergo.String(\"PUSH123\"),\n Spec: &components.TargetSpec{\n Name: livepeergo.String(\"My target\"),\n URL: \"rtmps://live.my-service.tv/channel/secretKey\",\n },\n },\n },\n },\n PlaybackPolicy: &components.PlaybackPolicy{\n Type: components.TypeWebhook,\n WebhookID: livepeergo.String(\"1bde4o2i6xycudoy\"),\n WebhookContext: map[string]any{\n \"streamerId\": \"my-custom-id\",\n },\n RefreshInterval: livepeergo.Float64(600),\n },\n Profiles: []components.FfmpegProfile{\n components.FfmpegProfile{\n Width: 1280,\n Name: \"720p\",\n Height: 857478,\n Bitrate: 3000000,\n Fps: 30,\n FpsDen: livepeergo.Int64(1),\n Quality: livepeergo.Int64(23),\n Gop: livepeergo.String(\"2\"),\n Profile: components.ProfileH264Baseline.ToPointer(),\n },\n },\n }\n \n ctx := context.Background()\n res, err := s.Update(ctx, id, streamPatchPayload)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/asset/{assetId}"]["delete"] + update: + x-codeSamples: + - lang: go + label: deleteAsset + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var assetID string = \"\"\n \n ctx := context.Background()\n res, err := s.Delete(ctx, assetID)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/room/{id}"]["delete"] + update: + x-codeSamples: + - lang: go + label: deleteRoom + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.Delete(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/room/{id}/egress"]["post"] + update: + x-codeSamples: + - lang: go + label: startRoomEgress + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n\n roomEgressPayload := components.RoomEgressPayload{\n StreamID: \"aac12556-4d65-4d34-9fb6-d1f0985eb0a9\",\n }\n \n ctx := context.Background()\n res, err := s.StartEgress(ctx, id, roomEgressPayload)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/asset/upload/url"]["post"] + update: + x-codeSamples: + - lang: go + label: uploadAsset + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n request := components.NewAssetFromURLPayload{\n Name: \"filename.mp4\",\n StaticMp4: livepeergo.Bool(true),\n PlaybackPolicy: &components.PlaybackPolicy{\n Type: components.TypeWebhook,\n WebhookID: livepeergo.String(\"1bde4o2i6xycudoy\"),\n WebhookContext: map[string]any{\n \"streamerId\": \"my-custom-id\",\n },\n RefreshInterval: livepeergo.Float64(600),\n },\n URL: \"https://s3.amazonaws.com/my-bucket/path/filename.mp4\",\n Profiles: []components.TranscodeProfile{\n components.TranscodeProfile{\n Width: livepeergo.Int64(1280),\n Name: livepeergo.String(\"720p\"),\n Bitrate: 3000000,\n Quality: livepeergo.Int64(23),\n Fps: livepeergo.Int64(30),\n FpsDen: livepeergo.Int64(1),\n Gop: livepeergo.String(\"2\"),\n Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(),\n Encoder: components.TranscodeProfileEncoderH264.ToPointer(),\n },\n },\n }\n \n ctx := context.Background()\n res, err := s.CreateViaURL(ctx, request)\n if err != nil {\n log.Fatal(err)\n }\n if res.TwoHundredApplicationJSONData != nil {\n // handle response\n }\n}" + - target: $["paths"]["/session/{id}/clips"]["get"] + update: + x-codeSamples: + - lang: go + label: getSessionClips + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.GetClips(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/session"]["get"] + update: + x-codeSamples: + - lang: go + label: getSessions + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n\n \n ctx := context.Background()\n res, err := s.GetAll(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/data/usage/query"]["get"] + update: + x-codeSamples: + - lang: go + label: getUsageMetrics + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/operations\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n request := operations.GetUsageMetricsRequest{}\n \n ctx := context.Background()\n res, err := s.GetUsage(ctx, request)\n if err != nil {\n log.Fatal(err)\n }\n if res.UsageMetric != nil {\n // handle response\n }\n}" + - target: $["paths"]["/playback/{id}"]["get"] + update: + x-codeSamples: + - lang: go + label: getPlaybackInfo + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.Get(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res.PlaybackInfo != nil {\n // handle response\n }\n}" + - target: $["paths"]["/webhook/{id}/log/{logId}/resend"]["post"] + update: + x-codeSamples: + - lang: go + label: resendWebhook + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n\n var logID string = \"\"\n \n ctx := context.Background()\n res, err := s.ResendLog(ctx, id, logID)\n if err != nil {\n log.Fatal(err)\n }\n if res.WebhookLog != nil {\n // handle response\n }\n}" + - target: $["paths"]["/stream/{id}"]["delete"] + update: + x-codeSamples: + - lang: go + label: deleteStream + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.Delete(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/multistream/target"]["get"] + update: + x-codeSamples: + - lang: go + label: getMultistreamTargets + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n\n \n ctx := context.Background()\n res, err := s.GetAll(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/multistream/target/{id}"]["delete"] + update: + x-codeSamples: + - lang: go + label: deleteMultistreamTarget + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.Delete(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/asset"]["get"] + update: + x-codeSamples: + - lang: go + label: getAssets + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n\n \n ctx := context.Background()\n res, err := s.GetAll(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/room/{id}/user"]["post"] + update: + x-codeSamples: + - lang: go + label: createRoomUser + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n\n roomUserPayload := components.RoomUserPayload{\n Name: \"name\",\n CanPublish: livepeergo.Bool(true),\n CanPublishData: livepeergo.Bool(true),\n }\n \n ctx := context.Background()\n res, err := s.CreateUser(ctx, id, roomUserPayload)\n if err != nil {\n log.Fatal(err)\n }\n if res.RoomUserResponse != nil {\n // handle response\n }\n}" + - target: $["paths"]["/transcode"]["post"] + update: + x-codeSamples: + - lang: go + label: transcodeVideo + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n request := components.TranscodePayload{\n Input: components.CreateInputInput1(\n components.Input1{\n URL: \"https://s3.amazonaws.com/bucket/file.mp4\",\n },\n ),\n Storage: components.CreateTranscodePayloadStorageStorage1(\n components.Storage1{\n Type: components.StorageTypeS3,\n Endpoint: \"https://gateway.storjshare.io\",\n Bucket: \"outputbucket\",\n Credentials: components.StorageCredentials{\n AccessKeyID: \"AKIAIOSFODNN7EXAMPLE\",\n SecretAccessKey: \"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\",\n },\n },\n ),\n Outputs: components.Outputs{\n Hls: &components.Hls{\n Path: \"/samplevideo/hls\",\n },\n Mp4: &components.Mp4{\n Path: \"/samplevideo/mp4\",\n },\n Fmp4: &components.Fmp4{\n Path: \"/samplevideo/fmp4\",\n },\n },\n Profiles: []components.TranscodeProfile{\n components.TranscodeProfile{\n Width: livepeergo.Int64(1280),\n Name: livepeergo.String(\"720p\"),\n Bitrate: 3000000,\n Quality: livepeergo.Int64(23),\n Fps: livepeergo.Int64(30),\n FpsDen: livepeergo.Int64(1),\n Gop: livepeergo.String(\"2\"),\n Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(),\n Encoder: components.TranscodeProfileEncoderH264.ToPointer(),\n },\n },\n }\n \n ctx := context.Background()\n res, err := s.Create(ctx, request)\n if err != nil {\n log.Fatal(err)\n }\n if res.Task != nil {\n // handle response\n }\n}" + - target: $["paths"]["/stream/{id}"]["get"] + update: + x-codeSamples: + - lang: go + label: getStream + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.Get(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res.Stream != nil {\n // handle response\n }\n}" + - target: $["paths"]["/stream/{id}/terminate"]["delete"] + update: + x-codeSamples: + - lang: go + label: terminateStream + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.Terminate(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res != nil {\n // handle response\n }\n}" + - target: $["paths"]["/webhook"]["get"] + update: + x-codeSamples: + - lang: go + label: getWebhooks + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n\n \n ctx := context.Background()\n res, err := s.GetAll(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/asset/{assetId}"]["get"] + update: + x-codeSamples: + - lang: go + label: getAsset + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var assetID string = \"\"\n \n ctx := context.Background()\n res, err := s.Get(ctx, assetID)\n if err != nil {\n log.Fatal(err)\n }\n if res.Asset != nil {\n // handle response\n }\n}" + - target: $["paths"]["/stream"]["post"] + update: + x-codeSamples: + - lang: go + label: createStream + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n request := components.NewStreamPayload{\n Name: \"test_stream\",\n Pull: &components.Pull{\n Source: \"https://myservice.com/live/stream.flv\",\n Headers: map[string]string{\n \"Authorization\": \"Bearer 123\",\n },\n Location: &components.Location{\n Lat: 39.739,\n Lon: -104.988,\n },\n },\n PlaybackPolicy: &components.PlaybackPolicy{\n Type: components.TypeWebhook,\n WebhookID: livepeergo.String(\"1bde4o2i6xycudoy\"),\n WebhookContext: map[string]any{\n \"streamerId\": \"my-custom-id\",\n },\n RefreshInterval: livepeergo.Float64(600),\n },\n Profiles: []components.FfmpegProfile{\n components.FfmpegProfile{\n Width: 1280,\n Name: \"720p\",\n Height: 486589,\n Bitrate: 3000000,\n Fps: 30,\n FpsDen: livepeergo.Int64(1),\n Quality: livepeergo.Int64(23),\n Gop: livepeergo.String(\"2\"),\n Profile: components.ProfileH264Baseline.ToPointer(),\n },\n },\n Record: livepeergo.Bool(false),\n Multistream: &components.Multistream{\n Targets: []components.Target{\n components.Target{\n Profile: \"720p\",\n VideoOnly: livepeergo.Bool(false),\n ID: livepeergo.String(\"PUSH123\"),\n Spec: &components.TargetSpec{\n Name: livepeergo.String(\"My target\"),\n URL: \"rtmps://live.my-service.tv/channel/secretKey\",\n },\n },\n },\n },\n }\n \n ctx := context.Background()\n res, err := s.Create(ctx, request)\n if err != nil {\n log.Fatal(err)\n }\n if res.Stream != nil {\n // handle response\n }\n}" + - target: $["paths"]["/access-control/signing-key"]["get"] + update: + x-codeSamples: + - lang: go + label: getSigningKeys + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n\n \n ctx := context.Background()\n res, err := s.GetAll(ctx)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/webhook/{id}/log"]["get"] + update: + x-codeSamples: + - lang: go + label: getWebhookLogs + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.GetLogs(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res.Data != nil {\n // handle response\n }\n}" + - target: $["paths"]["/room/{id}/user/{userId}"]["get"] + update: + x-codeSamples: + - lang: go + label: getRoomUser + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n\n var userID string = \"\"\n \n ctx := context.Background()\n res, err := s.GetUser(ctx, id, userID)\n if err != nil {\n log.Fatal(err)\n }\n if res.GetRoomUserResponse != nil {\n // handle response\n }\n}" + - target: $["paths"]["/webhook/{id}"]["delete"] + update: + x-codeSamples: + - lang: go + label: deleteWebhook + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.Delete(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res.Webhook != nil {\n // handle response\n }\n}" + - target: $["paths"]["/room/{id}"]["get"] + update: + x-codeSamples: + - lang: go + label: getRoom + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n \n ctx := context.Background()\n res, err := s.Get(ctx, id)\n if err != nil {\n log.Fatal(err)\n }\n if res.Room != nil {\n // handle response\n }\n}" + - target: $["paths"]["/webhook/{id}"]["put"] + update: + x-codeSamples: + - lang: go + label: updateWebhook + source: "package main\n\nimport(\n\tlivepeergo \"github.com/livepeer/livepeer-go\"\n\t\"github.com/livepeer/livepeer-go/models/components\"\n\t\"context\"\n\t\"log\"\n)\n\nfunc main() {\n s := livepeergo.New(\n livepeergo.WithSecurity(\"\"),\n )\n\n var id string = \"\"\n\n webhook := components.WebhookInput{\n Name: \"test_webhook\",\n Events: []components.Events{\n components.EventsStreamStarted,\n components.EventsStreamIdle,\n },\n URL: \"https://my-service.com/webhook\",\n SharedSecret: livepeergo.String(\"my-secret\"),\n StreamID: livepeergo.String(\"de7818e7-610a-4057-8f6f-b785dc1e6f88\"),\n }\n \n ctx := context.Background()\n res, err := s.Update(ctx, id, webhook)\n if err != nil {\n log.Fatal(err)\n }\n if res.Webhook != nil {\n // handle response\n }\n}" diff --git a/docs/models/components/assetsource.md b/docs/models/components/assetsource.md index b39426c..fb51e00 100644 --- a/docs/models/components/assetsource.md +++ b/docs/models/components/assetsource.md @@ -3,10 +3,10 @@ ## Supported Types -### Source1 +### AssetSource1 ```go -assetSource := components.CreateAssetSourceSource1(components.Source1{/* values here */}) +assetSource := components.CreateAssetSourceAssetSource1(components.AssetSource1{/* values here */}) ``` ### Two diff --git a/docs/models/components/assetsource1.md b/docs/models/components/assetsource1.md new file mode 100644 index 0000000..58a922d --- /dev/null +++ b/docs/models/components/assetsource1.md @@ -0,0 +1,11 @@ +# AssetSource1 + + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | +| `Type` | [components.SourceType](../../models/components/sourcetype.md) | :heavy_check_mark: | N/A | +| `URL` | *string* | :heavy_check_mark: | URL from which the asset was uploaded. | +| `GatewayURL` | **string* | :heavy_minus_sign: | Gateway URL from asset if parsed from provided URL on upload. | +| `Encryption` | [*components.EncryptionOutput](../../models/components/encryptionoutput.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/ismobile.md b/docs/models/components/ismobile.md index aa320f8..39cd340 100644 --- a/docs/models/components/ismobile.md +++ b/docs/models/components/ismobile.md @@ -1,12 +1,19 @@ # IsMobile -If true, the stream will be pulled from a mobile source. +Indicates whether the stream will be pulled from a mobile source. -## Values +## Supported Types + +### One + +```go +isMobile := components.CreateIsMobileOne(components.One{/* values here */}) +``` + +### + +```go +isMobile := components.CreateIsMobileBoolean(bool{/* values here */}) +``` -| Name | Value | -| -------------- | -------------- | -| `IsMobileZero` | 0 | -| `IsMobileOne` | 1 | -| `IsMobileTwo` | 2 | \ No newline at end of file diff --git a/docs/models/components/ismobile1.md b/docs/models/components/ismobile1.md new file mode 100644 index 0000000..67d90cf --- /dev/null +++ b/docs/models/components/ismobile1.md @@ -0,0 +1,12 @@ +# IsMobile1 + +0: not mobile, 1: mobile screen share, 2: mobile camera. + + +## Values + +| Name | Value | +| --------------- | --------------- | +| `IsMobile1Zero` | 0 | +| `IsMobile1One` | 1 | +| `IsMobile1Two` | 2 | \ No newline at end of file diff --git a/docs/models/components/one.md b/docs/models/components/one.md index 222e7ff..e584627 100644 --- a/docs/models/components/one.md +++ b/docs/models/components/one.md @@ -1,11 +1,12 @@ # One +0: not mobile, 1: mobile screen share, 2: mobile camera. -## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | -| `Type` | [components.SourceType](../../models/components/sourcetype.md) | :heavy_check_mark: | N/A | -| `URL` | *string* | :heavy_check_mark: | URL from which the asset was uploaded. | -| `GatewayURL` | **string* | :heavy_minus_sign: | Gateway URL from asset if parsed from provided URL on upload. | -| `Encryption` | [*components.Encryption](../../models/components/encryption.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +## Values + +| Name | Value | +| --------- | --------- | +| `OneZero` | 0 | +| `OneOne` | 1 | +| `OneTwo` | 2 | \ No newline at end of file diff --git a/docs/models/components/pull.md b/docs/models/components/pull.md index fc863c3..a9e0ec5 100644 --- a/docs/models/components/pull.md +++ b/docs/models/components/pull.md @@ -11,5 +11,5 @@ stream will not have a streamKey. | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | | `Source` | *string* | :heavy_check_mark: | URL from which to pull from. | https://myservice.com/live/stream.flv | | `Headers` | map[string]*string* | :heavy_minus_sign: | Headers to be sent with the request to the pull source. | {
"Authorization": "Bearer 123"
} | -| `IsMobile` | [*components.IsMobile](../../models/components/ismobile.md) | :heavy_minus_sign: | If true, the stream will be pulled from a mobile source. | | +| `IsMobile` | [*components.IsMobile](../../models/components/ismobile.md) | :heavy_minus_sign: | Indicates whether the stream will be pulled from a mobile source. | | | `Location` | [*components.Location](../../models/components/location.md) | :heavy_minus_sign: | Approximate location of the pull source. The location is used to
determine the closest Livepeer region to pull the stream from. | | \ No newline at end of file diff --git a/docs/models/components/source.md b/docs/models/components/source.md index db329ae..25dbcfb 100644 --- a/docs/models/components/source.md +++ b/docs/models/components/source.md @@ -3,10 +3,10 @@ ## Supported Types -### One +### Source1 ```go -source := components.CreateSourceOne(components.One{/* values here */}) +source := components.CreateSourceSource1(components.Source1{/* values here */}) ``` ### Two diff --git a/docs/models/components/source1.md b/docs/models/components/source1.md index 638d1d3..a215bc4 100644 --- a/docs/models/components/source1.md +++ b/docs/models/components/source1.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | -| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| `Type` | [components.SourceType](../../models/components/sourcetype.md) | :heavy_check_mark: | N/A | -| `URL` | *string* | :heavy_check_mark: | URL from which the asset was uploaded. | -| `GatewayURL` | **string* | :heavy_minus_sign: | Gateway URL from asset if parsed from provided URL on upload. | -| `Encryption` | [*components.EncryptionOutput](../../models/components/encryptionoutput.md) | :heavy_minus_sign: | N/A | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------- | +| `Type` | [components.SourceType](../../models/components/sourcetype.md) | :heavy_check_mark: | N/A | +| `URL` | *string* | :heavy_check_mark: | URL from which the asset was uploaded. | +| `GatewayURL` | **string* | :heavy_minus_sign: | Gateway URL from asset if parsed from provided URL on upload. | +| `Encryption` | [*components.Encryption](../../models/components/encryption.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/streamismobile.md b/docs/models/components/streamismobile.md index 488da48..9c7531e 100644 --- a/docs/models/components/streamismobile.md +++ b/docs/models/components/streamismobile.md @@ -1,12 +1,19 @@ # StreamIsMobile -If true, the stream will be pulled from a mobile source. +Indicates whether the stream will be pulled from a mobile source. -## Values +## Supported Types + +### IsMobile1 + +```go +streamIsMobile := components.CreateStreamIsMobileIsMobile1(components.IsMobile1{/* values here */}) +``` + +### + +```go +streamIsMobile := components.CreateStreamIsMobileBoolean(bool{/* values here */}) +``` -| Name | Value | -| -------------------- | -------------------- | -| `StreamIsMobileZero` | 0 | -| `StreamIsMobileOne` | 1 | -| `StreamIsMobileTwo` | 2 | \ No newline at end of file diff --git a/docs/models/components/streampull.md b/docs/models/components/streampull.md index d3c45ae..7cd952b 100644 --- a/docs/models/components/streampull.md +++ b/docs/models/components/streampull.md @@ -11,5 +11,5 @@ stream will not have a streamKey. | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | | `Source` | *string* | :heavy_check_mark: | URL from which to pull from. | https://myservice.com/live/stream.flv | | `Headers` | map[string]*string* | :heavy_minus_sign: | Headers to be sent with the request to the pull source. | {
"Authorization": "Bearer 123"
} | -| `IsMobile` | [*components.StreamIsMobile](../../models/components/streamismobile.md) | :heavy_minus_sign: | If true, the stream will be pulled from a mobile source. | | +| `IsMobile` | [*components.StreamIsMobile](../../models/components/streamismobile.md) | :heavy_minus_sign: | Indicates whether the stream will be pulled from a mobile source. | | | `Location` | [*components.StreamLocation](../../models/components/streamlocation.md) | :heavy_minus_sign: | Approximate location of the pull source. The location is used to
determine the closest Livepeer region to pull the stream from. | | \ No newline at end of file diff --git a/docs/models/components/usertags.md b/docs/models/components/usertags.md index 5ff934a..74dc602 100644 --- a/docs/models/components/usertags.md +++ b/docs/models/components/usertags.md @@ -18,6 +18,6 @@ userTags := components.CreateUserTagsNumber(float64{/* values here */}) ### ```go -userTags := components.CreateUserTagsArrayOfuserTags3([]components.UserTags3{/* values here */}) +userTags := components.CreateUserTagsArrayOfUserTags3([]components.UserTags3{/* values here */}) ``` diff --git a/docs/models/operations/getusagemetricsqueryparambreakdownby.md b/docs/models/operations/getusagemetricsqueryparambreakdownby.md new file mode 100644 index 0000000..29e924d --- /dev/null +++ b/docs/models/operations/getusagemetricsqueryparambreakdownby.md @@ -0,0 +1,8 @@ +# GetUsageMetricsQueryParamBreakdownBy + + +## Values + +| Name | Value | +| ----------------------------------------------- | ----------------------------------------------- | +| `GetUsageMetricsQueryParamBreakdownByCreatorID` | creatorId | \ No newline at end of file diff --git a/docs/models/operations/getusagemetricsrequest.md b/docs/models/operations/getusagemetricsrequest.md index 66cd887..d076a0a 100644 --- a/docs/models/operations/getusagemetricsrequest.md +++ b/docs/models/operations/getusagemetricsrequest.md @@ -3,9 +3,10 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | -| `From` | **int64* | :heavy_minus_sign: | Start millis timestamp for the query range (inclusive)
| -| `To` | **int64* | :heavy_minus_sign: | End millis timestamp for the query range (exclusive)
| -| `TimeStep` | [*operations.GetUsageMetricsQueryParamTimeStep](../../models/operations/getusagemetricsqueryparamtimestep.md) | :heavy_minus_sign: | The time step to aggregate viewership metrics by
| -| `CreatorID` | **string* | :heavy_minus_sign: | The creator ID to filter the query results
| \ No newline at end of file +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `From` | **int64* | :heavy_minus_sign: | Start millis timestamp for the query range (inclusive)
| +| `To` | **int64* | :heavy_minus_sign: | End millis timestamp for the query range (exclusive)
| +| `TimeStep` | [*operations.GetUsageMetricsQueryParamTimeStep](../../models/operations/getusagemetricsqueryparamtimestep.md) | :heavy_minus_sign: | The time step to aggregate viewership metrics by
| +| `CreatorID` | **string* | :heavy_minus_sign: | The creator ID to filter the query results
| +| `BreakdownBy` | [][operations.GetUsageMetricsQueryParamBreakdownBy](../../models/operations/getusagemetricsqueryparambreakdownby.md) | :heavy_minus_sign: | The list of fields to break down the query results. Currently the
only supported breakdown is by `creatorId`.
| \ No newline at end of file diff --git a/docs/models/operations/task.md b/docs/models/operations/task.md index a2dd912..512f4c4 100644 --- a/docs/models/operations/task.md +++ b/docs/models/operations/task.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | **string* | :heavy_minus_sign: | N/A | 34d7618e-fd42-4798-acf5-19504616a11e | \ No newline at end of file +| `ID` | *string* | :heavy_check_mark: | N/A | 34d7618e-fd42-4798-acf5-19504616a11e | \ No newline at end of file diff --git a/docs/models/operations/uploadassetassettask.md b/docs/models/operations/uploadassetassettask.md index a9a59d2..cda9a6b 100644 --- a/docs/models/operations/uploadassetassettask.md +++ b/docs/models/operations/uploadassetassettask.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | **string* | :heavy_minus_sign: | N/A | 34d7618e-fd42-4798-acf5-19504616a11e | \ No newline at end of file +| `ID` | *string* | :heavy_check_mark: | N/A | 34d7618e-fd42-4798-acf5-19504616a11e | \ No newline at end of file diff --git a/docs/models/operations/uploadassetdata.md b/docs/models/operations/uploadassetdata.md index d8b7ab3..62477f6 100644 --- a/docs/models/operations/uploadassetdata.md +++ b/docs/models/operations/uploadassetdata.md @@ -1,6 +1,6 @@ # UploadAssetData -Import in progress +Upload in progress ## Fields diff --git a/docs/models/operations/uploadassetdataoutput.md b/docs/models/operations/uploadassetdataoutput.md index 447522c..3e30e9b 100644 --- a/docs/models/operations/uploadassetdataoutput.md +++ b/docs/models/operations/uploadassetdataoutput.md @@ -1,6 +1,6 @@ # UploadAssetDataOutput -Success +Upload started ## Fields diff --git a/docs/models/operations/uploadassetresponse.md b/docs/models/operations/uploadassetresponse.md index 248d47c..947298e 100644 --- a/docs/models/operations/uploadassetresponse.md +++ b/docs/models/operations/uploadassetresponse.md @@ -6,6 +6,6 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `TwoHundredApplicationJSONData` | [*operations.UploadAssetData](../../models/operations/uploadassetdata.md) | :heavy_minus_sign: | Import in progress | -| `TwoHundredAndOneApplicationJSONData` | [*operations.UploadAssetDataOutput](../../models/operations/uploadassetdataoutput.md) | :heavy_minus_sign: | Success | +| `TwoHundredApplicationJSONData` | [*operations.UploadAssetData](../../models/operations/uploadassetdata.md) | :heavy_minus_sign: | Upload in progress | +| `TwoHundredAndOneApplicationJSONData` | [*operations.UploadAssetDataOutput](../../models/operations/uploadassetdataoutput.md) | :heavy_minus_sign: | Upload started | | `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/uploadassettask.md b/docs/models/operations/uploadassettask.md index 2f05659..40074da 100644 --- a/docs/models/operations/uploadassettask.md +++ b/docs/models/operations/uploadassettask.md @@ -5,4 +5,4 @@ | Field | Type | Required | Description | Example | | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | ------------------------------------ | -| `ID` | **string* | :heavy_minus_sign: | N/A | 34d7618e-fd42-4798-acf5-19504616a11e | \ No newline at end of file +| `ID` | *string* | :heavy_check_mark: | N/A | 34d7618e-fd42-4798-acf5-19504616a11e | \ No newline at end of file diff --git a/docs/sdks/accesscontrol/README.md b/docs/sdks/accesscontrol/README.md index 6b3a9cb..4279abf 100644 --- a/docs/sdks/accesscontrol/README.md +++ b/docs/sdks/accesscontrol/README.md @@ -25,7 +25,6 @@ Up to 10 signing keys can be generated, after that you must delete at least one package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -73,7 +72,6 @@ Retrieves signing keys package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -121,7 +119,6 @@ Delete Signing Key package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -170,7 +167,6 @@ Retrieves a signing key package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -219,7 +215,6 @@ Update a signing key package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "github.com/livepeer/livepeer-go/models/operations" "context" diff --git a/docs/sdks/asset/README.md b/docs/sdks/asset/README.md index 72f459d..c0da3af 100644 --- a/docs/sdks/asset/README.md +++ b/docs/sdks/asset/README.md @@ -24,7 +24,6 @@ Retrieve assets package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -143,8 +142,8 @@ definition above. package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -248,8 +247,8 @@ Upload asset via URL package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -322,7 +321,6 @@ Retrieves an asset package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -371,8 +369,8 @@ Patch an asset package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -433,7 +431,6 @@ Delete an asset package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" diff --git a/docs/sdks/metrics/README.md b/docs/sdks/metrics/README.md index 3e3c973..21f6b33 100644 --- a/docs/sdks/metrics/README.md +++ b/docs/sdks/metrics/README.md @@ -23,7 +23,6 @@ Requires a private (non-CORS) API key to be used. package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "github.com/livepeer/livepeer-go/models/operations" "context" @@ -74,7 +73,6 @@ Requires a proof of ownership to be sent in the request, which for now is just t package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "github.com/livepeer/livepeer-go/models/operations" "context" @@ -127,7 +125,6 @@ unauthenticated. package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -176,7 +173,6 @@ Query usage metrics package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "github.com/livepeer/livepeer-go/models/operations" "context" @@ -188,16 +184,10 @@ func main() { livepeergo.WithSecurity(""), ) - var from *int64 = livepeergo.Int64(224089) - - var to *int64 = livepeergo.Int64(231125) - - var timeStep *operations.GetUsageMetricsQueryParamTimeStep = operations.GetUsageMetricsQueryParamTimeStepDay.ToPointer() - - var creatorID *string = livepeergo.String("") + request := operations.GetUsageMetricsRequest{} ctx := context.Background() - res, err := s.Metrics.GetUsage(ctx, from, to, timeStep, creatorID) + res, err := s.Metrics.GetUsage(ctx, request) if err != nil { log.Fatal(err) } @@ -209,13 +199,10 @@ func main() { ### Parameters -| Parameter | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | -| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | -| `from` | **int64* | :heavy_minus_sign: | Start millis timestamp for the query range (inclusive)
| -| `to` | **int64* | :heavy_minus_sign: | End millis timestamp for the query range (exclusive)
| -| `timeStep` | [*operations.GetUsageMetricsQueryParamTimeStep](../../models/operations/getusagemetricsqueryparamtimestep.md) | :heavy_minus_sign: | The time step to aggregate viewership metrics by
| -| `creatorID` | **string* | :heavy_minus_sign: | The creator ID to filter the query results
| +| Parameter | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [operations.GetUsageMetricsRequest](../../models/operations/getusagemetricsrequest.md) | :heavy_check_mark: | The request object to use for the request. | ### Response diff --git a/docs/sdks/multistream/README.md b/docs/sdks/multistream/README.md index ebfb25e..ea9d4e2 100644 --- a/docs/sdks/multistream/README.md +++ b/docs/sdks/multistream/README.md @@ -23,7 +23,6 @@ Retrieve Multistream Targets package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -71,8 +70,8 @@ Create a multistream target package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -122,7 +121,6 @@ Retrieve a multistream target package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -171,8 +169,8 @@ Update Multistream Target package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -227,7 +225,6 @@ streams before actually deleting it from the API. package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" diff --git a/docs/sdks/playback/README.md b/docs/sdks/playback/README.md index 7bbc932..cb1a9b8 100644 --- a/docs/sdks/playback/README.md +++ b/docs/sdks/playback/README.md @@ -19,7 +19,6 @@ Retrieve Playback Info package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" diff --git a/docs/sdks/room/README.md b/docs/sdks/room/README.md index 057304e..dc880a9 100644 --- a/docs/sdks/room/README.md +++ b/docs/sdks/room/README.md @@ -30,7 +30,6 @@ Create a multiparticipant livestreaming room. package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -80,7 +79,6 @@ Retrieve a room package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -131,7 +129,6 @@ Delete a room package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -184,8 +181,8 @@ This allows you to leverage livestreaming features like recording and HLS output package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -240,7 +237,6 @@ Stop room RTMP egress package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -294,8 +290,8 @@ Alternatively the joining token can be used with a custom app. package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -352,7 +348,6 @@ Get user details package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -406,8 +401,8 @@ Update properties for a user. package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -466,7 +461,6 @@ Remove a user from the room package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" diff --git a/docs/sdks/session/README.md b/docs/sdks/session/README.md index c6e5624..305ff11 100644 --- a/docs/sdks/session/README.md +++ b/docs/sdks/session/README.md @@ -22,7 +22,6 @@ Retrieve clips of a session package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -71,7 +70,6 @@ Retrieve sessions package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -119,7 +117,6 @@ Retrieve a session package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -168,7 +165,6 @@ Retrieve Recorded Sessions package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" diff --git a/docs/sdks/stream/README.md b/docs/sdks/stream/README.md index ac1d80c..92f66d1 100644 --- a/docs/sdks/stream/README.md +++ b/docs/sdks/stream/README.md @@ -42,8 +42,8 @@ also be added upon the creation of a new stream by adding package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -138,7 +138,6 @@ Retrieve streams package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -187,7 +186,6 @@ Retrieve a stream package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -236,8 +234,8 @@ Update a stream package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -328,7 +326,6 @@ using the PATCH stream API. package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -385,7 +382,6 @@ terminated. package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -441,7 +437,6 @@ started. package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -490,8 +485,8 @@ Create a clip package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -545,7 +540,6 @@ Retrieve clips of a livestream package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -594,8 +588,8 @@ Add a multistream target package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -654,7 +648,6 @@ Remove a multistream target package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" diff --git a/docs/sdks/task/README.md b/docs/sdks/task/README.md index 314de4a..b95ad1f 100644 --- a/docs/sdks/task/README.md +++ b/docs/sdks/task/README.md @@ -20,7 +20,6 @@ Retrieve Tasks package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -68,7 +67,6 @@ Retrieve a Task package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" diff --git a/docs/sdks/transcode/README.md b/docs/sdks/transcode/README.md index fb02122..d946cff 100644 --- a/docs/sdks/transcode/README.md +++ b/docs/sdks/transcode/README.md @@ -140,8 +140,8 @@ This endpoint currently supports the following output types: package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) diff --git a/docs/sdks/webhook/README.md b/docs/sdks/webhook/README.md index f81b82c..8ac44bd 100644 --- a/docs/sdks/webhook/README.md +++ b/docs/sdks/webhook/README.md @@ -26,7 +26,6 @@ Retrieve a Webhook package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -75,8 +74,8 @@ To create a new webhook, you need to make an API call with the events you want t package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -133,7 +132,6 @@ Retrieve a webhook package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -182,8 +180,8 @@ Update a webhook package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" + "github.com/livepeer/livepeer-go/models/components" "context" "log" ) @@ -243,7 +241,6 @@ Delete a webhook package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -292,7 +289,6 @@ Retrieve webhook logs package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -341,7 +337,6 @@ Retrieve a webhook log package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" @@ -396,7 +391,6 @@ to check or fix the behaviour in your handler. package main import( - "github.com/livepeer/livepeer-go/models/components" livepeergo "github.com/livepeer/livepeer-go" "context" "log" diff --git a/livepeer.go b/livepeer.go index d6961ba..db3625a 100644 --- a/livepeer.go +++ b/livepeer.go @@ -165,9 +165,9 @@ func New(opts ...SDKOption) *Livepeer { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "1.0.0", - SDKVersion: "0.1.6", - GenVersion: "2.332.1", - UserAgent: "speakeasy-sdk/go 0.1.6 2.332.1 1.0.0 github.com/livepeer/livepeer-go", + SDKVersion: "0.1.7", + GenVersion: "2.333.3", + UserAgent: "speakeasy-sdk/go 0.1.7 2.333.3 1.0.0 github.com/livepeer/livepeer-go", Hooks: hooks.New(), }, } diff --git a/metrics.go b/metrics.go index 29df878..22d1390 100644 --- a/metrics.go +++ b/metrics.go @@ -354,7 +354,7 @@ func (s *Metrics) GetPublicViewership(ctx context.Context, playbackID string) (* } // GetUsage - Query usage metrics -func (s *Metrics) GetUsage(ctx context.Context, from *int64, to *int64, timeStep *operations.GetUsageMetricsQueryParamTimeStep, creatorID *string) (*operations.GetUsageMetricsResponse, error) { +func (s *Metrics) GetUsage(ctx context.Context, request operations.GetUsageMetricsRequest) (*operations.GetUsageMetricsResponse, error) { hookCtx := hooks.HookContext{ Context: ctx, OperationID: "getUsageMetrics", @@ -362,13 +362,6 @@ func (s *Metrics) GetUsage(ctx context.Context, from *int64, to *int64, timeStep SecuritySource: s.sdkConfiguration.Security, } - request := operations.GetUsageMetricsRequest{ - From: from, - To: to, - TimeStep: timeStep, - CreatorID: creatorID, - } - baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) opURL, err := url.JoinPath(baseURL, "/data/usage/query") if err != nil { diff --git a/models/components/asset.go b/models/components/asset.go index 7e04ac9..61f6cb6 100644 --- a/models/components/asset.go +++ b/models/components/asset.go @@ -192,7 +192,7 @@ func (e *SourceType) UnmarshalJSON(data []byte) error { } } -type Source1 struct { +type AssetSource1 struct { Type SourceType `json:"type"` // URL from which the asset was uploaded. URL string `json:"url"` @@ -201,28 +201,28 @@ type Source1 struct { Encryption *EncryptionOutput `json:"encryption,omitempty"` } -func (o *Source1) GetType() SourceType { +func (o *AssetSource1) GetType() SourceType { if o == nil { return SourceType("") } return o.Type } -func (o *Source1) GetURL() string { +func (o *AssetSource1) GetURL() string { if o == nil { return "" } return o.URL } -func (o *Source1) GetGatewayURL() *string { +func (o *AssetSource1) GetGatewayURL() *string { if o == nil { return nil } return o.GatewayURL } -func (o *Source1) GetEncryption() *EncryptionOutput { +func (o *AssetSource1) GetEncryption() *EncryptionOutput { if o == nil { return nil } @@ -232,25 +232,25 @@ func (o *Source1) GetEncryption() *EncryptionOutput { type AssetSourceUnionType string const ( - AssetSourceUnionTypeSource1 AssetSourceUnionType = "source_1" + AssetSourceUnionTypeAssetSource1 AssetSourceUnionType = "asset_source_1" AssetSourceUnionTypeTwo AssetSourceUnionType = "2" AssetSourceUnionTypeAssetSource3 AssetSourceUnionType = "asset_source_3" ) type AssetSource struct { - Source1 *Source1 + AssetSource1 *AssetSource1 Two *Two AssetSource3 *AssetSource3 Type AssetSourceUnionType } -func CreateAssetSourceSource1(source1 Source1) AssetSource { - typ := AssetSourceUnionTypeSource1 +func CreateAssetSourceAssetSource1(assetSource1 AssetSource1) AssetSource { + typ := AssetSourceUnionTypeAssetSource1 return AssetSource{ - Source1: &source1, - Type: typ, + AssetSource1: &assetSource1, + Type: typ, } } @@ -281,10 +281,10 @@ func (u *AssetSource) UnmarshalJSON(data []byte) error { return nil } - var source1 Source1 = Source1{} - if err := utils.UnmarshalJSON(data, &source1, "", true, true); err == nil { - u.Source1 = &source1 - u.Type = AssetSourceUnionTypeSource1 + var assetSource1 AssetSource1 = AssetSource1{} + if err := utils.UnmarshalJSON(data, &assetSource1, "", true, true); err == nil { + u.AssetSource1 = &assetSource1 + u.Type = AssetSourceUnionTypeAssetSource1 return nil } @@ -295,12 +295,12 @@ func (u *AssetSource) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for AssetSource", string(data)) } func (u AssetSource) MarshalJSON() ([]byte, error) { - if u.Source1 != nil { - return utils.MarshalJSON(u.Source1, "", true) + if u.AssetSource1 != nil { + return utils.MarshalJSON(u.AssetSource1, "", true) } if u.Two != nil { @@ -311,7 +311,7 @@ func (u AssetSource) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.AssetSource3, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type AssetSource: all fields are null") } // AssetNftMetadataTemplate - Name of the NFT metadata template to export. 'player' @@ -955,7 +955,7 @@ func (o *Source3) GetAssetID() *string { return o.AssetID } -type One struct { +type Source1 struct { Type SourceType `json:"type"` // URL from which the asset was uploaded. URL string `json:"url"` @@ -964,28 +964,28 @@ type One struct { Encryption *Encryption `json:"encryption,omitempty"` } -func (o *One) GetType() SourceType { +func (o *Source1) GetType() SourceType { if o == nil { return SourceType("") } return o.Type } -func (o *One) GetURL() string { +func (o *Source1) GetURL() string { if o == nil { return "" } return o.URL } -func (o *One) GetGatewayURL() *string { +func (o *Source1) GetGatewayURL() *string { if o == nil { return nil } return o.GatewayURL } -func (o *One) GetEncryption() *Encryption { +func (o *Source1) GetEncryption() *Encryption { if o == nil { return nil } @@ -995,25 +995,25 @@ func (o *One) GetEncryption() *Encryption { type SourceUnionType string const ( - SourceUnionTypeOne SourceUnionType = "1" + SourceUnionTypeSource1 SourceUnionType = "source_1" SourceUnionTypeTwo SourceUnionType = "2" SourceUnionTypeSource3 SourceUnionType = "source_3" ) type Source struct { - One *One + Source1 *Source1 Two *Two Source3 *Source3 Type SourceUnionType } -func CreateSourceOne(one One) Source { - typ := SourceUnionTypeOne +func CreateSourceSource1(source1 Source1) Source { + typ := SourceUnionTypeSource1 return Source{ - One: &one, - Type: typ, + Source1: &source1, + Type: typ, } } @@ -1044,10 +1044,10 @@ func (u *Source) UnmarshalJSON(data []byte) error { return nil } - var one One = One{} - if err := utils.UnmarshalJSON(data, &one, "", true, true); err == nil { - u.One = &one - u.Type = SourceUnionTypeOne + var source1 Source1 = Source1{} + if err := utils.UnmarshalJSON(data, &source1, "", true, true); err == nil { + u.Source1 = &source1 + u.Type = SourceUnionTypeSource1 return nil } @@ -1058,12 +1058,12 @@ func (u *Source) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for Source", string(data)) } func (u Source) MarshalJSON() ([]byte, error) { - if u.One != nil { - return utils.MarshalJSON(u.One, "", true) + if u.Source1 != nil { + return utils.MarshalJSON(u.Source1, "", true) } if u.Two != nil { @@ -1074,7 +1074,7 @@ func (u Source) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Source3, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type Source: all fields are null") } type AssetIpfsInput struct { diff --git a/models/components/creatorid.go b/models/components/creatorid.go index ceb52be..beb8423 100644 --- a/models/components/creatorid.go +++ b/models/components/creatorid.go @@ -82,7 +82,7 @@ func (u *CreatorID) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for CreatorID", string(data)) } func (u CreatorID) MarshalJSON() ([]byte, error) { @@ -90,5 +90,5 @@ func (u CreatorID) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.CreatorID1, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type CreatorID: all fields are null") } diff --git a/models/components/exporttaskparams.go b/models/components/exporttaskparams.go index 077fd45..2587d0f 100644 --- a/models/components/exporttaskparams.go +++ b/models/components/exporttaskparams.go @@ -4,6 +4,7 @@ package components import ( "errors" + "fmt" "github.com/livepeer/livepeer-go/internal/utils" ) @@ -121,7 +122,7 @@ func (u *ExportTaskParams) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for ExportTaskParams", string(data)) } func (u ExportTaskParams) MarshalJSON() ([]byte, error) { @@ -133,5 +134,5 @@ func (u ExportTaskParams) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.ExportTaskParams2, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type ExportTaskParams: all fields are null") } diff --git a/models/components/inputcreatorid.go b/models/components/inputcreatorid.go index 5975f26..1697053 100644 --- a/models/components/inputcreatorid.go +++ b/models/components/inputcreatorid.go @@ -99,7 +99,7 @@ func (u *InputCreatorID) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for InputCreatorID", string(data)) } func (u InputCreatorID) MarshalJSON() ([]byte, error) { @@ -111,5 +111,5 @@ func (u InputCreatorID) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Str, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type InputCreatorID: all fields are null") } diff --git a/models/components/ipfsexportparams.go b/models/components/ipfsexportparams.go index 2f23196..0f2b86d 100644 --- a/models/components/ipfsexportparams.go +++ b/models/components/ipfsexportparams.go @@ -4,6 +4,7 @@ package components import ( "errors" + "fmt" "github.com/livepeer/livepeer-go/internal/utils" ) @@ -72,7 +73,7 @@ func (u *Pinata) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for Pinata", string(data)) } func (u Pinata) MarshalJSON() ([]byte, error) { @@ -84,7 +85,7 @@ func (u Pinata) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Pinata2, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type Pinata: all fields are null") } type IpfsExportParams struct { diff --git a/models/components/newassetpayload.go b/models/components/newassetpayload.go index bb01f0b..1c0dd2e 100644 --- a/models/components/newassetpayload.go +++ b/models/components/newassetpayload.go @@ -4,6 +4,7 @@ package components import ( "errors" + "fmt" "github.com/livepeer/livepeer-go/internal/utils" ) @@ -69,7 +70,7 @@ func (u *NewAssetPayloadIpfs) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for NewAssetPayloadIpfs", string(data)) } func (u NewAssetPayloadIpfs) MarshalJSON() ([]byte, error) { @@ -81,7 +82,7 @@ func (u NewAssetPayloadIpfs) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Boolean, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type NewAssetPayloadIpfs: all fields are null") } type NewAssetPayloadStorage struct { diff --git a/models/components/pull.go b/models/components/pull.go index 65f95d1..629c258 100644 --- a/models/components/pull.go +++ b/models/components/pull.go @@ -4,23 +4,24 @@ package components import ( "encoding/json" + "errors" "fmt" "github.com/livepeer/livepeer-go/internal/utils" ) -// IsMobile - If true, the stream will be pulled from a mobile source. -type IsMobile int64 +// One - 0: not mobile, 1: mobile screen share, 2: mobile camera. +type One int64 const ( - IsMobileZero IsMobile = 0 - IsMobileOne IsMobile = 1 - IsMobileTwo IsMobile = 2 + OneZero One = 0 + OneOne One = 1 + OneTwo One = 2 ) -func (e IsMobile) ToPointer() *IsMobile { +func (e One) ToPointer() *One { return &e } -func (e *IsMobile) UnmarshalJSON(data []byte) error { +func (e *One) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { return err @@ -31,13 +32,77 @@ func (e *IsMobile) UnmarshalJSON(data []byte) error { case 1: fallthrough case 2: - *e = IsMobile(v) + *e = One(v) return nil default: - return fmt.Errorf("invalid value for IsMobile: %v", v) + return fmt.Errorf("invalid value for One: %v", v) } } +type IsMobileType string + +const ( + IsMobileTypeOne IsMobileType = "1" + IsMobileTypeBoolean IsMobileType = "boolean" +) + +// IsMobile - Indicates whether the stream will be pulled from a mobile source. +type IsMobile struct { + One *One + Boolean *bool + + Type IsMobileType +} + +func CreateIsMobileOne(one One) IsMobile { + typ := IsMobileTypeOne + + return IsMobile{ + One: &one, + Type: typ, + } +} + +func CreateIsMobileBoolean(boolean bool) IsMobile { + typ := IsMobileTypeBoolean + + return IsMobile{ + Boolean: &boolean, + Type: typ, + } +} + +func (u *IsMobile) UnmarshalJSON(data []byte) error { + + var one One = One(0) + if err := utils.UnmarshalJSON(data, &one, "", true, true); err == nil { + u.One = &one + u.Type = IsMobileTypeOne + return nil + } + + var boolean bool = false + if err := utils.UnmarshalJSON(data, &boolean, "", true, true); err == nil { + u.Boolean = &boolean + u.Type = IsMobileTypeBoolean + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for IsMobile", string(data)) +} + +func (u IsMobile) MarshalJSON() ([]byte, error) { + if u.One != nil { + return utils.MarshalJSON(u.One, "", true) + } + + if u.Boolean != nil { + return utils.MarshalJSON(u.Boolean, "", true) + } + + return nil, errors.New("could not marshal union type IsMobile: all fields are null") +} + // Location - Approximate location of the pull source. The location is used to // determine the closest Livepeer region to pull the stream from. type Location struct { @@ -71,24 +136,13 @@ type Pull struct { Source string `json:"source"` // Headers to be sent with the request to the pull source. Headers map[string]string `json:"headers,omitempty"` - // If true, the stream will be pulled from a mobile source. - IsMobile *IsMobile `default:"0" json:"isMobile"` + // Indicates whether the stream will be pulled from a mobile source. + IsMobile *IsMobile `json:"isMobile,omitempty"` // Approximate location of the pull source. The location is used to // determine the closest Livepeer region to pull the stream from. Location *Location `json:"location,omitempty"` } -func (p Pull) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(p, "", false) -} - -func (p *Pull) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &p, "", false, false); err != nil { - return err - } - return nil -} - func (o *Pull) GetSource() string { if o == nil { return "" diff --git a/models/components/storage.go b/models/components/storage.go index 1c923bc..b2ec898 100644 --- a/models/components/storage.go +++ b/models/components/storage.go @@ -4,6 +4,7 @@ package components import ( "errors" + "fmt" "github.com/livepeer/livepeer-go/internal/utils" ) @@ -69,7 +70,7 @@ func (u *Ipfs) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for Ipfs", string(data)) } func (u Ipfs) MarshalJSON() ([]byte, error) { @@ -81,7 +82,7 @@ func (u Ipfs) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Boolean, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type Ipfs: all fields are null") } type Storage struct { diff --git a/models/components/stream.go b/models/components/stream.go index 45b6b15..4c664eb 100644 --- a/models/components/stream.go +++ b/models/components/stream.go @@ -57,7 +57,7 @@ func (u *Three) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for Three", string(data)) } func (u Three) MarshalJSON() ([]byte, error) { @@ -69,7 +69,7 @@ func (u Three) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Number, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type Three: all fields are null") } type StreamUserTagsType string @@ -138,7 +138,7 @@ func (u *StreamUserTags) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for StreamUserTags", string(data)) } func (u StreamUserTags) MarshalJSON() ([]byte, error) { @@ -154,22 +154,22 @@ func (u StreamUserTags) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.ArrayOf3, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type StreamUserTags: all fields are null") } -// StreamIsMobile - If true, the stream will be pulled from a mobile source. -type StreamIsMobile int64 +// IsMobile1 - 0: not mobile, 1: mobile screen share, 2: mobile camera. +type IsMobile1 int64 const ( - StreamIsMobileZero StreamIsMobile = 0 - StreamIsMobileOne StreamIsMobile = 1 - StreamIsMobileTwo StreamIsMobile = 2 + IsMobile1Zero IsMobile1 = 0 + IsMobile1One IsMobile1 = 1 + IsMobile1Two IsMobile1 = 2 ) -func (e StreamIsMobile) ToPointer() *StreamIsMobile { +func (e IsMobile1) ToPointer() *IsMobile1 { return &e } -func (e *StreamIsMobile) UnmarshalJSON(data []byte) error { +func (e *IsMobile1) UnmarshalJSON(data []byte) error { var v int64 if err := json.Unmarshal(data, &v); err != nil { return err @@ -180,13 +180,77 @@ func (e *StreamIsMobile) UnmarshalJSON(data []byte) error { case 1: fallthrough case 2: - *e = StreamIsMobile(v) + *e = IsMobile1(v) return nil default: - return fmt.Errorf("invalid value for StreamIsMobile: %v", v) + return fmt.Errorf("invalid value for IsMobile1: %v", v) } } +type StreamIsMobileType string + +const ( + StreamIsMobileTypeIsMobile1 StreamIsMobileType = "isMobile_1" + StreamIsMobileTypeBoolean StreamIsMobileType = "boolean" +) + +// StreamIsMobile - Indicates whether the stream will be pulled from a mobile source. +type StreamIsMobile struct { + IsMobile1 *IsMobile1 + Boolean *bool + + Type StreamIsMobileType +} + +func CreateStreamIsMobileIsMobile1(isMobile1 IsMobile1) StreamIsMobile { + typ := StreamIsMobileTypeIsMobile1 + + return StreamIsMobile{ + IsMobile1: &isMobile1, + Type: typ, + } +} + +func CreateStreamIsMobileBoolean(boolean bool) StreamIsMobile { + typ := StreamIsMobileTypeBoolean + + return StreamIsMobile{ + Boolean: &boolean, + Type: typ, + } +} + +func (u *StreamIsMobile) UnmarshalJSON(data []byte) error { + + var isMobile1 IsMobile1 = IsMobile1(0) + if err := utils.UnmarshalJSON(data, &isMobile1, "", true, true); err == nil { + u.IsMobile1 = &isMobile1 + u.Type = StreamIsMobileTypeIsMobile1 + return nil + } + + var boolean bool = false + if err := utils.UnmarshalJSON(data, &boolean, "", true, true); err == nil { + u.Boolean = &boolean + u.Type = StreamIsMobileTypeBoolean + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for StreamIsMobile", string(data)) +} + +func (u StreamIsMobile) MarshalJSON() ([]byte, error) { + if u.IsMobile1 != nil { + return utils.MarshalJSON(u.IsMobile1, "", true) + } + + if u.Boolean != nil { + return utils.MarshalJSON(u.Boolean, "", true) + } + + return nil, errors.New("could not marshal union type StreamIsMobile: all fields are null") +} + // StreamLocation - Approximate location of the pull source. The location is used to // determine the closest Livepeer region to pull the stream from. type StreamLocation struct { @@ -220,24 +284,13 @@ type StreamPull struct { Source string `json:"source"` // Headers to be sent with the request to the pull source. Headers map[string]string `json:"headers,omitempty"` - // If true, the stream will be pulled from a mobile source. - IsMobile *StreamIsMobile `default:"0" json:"isMobile"` + // Indicates whether the stream will be pulled from a mobile source. + IsMobile *StreamIsMobile `json:"isMobile,omitempty"` // Approximate location of the pull source. The location is used to // determine the closest Livepeer region to pull the stream from. Location *StreamLocation `json:"location,omitempty"` } -func (s StreamPull) MarshalJSON() ([]byte, error) { - return utils.MarshalJSON(s, "", false) -} - -func (s *StreamPull) UnmarshalJSON(data []byte) error { - if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil { - return err - } - return nil -} - func (o *StreamPull) GetSource() string { if o == nil { return "" diff --git a/models/components/transcodepayload.go b/models/components/transcodepayload.go index 59c3318..d249a45 100644 --- a/models/components/transcodepayload.go +++ b/models/components/transcodepayload.go @@ -168,7 +168,7 @@ func (u *Input) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for Input", string(data)) } func (u Input) MarshalJSON() ([]byte, error) { @@ -180,7 +180,7 @@ func (u Input) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Input2, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type Input: all fields are null") } // TranscodePayloadStorageType - Type of service used for output files @@ -379,7 +379,7 @@ func (u *TranscodePayloadStorage) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for TranscodePayloadStorage", string(data)) } func (u TranscodePayloadStorage) MarshalJSON() ([]byte, error) { @@ -391,7 +391,7 @@ func (u TranscodePayloadStorage) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Storage2, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type TranscodePayloadStorage: all fields are null") } // Hls - HLS output format diff --git a/models/components/usertags.go b/models/components/usertags.go index ddd5bf4..6a51dea 100644 --- a/models/components/usertags.go +++ b/models/components/usertags.go @@ -4,6 +4,7 @@ package components import ( "errors" + "fmt" "github.com/livepeer/livepeer-go/internal/utils" ) @@ -55,7 +56,7 @@ func (u *UserTags3) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for UserTags3", string(data)) } func (u UserTags3) MarshalJSON() ([]byte, error) { @@ -67,7 +68,7 @@ func (u UserTags3) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Number, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type UserTags3: all fields are null") } type UserTagsType string @@ -75,13 +76,13 @@ type UserTagsType string const ( UserTagsTypeStr UserTagsType = "str" UserTagsTypeNumber UserTagsType = "number" - UserTagsTypeArrayOfuserTags3 UserTagsType = "arrayOfuserTags_3" + UserTagsTypeArrayOfUserTags3 UserTagsType = "arrayOfUserTags3" ) type UserTags struct { Str *string Number *float64 - ArrayOfuserTags3 []UserTags3 + ArrayOfUserTags3 []UserTags3 Type UserTagsType } @@ -104,11 +105,11 @@ func CreateUserTagsNumber(number float64) UserTags { } } -func CreateUserTagsArrayOfuserTags3(arrayOfuserTags3 []UserTags3) UserTags { - typ := UserTagsTypeArrayOfuserTags3 +func CreateUserTagsArrayOfUserTags3(arrayOfUserTags3 []UserTags3) UserTags { + typ := UserTagsTypeArrayOfUserTags3 return UserTags{ - ArrayOfuserTags3: arrayOfuserTags3, + ArrayOfUserTags3: arrayOfUserTags3, Type: typ, } } @@ -129,14 +130,14 @@ func (u *UserTags) UnmarshalJSON(data []byte) error { return nil } - var arrayOfuserTags3 []UserTags3 = []UserTags3{} - if err := utils.UnmarshalJSON(data, &arrayOfuserTags3, "", true, true); err == nil { - u.ArrayOfuserTags3 = arrayOfuserTags3 - u.Type = UserTagsTypeArrayOfuserTags3 + var arrayOfUserTags3 []UserTags3 = []UserTags3{} + if err := utils.UnmarshalJSON(data, &arrayOfUserTags3, "", true, true); err == nil { + u.ArrayOfUserTags3 = arrayOfUserTags3 + u.Type = UserTagsTypeArrayOfUserTags3 return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for UserTags", string(data)) } func (u UserTags) MarshalJSON() ([]byte, error) { @@ -148,9 +149,9 @@ func (u UserTags) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Number, "", true) } - if u.ArrayOfuserTags3 != nil { - return utils.MarshalJSON(u.ArrayOfuserTags3, "", true) + if u.ArrayOfUserTags3 != nil { + return utils.MarshalJSON(u.ArrayOfUserTags3, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type UserTags: all fields are null") } diff --git a/models/operations/getcreatorviewershipmetrics.go b/models/operations/getcreatorviewershipmetrics.go index 1ddc895..252667a 100644 --- a/models/operations/getcreatorviewershipmetrics.go +++ b/models/operations/getcreatorviewershipmetrics.go @@ -61,7 +61,7 @@ func (u *QueryParamFrom) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for QueryParamFrom", string(data)) } func (u QueryParamFrom) MarshalJSON() ([]byte, error) { @@ -73,7 +73,7 @@ func (u QueryParamFrom) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Integer, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type QueryParamFrom: all fields are null") } type QueryParamToType string @@ -125,7 +125,7 @@ func (u *QueryParamTo) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for QueryParamTo", string(data)) } func (u QueryParamTo) MarshalJSON() ([]byte, error) { @@ -137,7 +137,7 @@ func (u QueryParamTo) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Integer, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type QueryParamTo: all fields are null") } // QueryParamTimeStep - The time step to aggregate viewership metrics by diff --git a/models/operations/getusagemetrics.go b/models/operations/getusagemetrics.go index c68926e..7a6688b 100644 --- a/models/operations/getusagemetrics.go +++ b/models/operations/getusagemetrics.go @@ -36,6 +36,29 @@ func (e *GetUsageMetricsQueryParamTimeStep) UnmarshalJSON(data []byte) error { } } +type GetUsageMetricsQueryParamBreakdownBy string + +const ( + GetUsageMetricsQueryParamBreakdownByCreatorID GetUsageMetricsQueryParamBreakdownBy = "creatorId" +) + +func (e GetUsageMetricsQueryParamBreakdownBy) ToPointer() *GetUsageMetricsQueryParamBreakdownBy { + return &e +} +func (e *GetUsageMetricsQueryParamBreakdownBy) UnmarshalJSON(data []byte) error { + var v string + if err := json.Unmarshal(data, &v); err != nil { + return err + } + switch v { + case "creatorId": + *e = GetUsageMetricsQueryParamBreakdownBy(v) + return nil + default: + return fmt.Errorf("invalid value for GetUsageMetricsQueryParamBreakdownBy: %v", v) + } +} + type GetUsageMetricsRequest struct { // Start millis timestamp for the query range (inclusive) // @@ -49,6 +72,10 @@ type GetUsageMetricsRequest struct { // 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. Currently the + // only supported breakdown is by `creatorId`. + // + BreakdownBy []GetUsageMetricsQueryParamBreakdownBy `queryParam:"style=form,explode=true,name=breakdownBy[]"` } func (o *GetUsageMetricsRequest) GetFrom() *int64 { @@ -79,6 +106,13 @@ func (o *GetUsageMetricsRequest) GetCreatorID() *string { return o.CreatorID } +func (o *GetUsageMetricsRequest) GetBreakdownBy() []GetUsageMetricsQueryParamBreakdownBy { + if o == nil { + return nil + } + return o.BreakdownBy +} + type GetUsageMetricsResponse struct { HTTPMeta components.HTTPMetadata // A Usage Metric object diff --git a/models/operations/getviewershipmetrics.go b/models/operations/getviewershipmetrics.go index fa4f998..337f80e 100644 --- a/models/operations/getviewershipmetrics.go +++ b/models/operations/getviewershipmetrics.go @@ -61,7 +61,7 @@ func (u *From) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for From", string(data)) } func (u From) MarshalJSON() ([]byte, error) { @@ -73,7 +73,7 @@ func (u From) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Integer, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type From: all fields are null") } type ToType string @@ -125,7 +125,7 @@ func (u *To) UnmarshalJSON(data []byte) error { return nil } - return errors.New("could not unmarshal into supported union types") + return fmt.Errorf("could not unmarshal `%s` into any supported union types for To", string(data)) } func (u To) MarshalJSON() ([]byte, error) { @@ -137,7 +137,7 @@ func (u To) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(u.Integer, "", true) } - return nil, errors.New("could not marshal union type: all fields are null") + return nil, errors.New("could not marshal union type To: all fields are null") } // TimeStep - The time step to aggregate viewership metrics by diff --git a/models/operations/requestupload.go b/models/operations/requestupload.go index d45beea..60f0a8d 100644 --- a/models/operations/requestupload.go +++ b/models/operations/requestupload.go @@ -8,12 +8,12 @@ import ( ) type Task struct { - ID *string `json:"id,omitempty"` + ID string `json:"id"` } -func (o *Task) GetID() *string { +func (o *Task) GetID() string { if o == nil { - return nil + return "" } return o.ID } diff --git a/models/operations/uploadasset.go b/models/operations/uploadasset.go index a47c141..3286b53 100644 --- a/models/operations/uploadasset.go +++ b/models/operations/uploadasset.go @@ -8,17 +8,17 @@ import ( ) type UploadAssetAssetTask struct { - ID *string `json:"id,omitempty"` + ID string `json:"id"` } -func (o *UploadAssetAssetTask) GetID() *string { +func (o *UploadAssetAssetTask) GetID() string { if o == nil { - return nil + return "" } return o.ID } -// UploadAssetDataOutput - Success +// UploadAssetDataOutput - Upload started type UploadAssetDataOutput struct { Asset components.Asset `json:"asset"` Task UploadAssetAssetTask `json:"task"` @@ -39,17 +39,17 @@ func (o *UploadAssetDataOutput) GetTask() UploadAssetAssetTask { } type UploadAssetTask struct { - ID *string `json:"id,omitempty"` + ID string `json:"id"` } -func (o *UploadAssetTask) GetID() *string { +func (o *UploadAssetTask) GetID() string { if o == nil { - return nil + return "" } return o.ID } -// UploadAssetData - Import in progress +// UploadAssetData - Upload in progress type UploadAssetData struct { Asset components.Asset `json:"asset"` Task UploadAssetTask `json:"task"` @@ -71,9 +71,9 @@ func (o *UploadAssetData) GetTask() UploadAssetTask { type UploadAssetResponse struct { HTTPMeta components.HTTPMetadata - // Import in progress + // Upload in progress TwoHundredApplicationJSONData *UploadAssetData - // Success + // Upload started TwoHundredAndOneApplicationJSONData *UploadAssetDataOutput // Error Error *sdkerrors.Error