diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 519dc34..e4ef123 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: b110a3e16ac8c9cb846f38dff07c5874 + docChecksum: 61af080eec2ebd33f126aba1a0e7a45d docVersion: 1.0.0 - speakeasyVersion: 1.399.0 - generationVersion: 2.415.8 - releaseVersion: 0.4.0 - configChecksum: 045305673b918fe7ce55aa6c4e22d669 + speakeasyVersion: 1.440.1 + generationVersion: 2.460.1 + releaseVersion: 0.5.0 + configChecksum: c20140ffdc777aa1960a42b8c536e9a5 repoURL: https://github.com/livepeer/livepeer-go.git installationURL: https://github.com/livepeer/livepeer-go features: @@ -14,10 +14,10 @@ features: additionalDependencies: 0.1.0 additionalProperties: 0.1.2 constsAndDefaults: 0.1.6 - core: 3.5.8 + core: 3.5.16 defaultEnabledRetries: 0.2.0 deprecations: 2.81.1 - envVarSecurityUsage: 0.3.1 + envVarSecurityUsage: 0.3.2 errorUnions: 0.1.0 flattening: 2.81.1 globalSecurity: 2.82.10 @@ -31,7 +31,8 @@ features: responseFormat: 0.1.2 retries: 2.83.0 sdkHooks: 0.1.0 - unions: 2.85.9 + tests: 0.6.0 + unions: 2.85.10 uploadStreams: 0.1.0 generatedFiles: - .gitattributes @@ -42,6 +43,7 @@ generatedFiles: - /models/components/bodygenaudiototext.go - /models/components/bodygenimagetoimage.go - /models/components/bodygenimagetovideo.go + - /models/components/bodygenllm.go - /models/components/bodygensegmentanything2.go - /models/components/bodygenupscale.go - /models/components/chunk.go @@ -50,6 +52,7 @@ generatedFiles: - /models/components/creatorid.go - /models/components/encryption.go - /models/components/encryptionoutput.go + - /models/components/error.go - /models/components/exporttaskparams.go - /models/components/ffmpegprofile.go - /models/components/getroomuserresponse.go @@ -60,6 +63,7 @@ generatedFiles: - /models/components/inputcreatorid.go - /models/components/ipfsexportparams.go - /models/components/ipfsfileinfo.go + - /models/components/llmresponse.go - /models/components/masksresponse.go - /models/components/media.go - /models/components/multistream.go @@ -121,6 +125,7 @@ generatedFiles: - /models/operations/genaudiototext.go - /models/operations/genimagetoimage.go - /models/operations/genimagetovideo.go + - /models/operations/genllm.go - /models/operations/gensegmentanything2.go - /models/operations/gentexttoimage.go - /models/operations/genupscale.go @@ -170,6 +175,7 @@ generatedFiles: - /models/sdkerrors/genaudiototext.go - /models/sdkerrors/genimagetoimage.go - /models/sdkerrors/genimagetovideo.go + - /models/sdkerrors/genllm.go - /models/sdkerrors/gensegmentanything2.go - /models/sdkerrors/gentexttoimage.go - /models/sdkerrors/genupscale.go @@ -200,6 +206,7 @@ generatedFiles: - docs/models/components/bodygenimagetoimage.md - docs/models/components/bodygenimagetovideo.md - docs/models/components/bodygenimagetovideoimage.md + - docs/models/components/bodygenllm.md - docs/models/components/bodygensegmentanything2.md - docs/models/components/bodygensegmentanything2image.md - docs/models/components/bodygenupscale.md @@ -219,7 +226,9 @@ generatedFiles: - docs/models/components/domain.md - docs/models/components/dvrplayback.md - docs/models/components/encoder.md + - docs/models/components/encryption.md - docs/models/components/encryptionoutput.md + - docs/models/components/error.md - docs/models/components/events.md - docs/models/components/export.md - docs/models/components/exportdata.md @@ -252,6 +261,7 @@ generatedFiles: - docs/models/components/ismobile1.md - docs/models/components/lastfailure.md - docs/models/components/live.md + - docs/models/components/llmresponse.md - docs/models/components/loc.md - docs/models/components/location.md - docs/models/components/masksresponse.md @@ -261,6 +271,7 @@ generatedFiles: - docs/models/components/mp4.md - docs/models/components/multistream.md - docs/models/components/multistreamtarget.md + - docs/models/components/multistreamtargetinput.md - docs/models/components/multistreamtargetpatchpayload.md - docs/models/components/name.md - docs/models/components/newassetfromurlpayload.md @@ -328,6 +339,7 @@ generatedFiles: - docs/models/components/streamrecordingspec.md - docs/models/components/streamusertags.md - docs/models/components/studioapierror.md + - docs/models/components/target.md - docs/models/components/targetaddpayload.md - docs/models/components/targetaddpayloadspec.md - docs/models/components/targetoutput.md @@ -370,6 +382,7 @@ generatedFiles: - docs/models/components/videospec.md - docs/models/components/viewershipmetric.md - docs/models/components/webhook.md + - docs/models/components/webhookinput.md - docs/models/components/webhooklog.md - docs/models/operations/addmultistreamtargetrequest.md - docs/models/operations/addmultistreamtargetresponse.md @@ -402,6 +415,7 @@ generatedFiles: - docs/models/operations/genaudiototextresponse.md - docs/models/operations/genimagetoimageresponse.md - docs/models/operations/genimagetovideoresponse.md + - docs/models/operations/genllmresponse.md - docs/models/operations/gensegmentanything2response.md - docs/models/operations/gentexttoimageresponse.md - docs/models/operations/genupscaleresponse.md @@ -500,6 +514,7 @@ generatedFiles: - docs/models/operations/uploadassetresponse.md - docs/models/operations/uploadassettask.md - docs/models/sdkerrors/error.md + - docs/models/sdkerrors/genaudiototextgenerateresponse415responsebody.md - docs/models/sdkerrors/genaudiototextgenerateresponse422responsebody.md - docs/models/sdkerrors/genaudiototextgenerateresponse500responsebody.md - docs/models/sdkerrors/genaudiototextgenerateresponsebody.md @@ -513,6 +528,10 @@ generatedFiles: - docs/models/sdkerrors/genimagetovideogenerateresponsebody.md - docs/models/sdkerrors/genimagetovideogenerateresponseresponsebody.md - docs/models/sdkerrors/genimagetovideoresponsebody.md + - docs/models/sdkerrors/genllmgenerateresponse500responsebody.md + - docs/models/sdkerrors/genllmgenerateresponsebody.md + - docs/models/sdkerrors/genllmgenerateresponseresponsebody.md + - docs/models/sdkerrors/genllmresponsebody.md - docs/models/sdkerrors/gensegmentanything2generateresponse500responsebody.md - docs/models/sdkerrors/gensegmentanything2generateresponsebody.md - docs/models/sdkerrors/gensegmentanything2generateresponseresponsebody.md @@ -573,10 +592,10 @@ examples: createStream: speakeasy-default-create-stream: requestBody: - application/json: {"name": "test_stream", "pull": {"source": "https://myservice.com/live/stream.flv", "headers": {"Authorization": "Bearer 123"}, "location": {"lat": 39.739, "lon": -104.988}}, "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "profiles": [], "record": false, "recordingSpec": {"profiles": []}, "multistream": {"targets": [{"profile": "720p", "videoOnly": false, "id": "PUSH123", "spec": {"name": "My target", "url": "rtmps://live.my-service.tv/channel/secretKey"}}]}} + application/json: {"name": "test_stream", "pull": {"source": "https://myservice.com/live/stream.flv", "headers": {"Authorization": "Bearer 123"}, "location": {"lat": 39.739, "lon": -104.988}}, "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "profiles": [], "record": false, "recordingSpec": {"profiles": []}, "multistream": {"targets": [{"profile": "720p0", "videoOnly": false, "id": "PUSH123", "spec": {"name": "My target", "url": "rtmps://live.my-service.tv/channel/secretKey"}}]}} responses: "201": - application/json: {"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "name": "test_stream", "creatorId": {"type": "unverified", "value": "user123"}, "lastSeen": 1587667174725, "sourceSegments": 1, "transcodedSegments": 2, "sourceSegmentsDuration": 1, "transcodedSegmentsDuration": 2, "sourceBytes": 1, "transcodedBytes": 2, "ingestRate": 1, "outgoingRate": 2, "isActive": true, "createdByTokenName": "abc-123-xyz-456", "createdAt": 1587667174725, "parentId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "streamKey": "hgebdhhigq", "pull": {"source": "https://myservice.com/live/stream.flv", "headers": {"Authorization": "Bearer 123"}, "location": {"lat": 39.739, "lon": -104.988}}, "playbackId": "eaw4nk06ts2d0mzb", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "profiles": [], "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "record": false, "recordingSpec": {"profiles": []}, "multistream": {"targets": [{"profile": "720p", "videoOnly": false, "id": "PUSH123"}]}, "lastTerminatedAt": 1713281212993} + application/json: {"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "name": "test_stream", "creatorId": {"type": "unverified", "value": "user123"}, "lastSeen": 1587667174725, "sourceSegments": 1, "transcodedSegments": 2, "sourceSegmentsDuration": 1, "transcodedSegmentsDuration": 2, "sourceBytes": 1, "transcodedBytes": 2, "ingestRate": 1, "outgoingRate": 2, "isActive": true, "createdByTokenName": "abc-123-xyz-456", "createdAt": 1587667174725, "parentId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "streamKey": "hgebdhhigq", "pull": {"source": "https://myservice.com/live/stream.flv", "headers": {"Authorization": "Bearer 123"}, "location": {"lat": 39.739, "lon": -104.988}}, "playbackId": "eaw4nk06ts2d0mzb", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "profiles": [], "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "record": false, "recordingSpec": {"profiles": []}, "multistream": {"targets": [{"profile": "720p0", "videoOnly": false, "id": "PUSH123"}]}, "lastTerminatedAt": 1713281212993} default: application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} getStreams: @@ -593,7 +612,7 @@ examples: id: "" responses: "200": - application/json: {"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "name": "test_stream", "creatorId": {"type": "unverified", "value": "user123"}, "lastSeen": 1587667174725, "sourceSegments": 1, "transcodedSegments": 2, "sourceSegmentsDuration": 1, "transcodedSegmentsDuration": 2, "sourceBytes": 1, "transcodedBytes": 2, "ingestRate": 1, "outgoingRate": 2, "isActive": true, "createdByTokenName": "abc-123-xyz-456", "createdAt": 1587667174725, "parentId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "streamKey": "hgebdhhigq", "pull": {"source": "https://myservice.com/live/stream.flv", "headers": {"Authorization": "Bearer 123"}, "location": {"lat": 39.739, "lon": -104.988}}, "playbackId": "eaw4nk06ts2d0mzb", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "profiles": [], "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "record": false, "recordingSpec": {"profiles": []}, "multistream": {"targets": [{"profile": "720p", "videoOnly": false, "id": "PUSH123"}]}, "lastTerminatedAt": 1713281212993} + application/json: {"id": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "name": "test_stream", "creatorId": {"type": "unverified", "value": "user123"}, "lastSeen": 1587667174725, "sourceSegments": 1, "transcodedSegments": 2, "sourceSegmentsDuration": 1, "transcodedSegmentsDuration": 2, "sourceBytes": 1, "transcodedBytes": 2, "ingestRate": 1, "outgoingRate": 2, "isActive": true, "createdByTokenName": "abc-123-xyz-456", "createdAt": 1587667174725, "parentId": "de7818e7-610a-4057-8f6f-b785dc1e6f88", "streamKey": "hgebdhhigq", "pull": {"source": "https://myservice.com/live/stream.flv", "headers": {"Authorization": "Bearer 123"}, "location": {"lat": 39.739, "lon": -104.988}}, "playbackId": "eaw4nk06ts2d0mzb", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "profiles": [], "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "record": false, "recordingSpec": {"profiles": []}, "multistream": {"targets": [{"profile": "720p0", "videoOnly": false, "id": "PUSH123"}]}, "lastTerminatedAt": 1713281212993} default: application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} updateStream: @@ -602,7 +621,7 @@ examples: path: id: "" requestBody: - application/json: {"record": false, "multistream": {"targets": [{"profile": "720p", "videoOnly": false, "id": "PUSH123", "spec": {"name": "My target", "url": "rtmps://live.my-service.tv/channel/secretKey"}}]}, "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "profiles": [], "recordingSpec": {"profiles": []}} + application/json: {"record": false, "multistream": {"targets": [{"profile": "720p0", "videoOnly": false, "id": "PUSH123", "spec": {"name": "My target", "url": "rtmps://live.my-service.tv/channel/secretKey"}}]}, "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "profiles": [], "recordingSpec": {"profiles": []}, "name": "test_stream"} responses: default: application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} @@ -636,7 +655,7 @@ examples: application/json: {"playbackId": "eaw4nk06ts2d0mzb", "startTime": 1587667174725, "endTime": 1587667174725, "name": "My Clip", "sessionId": "de7818e7-610a-4057-8f6f-b785dc1e6f88"} responses: "200": - application/json: {"asset": {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "directUpload"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "failed", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}}, "task": {"id": "34d7618e-fd42-4798-acf5-19504616a11e"}} + application/json: {"asset": {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "directUpload"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "failed", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}}, "task": {"id": "34d7618e-fd42-4798-acf5-19504616a11e"}} default: application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} getClips: @@ -805,7 +824,7 @@ examples: application/json: {"name": "filename.mp4", "staticMp4": true, "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "profiles": []} responses: "200": - application/json: {"url": "https://origin.livepeer.com/api/asset/upload/direct?token=eyJhbGciOiJIUzI1NiJ9.eyJtc2ciOiJoZWxsbyBoYWNrZXIsIHRoZXJlJ3Mgbm90aGluZyBmb3IgeW91IGhlcmUg8J-YhiJ9.1YDjmXsqLcgNyMSzT4kXl_kIni46_EuGX_xfqmC7e0Q", "tusEndpoint": "https://origin.livepeer.com/api/asset/upload/tus?token=eyJhbGciOiJIUzI1NiJ9.eyJtc2ciOiJoZWxsbyBoYWNrZXIsIHRoZXJlJ3Mgbm90aGluZyBmb3IgeW91IGhlcmUg8J-YhiJ9.1YDjmXsqLcgNyMSzT4kXl_kIni46_EuGX_xfqmC7e0Q", "asset": {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "recording", "sessionId": ""}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "ready", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}}, "task": {"id": "34d7618e-fd42-4798-acf5-19504616a11e"}} + application/json: {"url": "https://origin.livepeer.com/api/asset/upload/direct?token=eyJhbGciOiJIUzI1NiJ9.eyJtc2ciOiJoZWxsbyBoYWNrZXIsIHRoZXJlJ3Mgbm90aGluZyBmb3IgeW91IGhlcmUg8J-YhiJ9.1YDjmXsqLcgNyMSzT4kXl_kIni46_EuGX_xfqmC7e0Q", "tusEndpoint": "https://origin.livepeer.com/api/asset/upload/tus?token=eyJhbGciOiJIUzI1NiJ9.eyJtc2ciOiJoZWxsbyBoYWNrZXIsIHRoZXJlJ3Mgbm90aGluZyBmb3IgeW91IGhlcmUg8J-YhiJ9.1YDjmXsqLcgNyMSzT4kXl_kIni46_EuGX_xfqmC7e0Q", "asset": {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "recording", "sessionId": ""}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "ready", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}}, "task": {"id": "34d7618e-fd42-4798-acf5-19504616a11e"}} default: application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} uploadAsset: @@ -814,9 +833,9 @@ examples: application/json: {"name": "filename.mp4", "staticMp4": true, "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "url": "https://s3.amazonaws.com/my-bucket/path/filename.mp4", "profiles": []} responses: "200": - application/json: {"asset": {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "recording", "sessionId": ""}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "waiting", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}}, "task": {"id": "34d7618e-fd42-4798-acf5-19504616a11e"}} + application/json: {"asset": {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "recording", "sessionId": ""}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "waiting", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}}, "task": {"id": "34d7618e-fd42-4798-acf5-19504616a11e"}} "201": - application/json: {"asset": {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "url", "url": "http://dutiful-colorlessness.com"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "uploading", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}}, "task": {"id": "34d7618e-fd42-4798-acf5-19504616a11e"}} + application/json: {"asset": {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "url", "url": "http://dutiful-colorlessness.com"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "uploading", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}}, "task": {"id": "34d7618e-fd42-4798-acf5-19504616a11e"}} default: application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} getAsset: @@ -826,7 +845,7 @@ examples: assetId: "" responses: "200": - application/json: {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "directUpload"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "ready", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}} + application/json: {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "directUpload"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "ready", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}} default: application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} updateAsset: @@ -838,7 +857,7 @@ examples: application/json: {"name": "filename.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}} responses: "200": - application/json: {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "directUpload"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "failed", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}} + application/json: {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "directUpload"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "failed", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}} default: application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} deleteAsset: @@ -1066,14 +1085,14 @@ examples: taskId: "" responses: "200": - application/json: {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "upload", "createdAt": 1587667174725, "scheduledAt": 1587667174725, "inputAssetId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "outputAssetId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "projectId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "requesterId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "params": {"upload": {"url": "https://cdn.livepeer.com/ABC123/filename.mp4", "c2pa": true, "profiles": [], "targetSegmentSizeSecs": 6}, "export": {"ipfs": {}}, "exportData": {"ipfs": {"pinata": {"apiKey": "1234567890"}}, "type": "text/plain", "id": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}, "transcode-file": {"input": {"url": "https://cdn.livepeer.com/ABC123/filename.mp4"}, "storage": {"url": "s3+https://accessKeyId:secretAccessKey@s3Endpoint/bucket"}, "outputs": {"hls": {"path": "/samplevideo/hls"}, "mp4": {"path": "/samplevideo/mp4"}}, "profiles": [], "targetSegmentSizeSecs": 10, "c2pa": false}, "clip": {"url": "https://asset-cdn.lp-playback.monster/hls/1bde4o2i6xycudoy/static360p0.mp4", "clipStrategy": {"startTime": 1587667174725, "endTime": 1587667174725, "playbackId": "eaw4nk06ts2d0mzb"}, "catalystPipelineStrategy": "catalyst_ffmpeg", "sessionId": "d32ae9e6-c459-4931-9898-e86e2f5e7e16", "inputId": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}, "status": {"phase": "pending", "updatedAt": 1587667174725, "progress": 0.5, "errorMessage": "Failed to upload file", "retries": 3}, "output": {"upload": {"assetSpec": {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "clip"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "deleting", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}}, "key": "", "key1": ""}, "export": {"ipfs": {"videoFileCid": "Qmabc123xyz341", "videoFileUrl": "ipfs://Qmabc123xyz341", "videoFileGatewayUrl": "https://gateway.ipfs.io/ipfs/Qmabc123xyz341", "nftMetadataCid": "Qmabc123xyz341", "nftMetadataUrl": "ipfs://Qmabc123xyz341", "nftMetadataGatewayUrl": "https://gateway.ipfs.io/ipfs/Qmabc123xyz341"}}, "exportData": {"ipfs": {"cid": "Qmabc123xyz341"}}}} + application/json: {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "upload", "createdAt": 1587667174725, "scheduledAt": 1587667174725, "inputAssetId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "outputAssetId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "projectId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "requesterId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "params": {"upload": {"url": "https://cdn.livepeer.com/ABC123/filename.mp4", "c2pa": true, "profiles": [], "targetSegmentSizeSecs": 6}, "export": {"ipfs": {"pinata": {"apiKey": "1234567890"}}}, "exportData": {"ipfs": {"pinata": {"apiKey": "1234567890"}}, "type": "text/plain", "id": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}, "transcode-file": {"input": {"url": "https://cdn.livepeer.com/ABC123/filename.mp4"}, "storage": {"url": "s3+https://accessKeyId:secretAccessKey@s3Endpoint/bucket"}, "outputs": {"hls": {"path": "/samplevideo/hls"}, "mp4": {"path": "/samplevideo/mp4"}}, "profiles": [], "targetSegmentSizeSecs": 10, "c2pa": false}, "clip": {"url": "https://asset-cdn.lp-playback.monster/hls/1bde4o2i6xycudoy/static360p0.mp4", "clipStrategy": {"startTime": 1587667174725, "endTime": 1587667174725, "playbackId": "eaw4nk06ts2d0mzb"}, "catalystPipelineStrategy": "catalyst_ffmpeg", "sessionId": "d32ae9e6-c459-4931-9898-e86e2f5e7e16", "inputId": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}, "status": {"phase": "pending", "updatedAt": 1587667174725, "progress": 0.5, "errorMessage": "Failed to upload file", "retries": 3}, "output": {"upload": {"assetSpec": {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "clip"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "deleting", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}}, "key": "", "key1": ""}, "export": {"ipfs": {"videoFileCid": "Qmabc123xyz341", "videoFileUrl": "ipfs://Qmabc123xyz341", "videoFileGatewayUrl": "https://gateway.ipfs.io/ipfs/Qmabc123xyz341", "nftMetadataCid": "Qmabc123xyz341", "nftMetadataUrl": "ipfs://Qmabc123xyz341", "nftMetadataGatewayUrl": "https://gateway.ipfs.io/ipfs/Qmabc123xyz341"}}, "exportData": {"ipfs": {"cid": "Qmabc123xyz341"}}}} transcodeVideo: speakeasy-default-transcode-video: requestBody: application/json: {"input": {"url": "https://s3.amazonaws.com/bucket/file.mp4"}, "storage": {"type": "s3", "endpoint": "https://gateway.storjshare.io", "bucket": "outputbucket", "credentials": {"accessKeyId": "AKIAIOSFODNN7EXAMPLE", "secretAccessKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}}, "outputs": {"hls": {"path": "/samplevideo/hls"}, "mp4": {"path": "/samplevideo/mp4"}, "fmp4": {"path": "/samplevideo/fmp4"}}, "profiles": []} responses: "200": - application/json: {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "upload", "createdAt": 1587667174725, "scheduledAt": 1587667174725, "inputAssetId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "outputAssetId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "projectId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "requesterId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "params": {"upload": {"url": "https://cdn.livepeer.com/ABC123/filename.mp4", "c2pa": true, "profiles": [], "targetSegmentSizeSecs": 6}, "export": {"ipfs": {"pinata": {"apiKey": "1234567890"}}}, "exportData": {"ipfs": {}, "type": "text/plain", "id": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}, "transcode-file": {"input": {"url": "https://cdn.livepeer.com/ABC123/filename.mp4"}, "storage": {"url": "s3+https://accessKeyId:secretAccessKey@s3Endpoint/bucket"}, "outputs": {"hls": {"path": "/samplevideo/hls"}, "mp4": {"path": "/samplevideo/mp4"}}, "profiles": [], "targetSegmentSizeSecs": 10, "c2pa": false}, "clip": {"url": "https://asset-cdn.lp-playback.monster/hls/1bde4o2i6xycudoy/static360p0.mp4", "clipStrategy": {"startTime": 1587667174725, "endTime": 1587667174725, "playbackId": "eaw4nk06ts2d0mzb"}, "catalystPipelineStrategy": "catalyst_ffmpeg", "sessionId": "d32ae9e6-c459-4931-9898-e86e2f5e7e16", "inputId": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}, "status": {"phase": "pending", "updatedAt": 1587667174725, "progress": 0.5, "errorMessage": "Failed to upload file", "retries": 3}, "output": {"upload": {"assetSpec": {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "url", "url": "http://speedy-basil.org"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "deleting", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}}, "key": ""}, "export": {"ipfs": {"videoFileCid": "Qmabc123xyz341", "videoFileUrl": "ipfs://Qmabc123xyz341", "videoFileGatewayUrl": "https://gateway.ipfs.io/ipfs/Qmabc123xyz341", "nftMetadataCid": "Qmabc123xyz341", "nftMetadataUrl": "ipfs://Qmabc123xyz341", "nftMetadataGatewayUrl": "https://gateway.ipfs.io/ipfs/Qmabc123xyz341"}}, "exportData": {"ipfs": {"cid": "Qmabc123xyz341"}}}} + application/json: {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "upload", "createdAt": 1587667174725, "scheduledAt": 1587667174725, "inputAssetId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "outputAssetId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "projectId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "requesterId": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "params": {"upload": {"url": "https://cdn.livepeer.com/ABC123/filename.mp4", "c2pa": true, "profiles": [], "targetSegmentSizeSecs": 6}, "export": {"ipfs": {"pinata": {"apiKey": "1234567890"}}}, "exportData": {"ipfs": {}, "type": "text/plain", "id": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}, "transcode-file": {"input": {"url": "https://cdn.livepeer.com/ABC123/filename.mp4"}, "storage": {"url": "s3+https://accessKeyId:secretAccessKey@s3Endpoint/bucket"}, "outputs": {"hls": {"path": "/samplevideo/hls"}, "mp4": {"path": "/samplevideo/mp4"}}, "profiles": [], "targetSegmentSizeSecs": 10, "c2pa": false}, "clip": {"url": "https://asset-cdn.lp-playback.monster/hls/1bde4o2i6xycudoy/static360p0.mp4", "clipStrategy": {"startTime": 1587667174725, "endTime": 1587667174725, "playbackId": "eaw4nk06ts2d0mzb"}, "catalystPipelineStrategy": "catalyst_ffmpeg", "sessionId": "d32ae9e6-c459-4931-9898-e86e2f5e7e16", "inputId": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}, "status": {"phase": "pending", "updatedAt": 1587667174725, "progress": 0.5, "errorMessage": "Failed to upload file", "retries": 3}, "output": {"upload": {"assetSpec": {"id": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "type": "video", "playbackId": "eaw4nk06ts2d0mzb", "playbackUrl": "https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8", "downloadUrl": "https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video/download.mp4", "playbackPolicy": {"type": "webhook", "webhookId": "1bde4o2i6xycudoy", "webhookContext": {"streamerId": "my-custom-id"}, "refreshInterval": 600}, "source": {"type": "url", "url": "http://speedy-basil.org"}, "creatorId": {"type": "unverified", "value": "user123"}, "profiles": [], "storage": {"ipfs": {"updatedAt": 1587667174725}, "status": {"phase": "ready", "progress": 0.5, "errorMessage": "Failed to update storage", "tasks": {"pending": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "last": "09F8B46C-61A0-4254-9875-F71F4C605BC7", "failed": "09F8B46C-61A0-4254-9875-F71F4C605BC7"}}}, "status": {"phase": "deleting", "updatedAt": 1587667174725}, "name": "filename.mp4", "projectId": "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", "createdAt": 1587667174725, "size": 84934509, "hash": [], "videoSpec": {"format": "mp4", "duration": 23.8328, "bitrate": 1000000, "tracks": []}}, "key": ""}, "export": {"ipfs": {"videoFileCid": "Qmabc123xyz341", "videoFileUrl": "ipfs://Qmabc123xyz341", "videoFileGatewayUrl": "https://gateway.ipfs.io/ipfs/Qmabc123xyz341", "nftMetadataCid": "Qmabc123xyz341", "nftMetadataUrl": "ipfs://Qmabc123xyz341", "nftMetadataGatewayUrl": "https://gateway.ipfs.io/ipfs/Qmabc123xyz341"}}, "exportData": {"ipfs": {"cid": "Qmabc123xyz341"}}}} default: application/json: {"errors": ["[\"id not provided\",\"Account not found\"]"]} getPlaybackInfo: @@ -1097,9 +1116,11 @@ examples: application/json: {"images": []} "400": application/json: {"detail": {"msg": ""}} - "401": {} + "401": + application/json: {"detail": {"msg": ""}} "422": {} - "500": {} + "500": + application/json: {"detail": {"msg": ""}} default: {} genImageToImage: speakeasy-default-gen-image-to-image: @@ -1128,7 +1149,8 @@ examples: "401": application/json: {"detail": {"msg": ""}} "422": {} - "500": {} + "500": + application/json: {"detail": {"msg": ""}} default: {} genUpscale: speakeasy-default-gen-upscale: @@ -1139,7 +1161,8 @@ examples: application/json: {"images": []} "400": application/json: {"detail": {"msg": ""}} - "401": {} + "401": + application/json: {"detail": {"msg": ""}} "422": {} "500": application/json: {"detail": {"msg": ""}} @@ -1159,6 +1182,8 @@ examples: "500": application/json: {"detail": {"msg": ""}} default: {} + "415": + application/json: {"detail": {"msg": ""}} genSegmentAnything2: speakeasy-default-gen-segment-anything2: requestBody: @@ -1173,3 +1198,17 @@ examples: "500": application/json: {"detail": {"msg": ""}} default: {} + genLLM: + speakeasy-default-gen-LLM: + requestBody: + application/x-www-form-urlencoded: {"prompt": ""} + responses: + "200": + application/json: {"response": "", "tokens_used": 60712} + "400": + application/json: {"detail": {"msg": ""}} + "401": {} + "422": {} + "500": + application/json: {"detail": {"msg": ""}} + default: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 4eb281b..5f50611 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -11,11 +11,13 @@ generation: requestResponseComponentNamesFeb2024: true auth: oAuth2ClientCredentialsEnabled: true + oAuth2PasswordEnabled: false go: - version: 0.4.0 + version: 0.5.0 additionalDependencies: {} allowUnknownFieldsInWeakUnions: false clientServerStatusCodesAsErrors: true + defaultErrorName: SDKError flattenGlobalSecurity: true imports: option: openapi diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 0c9396a..407037c 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,18 +1,20 @@ -speakeasyVersion: 1.399.0 +speakeasyVersion: 1.440.1 sources: livepeer-studio-api: sourceNamespace: livepeer-studio-api - sourceRevisionDigest: sha256:f3ea883f13fc67e60cb167af92c3e9be9ec4fea50eacd4130a1b51d7f1cd5102 - sourceBlobDigest: sha256:a6e21f46600c0ad7fc422459cc7392d99943317b4a24fd41190670ba78a55eb8 + sourceRevisionDigest: sha256:b2458801caccd85ea7011f90d46b4a83a2ebf6afc44bd9bf758967c34138ab51 + sourceBlobDigest: sha256:49cd7a48ce214c823876e8ab80123a471903a46286c6a4451984a62afd1c2718 tags: - latest - - main + - speakeasy-sdk-regen-1731112098 targets: livepeer-go: source: livepeer-studio-api sourceNamespace: livepeer-studio-api - sourceRevisionDigest: sha256:f3ea883f13fc67e60cb167af92c3e9be9ec4fea50eacd4130a1b51d7f1cd5102 - sourceBlobDigest: sha256:a6e21f46600c0ad7fc422459cc7392d99943317b4a24fd41190670ba78a55eb8 + sourceRevisionDigest: sha256:b2458801caccd85ea7011f90d46b4a83a2ebf6afc44bd9bf758967c34138ab51 + sourceBlobDigest: sha256:49cd7a48ce214c823876e8ab80123a471903a46286c6a4451984a62afd1c2718 + codeSamplesNamespace: livepeer-studio-api-code-samples + codeSamplesRevisionDigest: sha256:a9648a22fd434b6cc72568702f5eb3b15ec66c73e15dd2031ef8204d2622ffdb workflow: workflowVersion: 1.0.0 speakeasyVersion: latest @@ -31,3 +33,5 @@ workflow: source: livepeer-studio-api codeSamples: output: codeSamples.yaml + registry: + location: registry.speakeasyapi.dev/livepeer/livepeer-studio/livepeer-studio-api-code-samples diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index 01e55ef..08b4115 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -15,3 +15,5 @@ targets: source: livepeer-studio-api codeSamples: output: codeSamples.yaml + registry: + location: registry.speakeasyapi.dev/livepeer/livepeer-studio/livepeer-studio-api-code-samples diff --git a/README.md b/README.md index 5ba1e1c..a7e9626 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ what they return. * [Server Selection](#server-selection) * [Custom HTTP Client](#custom-http-client) * [Authentication](#authentication) -* [Special Types](#special-types) @@ -103,6 +102,7 @@ func main() { * [Upscale](docs/sdks/generate/README.md#upscale) - Upscale * [AudioToText](docs/sdks/generate/README.md#audiototext) - Audio To Text * [SegmentAnything2](docs/sdks/generate/README.md#segmentanything2) - Segment Anything 2 +* [Llm](docs/sdks/generate/README.md#llm) - LLM ### [Metrics](docs/sdks/metrics/README.md) @@ -184,12 +184,16 @@ func main() { ## Error Handling -Handling errors in this SDK should largely match your expectations. All operations return a response object or an error, they will never return both. When specified by the OpenAPI spec document, the SDK will return the appropriate subclass. +Handling errors in this SDK should largely match your expectations. All operations return a response object or an error, they will never return both. -| Error Object | Status Code | Content Type | -| ------------------ | ------------------ | ------------------ | -| sdkerrors.Error | 404 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | +By Default, an API error will return `sdkerrors.SDKError`. When custom error responses are specified for an operation, the SDK may also return their associated error. You can refer to respective *Errors* tables in SDK docs for more details on possible error types for each operation. + +For example, the `Get` function may return the following errors: + +| Error Type | Status Code | Content Type | +| ------------------ | ----------- | ---------------- | +| sdkerrors.Error | 404 | application/json | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ### Example @@ -268,9 +272,9 @@ This can be a convenient way to configure timeouts, cookies, proxies, custom hea This SDK supports the following security scheme globally: -| Name | Type | Scheme | -| ----------- | ----------- | ----------- | -| `APIKey` | http | HTTP Bearer | +| Name | Type | Scheme | +| -------- | ---- | ----------- | +| `APIKey` | http | HTTP Bearer | You can configure it using the `WithSecurity` option when initializing the SDK client instance. For example: ```go @@ -342,7 +346,7 @@ func main() { Multistream: &components.Multistream{ Targets: []components.Target{ components.Target{ - Profile: "720p", + Profile: "720p0", VideoOnly: livepeergo.Bool(false), ID: livepeergo.String("PUSH123"), Spec: &components.TargetSpec{ @@ -364,12 +368,6 @@ func main() { ``` - -## Special Types - - - - ## Retries @@ -447,7 +445,7 @@ func main() { Multistream: &components.Multistream{ Targets: []components.Target{ components.Target{ - Profile: "720p", + Profile: "720p0", VideoOnly: livepeergo.Bool(false), ID: livepeergo.String("PUSH123"), Spec: &components.TargetSpec{ @@ -560,7 +558,7 @@ func main() { Multistream: &components.Multistream{ Targets: []components.Target{ components.Target{ - Profile: "720p", + Profile: "720p0", VideoOnly: livepeergo.Bool(false), ID: livepeergo.String("PUSH123"), Spec: &components.TargetSpec{ diff --git a/RELEASES.md b/RELEASES.md index 6eefb1e..1656015 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -108,4 +108,14 @@ Based on: ### Generated - [go v0.4.0] . ### Releases -- [Go v0.4.0] https://github.com/livepeer/livepeer-go/releases/tag/v0.4.0 - . \ No newline at end of file +- [Go v0.4.0] https://github.com/livepeer/livepeer-go/releases/tag/v0.4.0 - . + +## 2024-11-16 00:30:17 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.440.1 (2.460.1) https://github.com/speakeasy-api/speakeasy +### Generated +- [go v0.5.0] . +### Releases +- [Go v0.5.0] https://github.com/livepeer/livepeer-go/releases/tag/v0.5.0 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index af39cb5..d212708 100644 --- a/USAGE.md +++ b/USAGE.md @@ -68,7 +68,7 @@ func main() { Multistream: &components.Multistream{ Targets: []components.Target{ components.Target{ - Profile: "720p", + Profile: "720p0", VideoOnly: livepeergo.Bool(false), ID: livepeergo.String("PUSH123"), Spec: &components.TargetSpec{ diff --git a/accesscontrol.go b/accesscontrol.go index 58efdf9..97e931b 100644 --- a/accesscontrol.go +++ b/accesscontrol.go @@ -12,7 +12,6 @@ import ( "github.com/livepeer/livepeer-go/models/components" "github.com/livepeer/livepeer-go/models/operations" "github.com/livepeer/livepeer-go/models/sdkerrors" - "io" "net/http" "net/url" ) @@ -171,21 +170,11 @@ func (s *AccessControl) Create(ctx context.Context, opts ...operations.Option) ( }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -197,42 +186,39 @@ func (s *AccessControl) Create(ctx context.Context, opts ...operations.Option) ( res.SigningKey = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -382,21 +368,11 @@ func (s *AccessControl) GetAll(ctx context.Context, opts ...operations.Option) ( }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -408,42 +384,39 @@ func (s *AccessControl) GetAll(ctx context.Context, opts ...operations.Option) ( res.Data = out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -597,47 +570,35 @@ func (s *AccessControl) Delete(ctx context.Context, keyID string, opts ...operat }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -791,21 +752,11 @@ func (s *AccessControl) Get(ctx context.Context, keyID string, opts ...operation }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -817,42 +768,39 @@ func (s *AccessControl) Get(ctx context.Context, keyID string, opts ...operation res.SigningKey = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1013,47 +961,35 @@ func (s *AccessControl) Update(ctx context.Context, keyID string, requestBody op }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/asset.go b/asset.go index 592a1ff..cd3825d 100644 --- a/asset.go +++ b/asset.go @@ -12,7 +12,6 @@ import ( "github.com/livepeer/livepeer-go/models/components" "github.com/livepeer/livepeer-go/models/operations" "github.com/livepeer/livepeer-go/models/sdkerrors" - "io" "net/http" "net/url" ) @@ -169,21 +168,11 @@ func (s *Asset) GetAll(ctx context.Context, opts ...operations.Option) (*operati }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -195,42 +184,39 @@ func (s *Asset) GetAll(ctx context.Context, opts ...operations.Option) (*operati res.Data = out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -456,21 +442,11 @@ func (s *Asset) Create(ctx context.Context, request components.NewAssetPayload, }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -482,42 +458,39 @@ func (s *Asset) Create(ctx context.Context, request components.NewAssetPayload, res.Data = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -673,21 +646,11 @@ func (s *Asset) CreateViaURL(ctx context.Context, request components.NewAssetFro }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -699,17 +662,16 @@ func (s *Asset) CreateViaURL(ctx context.Context, request components.NewAssetFro res.TwoHundredApplicationJSONData = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 201: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -721,42 +683,39 @@ func (s *Asset) CreateViaURL(ctx context.Context, request components.NewAssetFro res.TwoHundredAndOneApplicationJSONData = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -910,21 +869,11 @@ func (s *Asset) Get(ctx context.Context, assetID string, opts ...operations.Opti }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -936,42 +885,39 @@ func (s *Asset) Get(ctx context.Context, assetID string, opts ...operations.Opti res.Asset = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1132,21 +1078,11 @@ func (s *Asset) Update(ctx context.Context, assetID string, assetPatchPayload co }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1158,42 +1094,39 @@ func (s *Asset) Update(ctx context.Context, assetID string, assetPatchPayload co res.Asset = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1347,47 +1280,35 @@ func (s *Asset) Delete(ctx context.Context, assetID string, opts ...operations.O }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/codeSamples.yaml b/codeSamples.yaml index 3542794..f20470e 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -79,7 +79,7 @@ actions: ) ctx := context.Background() - res, err := s.AccessControl.Delete(ctx, "") + res, err := s.AccessControl.Delete(ctx, "") if err != nil { log.Fatal(err) } @@ -107,7 +107,7 @@ actions: ) ctx := context.Background() - res, err := s.AccessControl.Get(ctx, "") + res, err := s.AccessControl.Get(ctx, "") if err != nil { log.Fatal(err) } @@ -136,7 +136,7 @@ actions: ) ctx := context.Background() - res, err := s.AccessControl.Update(ctx, "", operations.UpdateSigningKeyRequestBody{}) + res, err := s.AccessControl.Update(ctx, "", operations.UpdateSigningKeyRequestBody{}) if err != nil { log.Fatal(err) } @@ -144,7 +144,7 @@ actions: // handle response } } - - target: $["paths"]["/api/beta/generate/audio-to-text"]["post"] + - target: $["paths"]["/api/generate/audio-to-text"]["post"] update: x-codeSamples: - lang: go @@ -184,7 +184,7 @@ actions: // handle response } } - - target: $["paths"]["/api/beta/generate/image-to-image"]["post"] + - target: $["paths"]["/api/generate/image-to-image"]["post"] update: x-codeSamples: - lang: go @@ -225,7 +225,7 @@ actions: // handle response } } - - target: $["paths"]["/api/beta/generate/image-to-video"]["post"] + - target: $["paths"]["/api/generate/image-to-video"]["post"] update: x-codeSamples: - lang: go @@ -265,7 +265,38 @@ actions: // handle response } } - - target: $["paths"]["/api/beta/generate/segment-anything-2"]["post"] + - target: $["paths"]["/api/generate/llm"]["post"] + update: + x-codeSamples: + - lang: go + label: genLLM + source: |- + package main + + import( + livepeergo "github.com/livepeer/livepeer-go" + "context" + "github.com/livepeer/livepeer-go/models/components" + "log" + ) + + func main() { + s := livepeergo.New( + livepeergo.WithSecurity(""), + ) + + ctx := context.Background() + res, err := s.Generate.Llm(ctx, components.BodyGenLLM{ + Prompt: "", + }) + if err != nil { + log.Fatal(err) + } + if res.LLMResponse != nil { + // handle response + } + } + - target: $["paths"]["/api/generate/segment-anything-2"]["post"] update: x-codeSamples: - lang: go @@ -305,7 +336,7 @@ actions: // handle response } } - - target: $["paths"]["/api/beta/generate/text-to-image"]["post"] + - target: $["paths"]["/api/generate/text-to-image"]["post"] update: x-codeSamples: - lang: go @@ -336,7 +367,7 @@ actions: // handle response } } - - target: $["paths"]["/api/beta/generate/upscale"]["post"] + - target: $["paths"]["/api/generate/upscale"]["post"] update: x-codeSamples: - lang: go @@ -505,6 +536,18 @@ actions: Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(), Encoder: components.TranscodeProfileEncoderH264.ToPointer(), }, + components.TranscodeProfile{ + Width: livepeergo.Int64(1280), + Name: livepeergo.String("720p"), + Height: livepeergo.Int64(720), + Bitrate: 3000000, + Quality: livepeergo.Int64(23), + Fps: livepeergo.Int64(30), + FpsDen: livepeergo.Int64(1), + Gop: livepeergo.String("2"), + Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(), + Encoder: components.TranscodeProfileEncoderH264.ToPointer(), + }, }, }) if err != nil { @@ -534,7 +577,7 @@ actions: ) ctx := context.Background() - res, err := s.Asset.Delete(ctx, "") + res, err := s.Asset.Delete(ctx, "") if err != nil { log.Fatal(err) } @@ -562,7 +605,7 @@ actions: ) ctx := context.Background() - res, err := s.Asset.Get(ctx, "") + res, err := s.Asset.Get(ctx, "") if err != nil { log.Fatal(err) } @@ -591,7 +634,7 @@ actions: ) ctx := context.Background() - res, err := s.Asset.Update(ctx, "", components.AssetPatchPayload{ + res, err := s.Asset.Update(ctx, "", components.AssetPatchPayload{ Name: livepeergo.String("filename.mp4"), PlaybackPolicy: &components.PlaybackPolicy{ Type: components.TypeWebhook, @@ -779,7 +822,7 @@ actions: ) ctx := context.Background() - res, err := s.Metrics.GetPublicViewership(ctx, "") + res, err := s.Metrics.GetPublicViewership(ctx, "") if err != nil { log.Fatal(err) } @@ -961,270 +1004,6 @@ actions: // handle response } } - - target: $["paths"]["/room"]["post"] - update: - x-codeSamples: - - lang: go - label: createRoom - source: |- - package main - - import( - livepeergo "github.com/livepeer/livepeer-go" - "context" - "log" - ) - - func main() { - s := livepeergo.New( - livepeergo.WithSecurity(""), - ) - - ctx := context.Background() - res, err := s.Room.Create(ctx) - if err != nil { - log.Fatal(err) - } - if res.CreateRoomResponse != nil { - // handle response - } - } - - target: $["paths"]["/room/{id}"]["delete"] - update: - x-codeSamples: - - lang: go - label: deleteRoom - source: |- - package main - - import( - livepeergo "github.com/livepeer/livepeer-go" - "context" - "log" - ) - - func main() { - s := livepeergo.New( - livepeergo.WithSecurity(""), - ) - - ctx := context.Background() - res, err := s.Room.Delete(ctx, "") - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/room/{id}"]["get"] - update: - x-codeSamples: - - lang: go - label: getRoom - source: |- - package main - - import( - livepeergo "github.com/livepeer/livepeer-go" - "context" - "log" - ) - - func main() { - s := livepeergo.New( - livepeergo.WithSecurity(""), - ) - - ctx := context.Background() - res, err := s.Room.Get(ctx, "") - if err != nil { - log.Fatal(err) - } - if res.Room != nil { - // handle response - } - } - - target: $["paths"]["/room/{id}/egress"]["delete"] - update: - x-codeSamples: - - lang: go - label: stopRoomEgress - source: |- - package main - - import( - livepeergo "github.com/livepeer/livepeer-go" - "context" - "log" - ) - - func main() { - s := livepeergo.New( - livepeergo.WithSecurity(""), - ) - - ctx := context.Background() - res, err := s.Room.StopEgress(ctx, "") - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/room/{id}/egress"]["post"] - update: - x-codeSamples: - - lang: go - label: startRoomEgress - source: |- - package main - - import( - livepeergo "github.com/livepeer/livepeer-go" - "context" - "github.com/livepeer/livepeer-go/models/components" - "log" - ) - - func main() { - s := livepeergo.New( - livepeergo.WithSecurity(""), - ) - - ctx := context.Background() - res, err := s.Room.StartEgress(ctx, "", components.RoomEgressPayload{ - StreamID: "aac12556-4d65-4d34-9fb6-d1f0985eb0a9", - }) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/room/{id}/user"]["post"] - update: - x-codeSamples: - - lang: go - label: createRoomUser - source: |- - package main - - import( - livepeergo "github.com/livepeer/livepeer-go" - "context" - "github.com/livepeer/livepeer-go/models/components" - "log" - ) - - func main() { - s := livepeergo.New( - livepeergo.WithSecurity(""), - ) - - ctx := context.Background() - res, err := s.Room.CreateUser(ctx, "", components.RoomUserPayload{ - Name: "name", - CanPublish: livepeergo.Bool(true), - CanPublishData: livepeergo.Bool(true), - }) - if err != nil { - log.Fatal(err) - } - if res.RoomUserResponse != nil { - // handle response - } - } - - target: $["paths"]["/room/{id}/user/{userId}"]["delete"] - update: - x-codeSamples: - - lang: go - label: deleteRoomUser - source: |- - package main - - import( - livepeergo "github.com/livepeer/livepeer-go" - "context" - "log" - ) - - func main() { - s := livepeergo.New( - livepeergo.WithSecurity(""), - ) - - ctx := context.Background() - res, err := s.Room.DeleteUser(ctx, "", "") - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - - target: $["paths"]["/room/{id}/user/{userId}"]["get"] - update: - x-codeSamples: - - lang: go - label: getRoomUser - source: |- - package main - - import( - livepeergo "github.com/livepeer/livepeer-go" - "context" - "log" - ) - - func main() { - s := livepeergo.New( - livepeergo.WithSecurity(""), - ) - - ctx := context.Background() - res, err := s.Room.GetUser(ctx, "", "") - if err != nil { - log.Fatal(err) - } - if res.GetRoomUserResponse != nil { - // handle response - } - } - - target: $["paths"]["/room/{id}/user/{userId}"]["put"] - update: - x-codeSamples: - - lang: go - label: updateRoomUser - source: |- - package main - - import( - livepeergo "github.com/livepeer/livepeer-go" - "context" - "github.com/livepeer/livepeer-go/models/components" - "log" - ) - - func main() { - s := livepeergo.New( - livepeergo.WithSecurity(""), - ) - - ctx := context.Background() - res, err := s.Room.UpdateUser(ctx, "", "", components.RoomUserUpdatePayload{ - CanPublish: livepeergo.Bool(true), - CanPublishData: livepeergo.Bool(true), - }) - if err != nil { - log.Fatal(err) - } - if res != nil { - // handle response - } - } - target: $["paths"]["/session"]["get"] update: x-codeSamples: @@ -1406,12 +1185,24 @@ actions: Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(), Encoder: components.TranscodeProfileEncoderH264.ToPointer(), }, + components.TranscodeProfile{ + Width: livepeergo.Int64(1280), + Name: livepeergo.String("720p"), + Height: livepeergo.Int64(720), + Bitrate: 3000000, + Quality: livepeergo.Int64(23), + Fps: livepeergo.Int64(30), + FpsDen: livepeergo.Int64(1), + Gop: livepeergo.String("2"), + Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(), + Encoder: components.TranscodeProfileEncoderH264.ToPointer(), + }, }, }, Multistream: &components.Multistream{ Targets: []components.Target{ components.Target{ - Profile: "720p", + Profile: "720p0", VideoOnly: livepeergo.Bool(false), ID: livepeergo.String("PUSH123"), Spec: &components.TargetSpec{ @@ -1511,7 +1302,7 @@ actions: Multistream: &components.Multistream{ Targets: []components.Target{ components.Target{ - Profile: "720p", + Profile: "720p0", VideoOnly: livepeergo.Bool(false), ID: livepeergo.String("PUSH123"), Spec: &components.TargetSpec{ @@ -1541,6 +1332,28 @@ actions: Gop: livepeergo.String("2"), Profile: components.ProfileH264Baseline.ToPointer(), }, + components.FfmpegProfile{ + Width: 1280, + Name: "720p", + Height: 720, + Bitrate: 3000000, + Fps: 30, + FpsDen: livepeergo.Int64(1), + Quality: livepeergo.Int64(23), + Gop: livepeergo.String("2"), + Profile: components.ProfileH264Baseline.ToPointer(), + }, + components.FfmpegProfile{ + Width: 1280, + Name: "720p", + Height: 720, + Bitrate: 3000000, + Fps: 30, + FpsDen: livepeergo.Int64(1), + Quality: livepeergo.Int64(23), + Gop: livepeergo.String("2"), + Profile: components.ProfileH264Baseline.ToPointer(), + }, }, RecordingSpec: &components.RecordingSpec{ Profiles: []components.TranscodeProfile{ @@ -1556,8 +1369,21 @@ actions: Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(), Encoder: components.TranscodeProfileEncoderH264.ToPointer(), }, + components.TranscodeProfile{ + Width: livepeergo.Int64(1280), + Name: livepeergo.String("720p"), + Height: livepeergo.Int64(720), + Bitrate: 3000000, + Quality: livepeergo.Int64(23), + Fps: livepeergo.Int64(30), + FpsDen: livepeergo.Int64(1), + Gop: livepeergo.String("2"), + Profile: components.TranscodeProfileProfileH264Baseline.ToPointer(), + Encoder: components.TranscodeProfileEncoderH264.ToPointer(), + }, }, }, + Name: livepeergo.String("test_stream"), }) if err != nil { log.Fatal(err) @@ -1651,7 +1477,7 @@ actions: ) ctx := context.Background() - res, err := s.Stream.RemoveMultistreamTarget(ctx, "", "") + res, err := s.Stream.RemoveMultistreamTarget(ctx, "", "") if err != nil { log.Fatal(err) } @@ -1735,7 +1561,7 @@ actions: ) ctx := context.Background() - res, err := s.Session.GetRecorded(ctx, "", livepeergo.Pointer(operations.CreateRecordBoolean( + res, err := s.Session.GetRecorded(ctx, "", livepeergo.Pointer(operations.CreateRecordBoolean( true, ))) if err != nil { @@ -1793,7 +1619,7 @@ actions: ) ctx := context.Background() - res, err := s.Task.Get(ctx, "") + res, err := s.Task.Get(ctx, "") if err != nil { log.Fatal(err) } @@ -1828,14 +1654,11 @@ actions: URL: "https://s3.amazonaws.com/bucket/file.mp4", }, ), - Storage: components.CreateTranscodePayloadStorageStorage1( - components.Storage1{ - Type: components.StorageTypeS3, - Endpoint: "https://gateway.storjshare.io", - Bucket: "outputbucket", - Credentials: components.StorageCredentials{ - AccessKeyID: "AKIAIOSFODNN7EXAMPLE", - SecretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", + Storage: components.CreateTranscodePayloadStorageStorage2( + components.Storage2{ + Type: components.TranscodePayloadStorageTypeWeb3Storage, + Credentials: components.TranscodePayloadStorageCredentials{ + Proof: "EaJlcm9vdHOAZ3ZlcnNpb24BmgIBcRIg2uxHpcPYSWNtifMKFkPC7IEDvFDCxCd3ADViv0coV7SnYXNYRO2hA0AnblHEW38s3lSlcwaDjPn", }, }, ), @@ -2082,7 +1905,7 @@ actions: ) ctx := context.Background() - res, err := s.Webhook.GetLog(ctx, "", "") + res, err := s.Webhook.GetLog(ctx, "", "") if err != nil { log.Fatal(err) } @@ -2110,7 +1933,7 @@ actions: ) ctx := context.Background() - res, err := s.Webhook.ResendLog(ctx, "", "") + res, err := s.Webhook.ResendLog(ctx, "", "") if err != nil { log.Fatal(err) } diff --git a/docs/models/components/asset.md b/docs/models/components/asset.md index 22d7fcf..9931ea3 100644 --- a/docs/models/components/asset.md +++ b/docs/models/components/asset.md @@ -10,7 +10,7 @@ | `PlaybackID` | **string* | :heavy_minus_sign: | The playback ID to use with the Playback Info endpoint to retrieve playback URLs. | eaw4nk06ts2d0mzb | | ~~`UserID`~~ | **string* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | 66E2161C-7670-4D05-B71D-DA2D6979556F | | `PlaybackURL` | **string* | :heavy_minus_sign: | URL for HLS playback. **It is recommended to not use this URL**, and instead use playback IDs with the Playback Info endpoint to retrieve the playback URLs - this URL format is subject to change (e.g. https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8). | https://livepeercdn.com/asset/ea03f37e-f861-4cdd-b495-0e60b6d753ad/index.m3u8 | -| `DownloadURL` | **string* | :heavy_minus_sign: | The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. It is not recommended to use this for playback. | https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video | +| `DownloadURL` | **string* | :heavy_minus_sign: | The URL to directly download the asset, e.g. `https://livepeercdn.com/asset/eawrrk06ts2d0mzb/video`. It is not recommended to use this for playback. | https://livepeercdn.com/asset/eaw4nk06ts2d0mzb/video/download.mp4 | | `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | | `Source` | [components.Source](../../models/components/source.md) | :heavy_check_mark: | N/A | | | `CreatorID` | [*components.CreatorID](../../models/components/creatorid.md) | :heavy_minus_sign: | N/A | | diff --git a/docs/models/components/bodygenaudiototext.md b/docs/models/components/bodygenaudiototext.md index 493921c..67dd27c 100644 --- a/docs/models/components/bodygenaudiototext.md +++ b/docs/models/components/bodygenaudiototext.md @@ -3,7 +3,8 @@ ## Fields -| Field | Type | Required | Description | -| ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- | -| `Audio` | [components.Audio](../../models/components/audio.md) | :heavy_check_mark: | Uploaded audio file to be transcribed. | -| `ModelID` | **string* | :heavy_minus_sign: | Hugging Face model ID used for transcription. | \ No newline at end of file +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Audio` | [components.Audio](../../models/components/audio.md) | :heavy_check_mark: | Uploaded audio file to be transcribed. | +| `ModelID` | **string* | :heavy_minus_sign: | Hugging Face model ID used for transcription. | +| `ReturnTimestamps` | **string* | :heavy_minus_sign: | Return timestamps for the transcribed text. Supported values: 'sentence', 'word', or a string boolean ('true' or 'false'). Default is 'true' ('sentence'). 'false' means no timestamps. 'word' means word-based timestamps. | \ No newline at end of file diff --git a/docs/models/components/bodygenimagetoimage.md b/docs/models/components/bodygenimagetoimage.md index f40a6bb..a393b76 100644 --- a/docs/models/components/bodygenimagetoimage.md +++ b/docs/models/components/bodygenimagetoimage.md @@ -3,16 +3,17 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | -| `Prompt` | *string* | :heavy_check_mark: | Text prompt(s) to guide image generation. | -| `Image` | [components.Image](../../models/components/image.md) | :heavy_check_mark: | Uploaded image to modify with the pipeline. | -| `ModelID` | **string* | :heavy_minus_sign: | Hugging Face model ID used for image generation. | -| `Strength` | **float64* | :heavy_minus_sign: | Degree of transformation applied to the reference image (0 to 1). | -| `GuidanceScale` | **float64* | :heavy_minus_sign: | Encourages model to generate images closely linked to the text prompt (higher values may reduce image quality). | -| `ImageGuidanceScale` | **float64* | :heavy_minus_sign: | Degree to which the generated image is pushed towards the initial image. | -| `NegativePrompt` | **string* | :heavy_minus_sign: | Text prompt(s) to guide what to exclude from image generation. Ignored if guidance_scale < 1. | -| `SafetyCheck` | **bool* | :heavy_minus_sign: | Perform a safety check to estimate if generated images could be offensive or harmful. | -| `Seed` | **int64* | :heavy_minus_sign: | Seed for random number generation. | -| `NumInferenceSteps` | **int64* | :heavy_minus_sign: | Number of denoising steps. More steps usually lead to higher quality images but slower inference. Modulated by strength. | -| `NumImagesPerPrompt` | **int64* | :heavy_minus_sign: | Number of images to generate per prompt. | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Prompt` | *string* | :heavy_check_mark: | Text prompt(s) to guide image generation. | +| `Image` | [components.Image](../../models/components/image.md) | :heavy_check_mark: | Uploaded image to modify with the pipeline. | +| `ModelID` | **string* | :heavy_minus_sign: | Hugging Face model ID used for image generation. | +| `Loras` | **string* | :heavy_minus_sign: | A LoRA (Low-Rank Adaptation) model and its corresponding weight for image generation. Example: { "latent-consistency/lcm-lora-sdxl": 1.0, "nerijs/pixel-art-xl": 1.2}. | +| `Strength` | **float64* | :heavy_minus_sign: | Degree of transformation applied to the reference image (0 to 1). | +| `GuidanceScale` | **float64* | :heavy_minus_sign: | Encourages model to generate images closely linked to the text prompt (higher values may reduce image quality). | +| `ImageGuidanceScale` | **float64* | :heavy_minus_sign: | Degree to which the generated image is pushed towards the initial image. | +| `NegativePrompt` | **string* | :heavy_minus_sign: | Text prompt(s) to guide what to exclude from image generation. Ignored if guidance_scale < 1. | +| `SafetyCheck` | **bool* | :heavy_minus_sign: | Perform a safety check to estimate if generated images could be offensive or harmful. | +| `Seed` | **int64* | :heavy_minus_sign: | Seed for random number generation. | +| `NumInferenceSteps` | **int64* | :heavy_minus_sign: | Number of denoising steps. More steps usually lead to higher quality images but slower inference. Modulated by strength. | +| `NumImagesPerPrompt` | **int64* | :heavy_minus_sign: | Number of images to generate per prompt. | \ No newline at end of file diff --git a/docs/models/components/bodygenllm.md b/docs/models/components/bodygenllm.md new file mode 100644 index 0000000..b4dc982 --- /dev/null +++ b/docs/models/components/bodygenllm.md @@ -0,0 +1,14 @@ +# BodyGenLLM + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Prompt` | *string* | :heavy_check_mark: | N/A | +| `ModelID` | **string* | :heavy_minus_sign: | N/A | +| `SystemMsg` | **string* | :heavy_minus_sign: | N/A | +| `Temperature` | **float64* | :heavy_minus_sign: | N/A | +| `MaxTokens` | **int64* | :heavy_minus_sign: | N/A | +| `History` | **string* | :heavy_minus_sign: | N/A | +| `Stream` | **bool* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/encryption.md b/docs/models/components/encryption.md new file mode 100644 index 0000000..6fb8768 --- /dev/null +++ b/docs/models/components/encryption.md @@ -0,0 +1,8 @@ +# Encryption + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| `EncryptedKey` | *string* | :heavy_check_mark: | Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be retrieved back. | \ No newline at end of file diff --git a/docs/models/components/error.md b/docs/models/components/error.md new file mode 100644 index 0000000..b644f4b --- /dev/null +++ b/docs/models/components/error.md @@ -0,0 +1,8 @@ +# Error + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Errors` | []*string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/llmresponse.md b/docs/models/components/llmresponse.md new file mode 100644 index 0000000..58bfd58 --- /dev/null +++ b/docs/models/components/llmresponse.md @@ -0,0 +1,9 @@ +# LLMResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `Response` | *string* | :heavy_check_mark: | N/A | +| `TokensUsed` | *int64* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/multistreamtargetinput.md b/docs/models/components/multistreamtargetinput.md new file mode 100644 index 0000000..cdfc163 --- /dev/null +++ b/docs/models/components/multistreamtargetinput.md @@ -0,0 +1,10 @@ +# MultistreamTargetInput + + +## Fields + +| Field | Type | Required | Description | Example | +| --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | +| `Name` | **string* | :heavy_minus_sign: | N/A | | +| `URL` | *string* | :heavy_check_mark: | Livepeer-compatible multistream target URL (RTMP(S) or SRT) | rtmps://live.my-service.tv/channel/secretKey | +| `Disabled` | **bool* | :heavy_minus_sign: | If true then this multistream target will not be used for pushing
even if it is configured in a stream object.
| | \ No newline at end of file diff --git a/docs/models/components/streampatchpayload.md b/docs/models/components/streampatchpayload.md index 3e8b856..36744fb 100644 --- a/docs/models/components/streampatchpayload.md +++ b/docs/models/components/streampatchpayload.md @@ -12,4 +12,5 @@ | `PlaybackPolicy` | [*components.PlaybackPolicy](../../models/components/playbackpolicy.md) | :heavy_minus_sign: | Whether the playback policy for an asset or stream is public or signed | | | `Profiles` | [][components.FfmpegProfile](../../models/components/ffmpegprofile.md) | :heavy_minus_sign: | N/A | | | `RecordingSpec` | [*components.RecordingSpec](../../models/components/recordingspec.md) | :heavy_minus_sign: | N/A | | -| `UserTags` | map[string][components.UserTags](../../models/components/usertags.md) | :heavy_minus_sign: | User input tags associated with the stream | | \ No newline at end of file +| `UserTags` | map[string][components.UserTags](../../models/components/usertags.md) | :heavy_minus_sign: | User input tags associated with the stream | | +| `Name` | **string* | :heavy_minus_sign: | N/A | test_stream | \ No newline at end of file diff --git a/docs/models/components/target.md b/docs/models/components/target.md new file mode 100644 index 0000000..12fc770 --- /dev/null +++ b/docs/models/components/target.md @@ -0,0 +1,11 @@ +# Target + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `Profile` | *string* | :heavy_check_mark: | Name of transcoding profile that should be sent. Use
"source" for pushing source stream data
| 720p0 | +| `VideoOnly` | **bool* | :heavy_minus_sign: | If true, the stream audio will be muted and only silent
video will be pushed to the target.
| false | +| `ID` | **string* | :heavy_minus_sign: | ID of multistream target object where to push this stream | PUSH123 | +| `Spec` | [*components.TargetSpec](../../models/components/targetspec.md) | :heavy_minus_sign: | Inline multistream target object. Will automatically
create the target resource to be used by the created
stream.
| | \ No newline at end of file diff --git a/docs/models/components/texttoimageparams.md b/docs/models/components/texttoimageparams.md index 48ed5e1..f79d7d1 100644 --- a/docs/models/components/texttoimageparams.md +++ b/docs/models/components/texttoimageparams.md @@ -3,15 +3,16 @@ ## Fields -| Field | Type | Required | Description | -| ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | -| `ModelID` | **string* | :heavy_minus_sign: | Hugging Face model ID used for image generation. | -| `Prompt` | *string* | :heavy_check_mark: | Text prompt(s) to guide image generation. Separate multiple prompts with '\|' if supported by the model. | -| `Height` | **int64* | :heavy_minus_sign: | The height in pixels of the generated image. | -| `Width` | **int64* | :heavy_minus_sign: | The width in pixels of the generated image. | -| `GuidanceScale` | **float64* | :heavy_minus_sign: | Encourages model to generate images closely linked to the text prompt (higher values may reduce image quality). | -| `NegativePrompt` | **string* | :heavy_minus_sign: | Text prompt(s) to guide what to exclude from image generation. Ignored if guidance_scale < 1. | -| `SafetyCheck` | **bool* | :heavy_minus_sign: | Perform a safety check to estimate if generated images could be offensive or harmful. | -| `Seed` | **int64* | :heavy_minus_sign: | Seed for random number generation. | -| `NumInferenceSteps` | **int64* | :heavy_minus_sign: | Number of denoising steps. More steps usually lead to higher quality images but slower inference. Modulated by strength. | -| `NumImagesPerPrompt` | **int64* | :heavy_minus_sign: | Number of images to generate per prompt. | \ No newline at end of file +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `ModelID` | **string* | :heavy_minus_sign: | Hugging Face model ID used for image generation. | +| `Loras` | **string* | :heavy_minus_sign: | A LoRA (Low-Rank Adaptation) model and its corresponding weight for image generation. Example: { "latent-consistency/lcm-lora-sdxl": 1.0, "nerijs/pixel-art-xl": 1.2}. | +| `Prompt` | *string* | :heavy_check_mark: | Text prompt(s) to guide image generation. Separate multiple prompts with '\|' if supported by the model. | +| `Height` | **int64* | :heavy_minus_sign: | The height in pixels of the generated image. | +| `Width` | **int64* | :heavy_minus_sign: | The width in pixels of the generated image. | +| `GuidanceScale` | **float64* | :heavy_minus_sign: | Encourages model to generate images closely linked to the text prompt (higher values may reduce image quality). | +| `NegativePrompt` | **string* | :heavy_minus_sign: | Text prompt(s) to guide what to exclude from image generation. Ignored if guidance_scale < 1. | +| `SafetyCheck` | **bool* | :heavy_minus_sign: | Perform a safety check to estimate if generated images could be offensive or harmful. | +| `Seed` | **int64* | :heavy_minus_sign: | Seed for random number generation. | +| `NumInferenceSteps` | **int64* | :heavy_minus_sign: | Number of denoising steps. More steps usually lead to higher quality images but slower inference. Modulated by strength. | +| `NumImagesPerPrompt` | **int64* | :heavy_minus_sign: | Number of images to generate per prompt. | \ No newline at end of file diff --git a/docs/models/components/webhookinput.md b/docs/models/components/webhookinput.md new file mode 100644 index 0000000..6306e96 --- /dev/null +++ b/docs/models/components/webhookinput.md @@ -0,0 +1,13 @@ +# WebhookInput + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `Name` | *string* | :heavy_check_mark: | N/A | test_webhook | +| `ProjectID` | **string* | :heavy_minus_sign: | The ID of the project | aac12556-4d65-4d34-9fb6-d1f0985eb0a9 | +| `Events` | [][components.Events](../../models/components/events.md) | :heavy_minus_sign: | N/A | [
"stream.started",
"stream.idle"
] | +| `URL` | *string* | :heavy_check_mark: | N/A | https://my-service.com/webhook | +| `SharedSecret` | **string* | :heavy_minus_sign: | shared secret used to sign the webhook payload | my-secret | +| `StreamID` | **string* | :heavy_minus_sign: | streamId of the stream on which the webhook is applied | de7818e7-610a-4057-8f6f-b785dc1e6f88 | \ No newline at end of file diff --git a/docs/models/operations/addmultistreamtargetresponse.md b/docs/models/operations/addmultistreamtargetresponse.md index 59e449c..62cb0a5 100644 --- a/docs/models/operations/addmultistreamtargetresponse.md +++ b/docs/models/operations/addmultistreamtargetresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/createclipresponse.md b/docs/models/operations/createclipresponse.md index 3d23582..e647858 100644 --- a/docs/models/operations/createclipresponse.md +++ b/docs/models/operations/createclipresponse.md @@ -7,4 +7,4 @@ | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [*operations.CreateClipData](../../models/operations/createclipdata.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/createmultistreamtargetresponse.md b/docs/models/operations/createmultistreamtargetresponse.md index 5f5dbaa..2888786 100644 --- a/docs/models/operations/createmultistreamtargetresponse.md +++ b/docs/models/operations/createmultistreamtargetresponse.md @@ -7,4 +7,4 @@ | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `MultistreamTarget` | [*components.MultistreamTarget](../../models/components/multistreamtarget.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/createroomresponse.md b/docs/models/operations/createroomresponse.md index 5e369ce..848f1a8 100644 --- a/docs/models/operations/createroomresponse.md +++ b/docs/models/operations/createroomresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `CreateRoomResponse` | [*components.CreateRoomResponse](../../models/components/createroomresponse.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/createroomuserresponse.md b/docs/models/operations/createroomuserresponse.md index 456eb75..ef704ef 100644 --- a/docs/models/operations/createroomuserresponse.md +++ b/docs/models/operations/createroomuserresponse.md @@ -7,4 +7,4 @@ | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `RoomUserResponse` | [*components.RoomUserResponse](../../models/components/roomuserresponse.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/createsigningkeyresponse.md b/docs/models/operations/createsigningkeyresponse.md index 906e173..883e539 100644 --- a/docs/models/operations/createsigningkeyresponse.md +++ b/docs/models/operations/createsigningkeyresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `SigningKey` | [*components.SigningKey](../../models/components/signingkey.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/createstreamresponse.md b/docs/models/operations/createstreamresponse.md index f26770a..14ac257 100644 --- a/docs/models/operations/createstreamresponse.md +++ b/docs/models/operations/createstreamresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Stream` | [*components.Stream](../../models/components/stream.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/createwebhookresponse.md b/docs/models/operations/createwebhookresponse.md index 2d50cc9..7265010 100644 --- a/docs/models/operations/createwebhookresponse.md +++ b/docs/models/operations/createwebhookresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Webhook` | [*components.Webhook](../../models/components/webhook.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/deleteassetresponse.md b/docs/models/operations/deleteassetresponse.md index b7ea7c3..1d706a5 100644 --- a/docs/models/operations/deleteassetresponse.md +++ b/docs/models/operations/deleteassetresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/deletemultistreamtargetresponse.md b/docs/models/operations/deletemultistreamtargetresponse.md index 7ce7c05..7ca1602 100644 --- a/docs/models/operations/deletemultistreamtargetresponse.md +++ b/docs/models/operations/deletemultistreamtargetresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/deleteroomresponse.md b/docs/models/operations/deleteroomresponse.md index f08711c..50f2d9f 100644 --- a/docs/models/operations/deleteroomresponse.md +++ b/docs/models/operations/deleteroomresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/deleteroomuserresponse.md b/docs/models/operations/deleteroomuserresponse.md index 53c551f..85f0b6c 100644 --- a/docs/models/operations/deleteroomuserresponse.md +++ b/docs/models/operations/deleteroomuserresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/deletesigningkeyresponse.md b/docs/models/operations/deletesigningkeyresponse.md index 9350336..5eb503a 100644 --- a/docs/models/operations/deletesigningkeyresponse.md +++ b/docs/models/operations/deletesigningkeyresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/deletestreamresponse.md b/docs/models/operations/deletestreamresponse.md index 7802b30..4eaa21d 100644 --- a/docs/models/operations/deletestreamresponse.md +++ b/docs/models/operations/deletestreamresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/deletewebhookresponse.md b/docs/models/operations/deletewebhookresponse.md index dc8e218..c6876ed 100644 --- a/docs/models/operations/deletewebhookresponse.md +++ b/docs/models/operations/deletewebhookresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Webhook` | [*components.Webhook](../../models/components/webhook.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/genllmresponse.md b/docs/models/operations/genllmresponse.md new file mode 100644 index 0000000..7bae050 --- /dev/null +++ b/docs/models/operations/genllmresponse.md @@ -0,0 +1,10 @@ +# GenLLMResponse + + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | +| `LLMResponse` | [*components.LLMResponse](../../models/components/llmresponse.md) | :heavy_minus_sign: | Successful Response | +| `StudioAPIError` | [*components.StudioAPIError](../../models/components/studioapierror.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getassetresponse.md b/docs/models/operations/getassetresponse.md index c5082c2..885c841 100644 --- a/docs/models/operations/getassetresponse.md +++ b/docs/models/operations/getassetresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Asset` | [*components.Asset](../../models/components/asset.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getassetsresponse.md b/docs/models/operations/getassetsresponse.md index f606acf..662701a 100644 --- a/docs/models/operations/getassetsresponse.md +++ b/docs/models/operations/getassetsresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [][components.Asset](../../models/components/asset.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getclipsresponse.md b/docs/models/operations/getclipsresponse.md index de3f2f0..75154d7 100644 --- a/docs/models/operations/getclipsresponse.md +++ b/docs/models/operations/getclipsresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [][components.Asset](../../models/components/asset.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getcreatorviewershipmetricsresponse.md b/docs/models/operations/getcreatorviewershipmetricsresponse.md index ab8a9cc..aa03d5e 100644 --- a/docs/models/operations/getcreatorviewershipmetricsresponse.md +++ b/docs/models/operations/getcreatorviewershipmetricsresponse.md @@ -7,4 +7,4 @@ | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [][components.ViewershipMetric](../../models/components/viewershipmetric.md) | :heavy_minus_sign: | A list of Metric objects | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getmultistreamtargetresponse.md b/docs/models/operations/getmultistreamtargetresponse.md index 3732916..5298999 100644 --- a/docs/models/operations/getmultistreamtargetresponse.md +++ b/docs/models/operations/getmultistreamtargetresponse.md @@ -7,4 +7,4 @@ | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `MultistreamTarget` | [*components.MultistreamTarget](../../models/components/multistreamtarget.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getmultistreamtargetsresponse.md b/docs/models/operations/getmultistreamtargetsresponse.md index a212e82..db0e737 100644 --- a/docs/models/operations/getmultistreamtargetsresponse.md +++ b/docs/models/operations/getmultistreamtargetsresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [][components.MultistreamTarget](../../models/components/multistreamtarget.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getplaybackinforesponse.md b/docs/models/operations/getplaybackinforesponse.md index a7c4230..b7cb65c 100644 --- a/docs/models/operations/getplaybackinforesponse.md +++ b/docs/models/operations/getplaybackinforesponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `PlaybackInfo` | [*components.PlaybackInfo](../../models/components/playbackinfo.md) | :heavy_minus_sign: | Successful response | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Playback not found | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Playback not found | \ No newline at end of file diff --git a/docs/models/operations/getpublicviewershipmetricsresponse.md b/docs/models/operations/getpublicviewershipmetricsresponse.md index 4144c8f..1974508 100644 --- a/docs/models/operations/getpublicviewershipmetricsresponse.md +++ b/docs/models/operations/getpublicviewershipmetricsresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [*operations.GetPublicViewershipMetricsData](../../models/operations/getpublicviewershipmetricsdata.md) | :heavy_minus_sign: | A single Metric object with the viewCount and playtimeMins metrics. | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getrealtimeviewershipnowresponse.md b/docs/models/operations/getrealtimeviewershipnowresponse.md index c94667f..6b1bcaf 100644 --- a/docs/models/operations/getrealtimeviewershipnowresponse.md +++ b/docs/models/operations/getrealtimeviewershipnowresponse.md @@ -7,4 +7,4 @@ | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [][components.RealtimeViewershipMetric](../../models/components/realtimeviewershipmetric.md) | :heavy_minus_sign: | A list of Metric objects | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getrecordedsessionsresponse.md b/docs/models/operations/getrecordedsessionsresponse.md index bdc544d..79778f6 100644 --- a/docs/models/operations/getrecordedsessionsresponse.md +++ b/docs/models/operations/getrecordedsessionsresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [][components.Session](../../models/components/session.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getroomresponse.md b/docs/models/operations/getroomresponse.md index 5329acb..7d57947 100644 --- a/docs/models/operations/getroomresponse.md +++ b/docs/models/operations/getroomresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Room` | [*components.Room](../../models/components/room.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getroomuserresponse.md b/docs/models/operations/getroomuserresponse.md index c225585..b2955e7 100644 --- a/docs/models/operations/getroomuserresponse.md +++ b/docs/models/operations/getroomuserresponse.md @@ -7,4 +7,4 @@ | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `GetRoomUserResponse` | [*components.GetRoomUserResponse](../../models/components/getroomuserresponse.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getsessionclipsresponse.md b/docs/models/operations/getsessionclipsresponse.md index eb218ef..6e8d72b 100644 --- a/docs/models/operations/getsessionclipsresponse.md +++ b/docs/models/operations/getsessionclipsresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [][components.Asset](../../models/components/asset.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getsessionresponse.md b/docs/models/operations/getsessionresponse.md index 2a1005d..c0bad5c 100644 --- a/docs/models/operations/getsessionresponse.md +++ b/docs/models/operations/getsessionresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Session` | [*components.Session](../../models/components/session.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getsessionsresponse.md b/docs/models/operations/getsessionsresponse.md index 5a9fcea..bc3c436 100644 --- a/docs/models/operations/getsessionsresponse.md +++ b/docs/models/operations/getsessionsresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [][components.Session](../../models/components/session.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getsigningkeyresponse.md b/docs/models/operations/getsigningkeyresponse.md index e1d5e9b..8f37e86 100644 --- a/docs/models/operations/getsigningkeyresponse.md +++ b/docs/models/operations/getsigningkeyresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `SigningKey` | [*components.SigningKey](../../models/components/signingkey.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getsigningkeysresponse.md b/docs/models/operations/getsigningkeysresponse.md index e5e6d83..a278d31 100644 --- a/docs/models/operations/getsigningkeysresponse.md +++ b/docs/models/operations/getsigningkeysresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [][components.SigningKey](../../models/components/signingkey.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getstreamresponse.md b/docs/models/operations/getstreamresponse.md index 5e71833..51d42b3 100644 --- a/docs/models/operations/getstreamresponse.md +++ b/docs/models/operations/getstreamresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Stream` | [*components.Stream](../../models/components/stream.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getstreamsresponse.md b/docs/models/operations/getstreamsresponse.md index 8e1b355..970a13a 100644 --- a/docs/models/operations/getstreamsresponse.md +++ b/docs/models/operations/getstreamsresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [][components.Stream](../../models/components/stream.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/gettasksresponse.md b/docs/models/operations/gettasksresponse.md index b4d0825..d70916d 100644 --- a/docs/models/operations/gettasksresponse.md +++ b/docs/models/operations/gettasksresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [][components.Task](../../models/components/task.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getusagemetricsresponse.md b/docs/models/operations/getusagemetricsresponse.md index 64605d5..320e8c7 100644 --- a/docs/models/operations/getusagemetricsresponse.md +++ b/docs/models/operations/getusagemetricsresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `UsageMetric` | [*components.UsageMetric](../../models/components/usagemetric.md) | :heavy_minus_sign: | A Usage Metric object | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getviewershipmetricsresponse.md b/docs/models/operations/getviewershipmetricsresponse.md index aa67ff3..45288c2 100644 --- a/docs/models/operations/getviewershipmetricsresponse.md +++ b/docs/models/operations/getviewershipmetricsresponse.md @@ -7,4 +7,4 @@ | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [][components.ViewershipMetric](../../models/components/viewershipmetric.md) | :heavy_minus_sign: | A list of Metric objects | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getwebhooklogresponse.md b/docs/models/operations/getwebhooklogresponse.md index 499b2bb..2fef315 100644 --- a/docs/models/operations/getwebhooklogresponse.md +++ b/docs/models/operations/getwebhooklogresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `WebhookLog` | [*components.WebhookLog](../../models/components/webhooklog.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getwebhooklogsresponse.md b/docs/models/operations/getwebhooklogsresponse.md index 2c3e5d3..d6da1c3 100644 --- a/docs/models/operations/getwebhooklogsresponse.md +++ b/docs/models/operations/getwebhooklogsresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [][components.WebhookLog](../../models/components/webhooklog.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getwebhookresponse.md b/docs/models/operations/getwebhookresponse.md index 40a95de..d8e7cff 100644 --- a/docs/models/operations/getwebhookresponse.md +++ b/docs/models/operations/getwebhookresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Webhook` | [*components.Webhook](../../models/components/webhook.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/getwebhooksresponse.md b/docs/models/operations/getwebhooksresponse.md index a516bc9..957966c 100644 --- a/docs/models/operations/getwebhooksresponse.md +++ b/docs/models/operations/getwebhooksresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [][components.Webhook](../../models/components/webhook.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/removemultistreamtargetresponse.md b/docs/models/operations/removemultistreamtargetresponse.md index 308369d..496d079 100644 --- a/docs/models/operations/removemultistreamtargetresponse.md +++ b/docs/models/operations/removemultistreamtargetresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/requestuploadresponse.md b/docs/models/operations/requestuploadresponse.md index 9b3c56f..b232656 100644 --- a/docs/models/operations/requestuploadresponse.md +++ b/docs/models/operations/requestuploadresponse.md @@ -7,4 +7,4 @@ | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Data` | [*operations.RequestUploadData](../../models/operations/requestuploaddata.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/resendwebhookresponse.md b/docs/models/operations/resendwebhookresponse.md index f84b81d..97ba3dd 100644 --- a/docs/models/operations/resendwebhookresponse.md +++ b/docs/models/operations/resendwebhookresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `WebhookLog` | [*components.WebhookLog](../../models/components/webhooklog.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/startpullstreamresponse.md b/docs/models/operations/startpullstreamresponse.md index 86bae85..b42701a 100644 --- a/docs/models/operations/startpullstreamresponse.md +++ b/docs/models/operations/startpullstreamresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/startroomegressresponse.md b/docs/models/operations/startroomegressresponse.md index 7104209..6c99d53 100644 --- a/docs/models/operations/startroomegressresponse.md +++ b/docs/models/operations/startroomegressresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/stoproomegressresponse.md b/docs/models/operations/stoproomegressresponse.md index d875e7c..afa0309 100644 --- a/docs/models/operations/stoproomegressresponse.md +++ b/docs/models/operations/stoproomegressresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/terminatestreamresponse.md b/docs/models/operations/terminatestreamresponse.md index 46e432f..4410447 100644 --- a/docs/models/operations/terminatestreamresponse.md +++ b/docs/models/operations/terminatestreamresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/transcodevideoresponse.md b/docs/models/operations/transcodevideoresponse.md index c361a66..7a6a3e0 100644 --- a/docs/models/operations/transcodevideoresponse.md +++ b/docs/models/operations/transcodevideoresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Task` | [*components.Task](../../models/components/task.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/updateassetresponse.md b/docs/models/operations/updateassetresponse.md index f761f43..655537d 100644 --- a/docs/models/operations/updateassetresponse.md +++ b/docs/models/operations/updateassetresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Asset` | [*components.Asset](../../models/components/asset.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/updatemultistreamtargetresponse.md b/docs/models/operations/updatemultistreamtargetresponse.md index 27031a0..32cb96c 100644 --- a/docs/models/operations/updatemultistreamtargetresponse.md +++ b/docs/models/operations/updatemultistreamtargetresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/updateroomuserresponse.md b/docs/models/operations/updateroomuserresponse.md index 09b13f0..2470277 100644 --- a/docs/models/operations/updateroomuserresponse.md +++ b/docs/models/operations/updateroomuserresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/updatesigningkeyresponse.md b/docs/models/operations/updatesigningkeyresponse.md index 189b51b..5643605 100644 --- a/docs/models/operations/updatesigningkeyresponse.md +++ b/docs/models/operations/updatesigningkeyresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/updatestreamresponse.md b/docs/models/operations/updatestreamresponse.md index d34b361..4031a8a 100644 --- a/docs/models/operations/updatestreamresponse.md +++ b/docs/models/operations/updatestreamresponse.md @@ -6,4 +6,4 @@ | Field | Type | Required | Description | | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/updatewebhookresponse.md b/docs/models/operations/updatewebhookresponse.md index d67e72a..5d0a6bd 100644 --- a/docs/models/operations/updatewebhookresponse.md +++ b/docs/models/operations/updatewebhookresponse.md @@ -7,4 +7,4 @@ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `Webhook` | [*components.Webhook](../../models/components/webhook.md) | :heavy_minus_sign: | Success | -| `Error` | **sdkerrors.Error* | :heavy_minus_sign: | Error | \ No newline at end of file +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/operations/uploadassetresponse.md b/docs/models/operations/uploadassetresponse.md index 947298e..d872b6e 100644 --- a/docs/models/operations/uploadassetresponse.md +++ b/docs/models/operations/uploadassetresponse.md @@ -8,4 +8,4 @@ | `HTTPMeta` | [components.HTTPMetadata](../../models/components/httpmetadata.md) | :heavy_check_mark: | N/A | | `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 +| `Error` | [*components.Error](../../models/components/error.md) | :heavy_minus_sign: | Error | \ No newline at end of file diff --git a/docs/models/sdkerrors/genaudiototextgenerateresponse415responsebody.md b/docs/models/sdkerrors/genaudiototextgenerateresponse415responsebody.md new file mode 100644 index 0000000..cb7d29d --- /dev/null +++ b/docs/models/sdkerrors/genaudiototextgenerateresponse415responsebody.md @@ -0,0 +1,19 @@ +# GenAudioToTextGenerateResponse415ResponseBody + +Unsupported Media Type + + +## Supported Types + +### HTTPError + +```go +genAudioToTextGenerateResponse415ResponseBody := sdkerrors.CreateGenAudioToTextGenerateResponse415ResponseBodyHTTPError(components.HTTPError{/* values here */}) +``` + +### StudioAPIError + +```go +genAudioToTextGenerateResponse415ResponseBody := sdkerrors.CreateGenAudioToTextGenerateResponse415ResponseBodyStudioAPIError(components.StudioAPIError{/* values here */}) +``` + diff --git a/docs/models/sdkerrors/genllmgenerateresponse500responsebody.md b/docs/models/sdkerrors/genllmgenerateresponse500responsebody.md new file mode 100644 index 0000000..3419fb0 --- /dev/null +++ b/docs/models/sdkerrors/genllmgenerateresponse500responsebody.md @@ -0,0 +1,19 @@ +# GenLLMGenerateResponse500ResponseBody + +Internal Server Error + + +## Supported Types + +### HTTPError + +```go +genLLMGenerateResponse500ResponseBody := sdkerrors.CreateGenLLMGenerateResponse500ResponseBodyHTTPError(components.HTTPError{/* values here */}) +``` + +### StudioAPIError + +```go +genLLMGenerateResponse500ResponseBody := sdkerrors.CreateGenLLMGenerateResponse500ResponseBodyStudioAPIError(components.StudioAPIError{/* values here */}) +``` + diff --git a/docs/models/sdkerrors/genllmgenerateresponsebody.md b/docs/models/sdkerrors/genllmgenerateresponsebody.md new file mode 100644 index 0000000..aa85160 --- /dev/null +++ b/docs/models/sdkerrors/genllmgenerateresponsebody.md @@ -0,0 +1,19 @@ +# GenLLMGenerateResponseBody + +Unauthorized + + +## Supported Types + +### HTTPError + +```go +genLLMGenerateResponseBody := sdkerrors.CreateGenLLMGenerateResponseBodyHTTPError(components.HTTPError{/* values here */}) +``` + +### StudioAPIError + +```go +genLLMGenerateResponseBody := sdkerrors.CreateGenLLMGenerateResponseBodyStudioAPIError(components.StudioAPIError{/* values here */}) +``` + diff --git a/docs/models/sdkerrors/genllmgenerateresponseresponsebody.md b/docs/models/sdkerrors/genllmgenerateresponseresponsebody.md new file mode 100644 index 0000000..08b936d --- /dev/null +++ b/docs/models/sdkerrors/genllmgenerateresponseresponsebody.md @@ -0,0 +1,19 @@ +# GenLLMGenerateResponseResponseBody + +Validation Error + + +## Supported Types + +### HTTPValidationError + +```go +genLLMGenerateResponseResponseBody := sdkerrors.CreateGenLLMGenerateResponseResponseBodyHTTPValidationError(components.HTTPValidationError{/* values here */}) +``` + +### StudioAPIError + +```go +genLLMGenerateResponseResponseBody := sdkerrors.CreateGenLLMGenerateResponseResponseBodyStudioAPIError(components.StudioAPIError{/* values here */}) +``` + diff --git a/docs/models/sdkerrors/genllmresponsebody.md b/docs/models/sdkerrors/genllmresponsebody.md new file mode 100644 index 0000000..cc513b8 --- /dev/null +++ b/docs/models/sdkerrors/genllmresponsebody.md @@ -0,0 +1,19 @@ +# GenLLMResponseBody + +Bad Request + + +## Supported Types + +### HTTPError + +```go +genLLMResponseBody := sdkerrors.CreateGenLLMResponseBodyHTTPError(components.HTTPError{/* values here */}) +``` + +### StudioAPIError + +```go +genLLMResponseBody := sdkerrors.CreateGenLLMResponseBodyStudioAPIError(components.StudioAPIError{/* values here */}) +``` + diff --git a/docs/sdks/accesscontrol/README.md b/docs/sdks/accesscontrol/README.md index d5c8121..aeec239 100644 --- a/docs/sdks/accesscontrol/README.md +++ b/docs/sdks/accesscontrol/README.md @@ -59,10 +59,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## GetAll @@ -108,10 +107,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Delete @@ -158,10 +156,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Get @@ -208,10 +205,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Update @@ -260,6 +256,6 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/asset/README.md b/docs/sdks/asset/README.md index 6bd16f5..a1f732b 100644 --- a/docs/sdks/asset/README.md +++ b/docs/sdks/asset/README.md @@ -58,10 +58,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Create @@ -205,10 +204,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## CreateViaURL @@ -282,10 +280,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Get @@ -332,10 +329,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Update @@ -394,10 +390,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Delete @@ -444,6 +439,6 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/generate/README.md b/docs/sdks/generate/README.md index 6043883..852b189 100644 --- a/docs/sdks/generate/README.md +++ b/docs/sdks/generate/README.md @@ -13,6 +13,7 @@ Operations related to AI generate api * [Upscale](#upscale) - Upscale * [AudioToText](#audiototext) - Audio To Text * [SegmentAnything2](#segmentanything2) - Segment Anything 2 +* [Llm](#llm) - LLM ## TextToImage @@ -62,14 +63,13 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | | sdkerrors.GenTextToImageResponseBody | 400 | application/json | | sdkerrors.GenTextToImageGenerateResponseBody | 401 | application/json | | sdkerrors.GenTextToImageGenerateResponseResponseBody | 422 | application/json | | sdkerrors.GenTextToImageGenerateResponse500ResponseBody | 500 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## ImageToImage @@ -129,14 +129,13 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | sdkerrors.GenImageToImageResponseBody | 400 | application/json | | sdkerrors.GenImageToImageGenerateResponseBody | 401 | application/json | | sdkerrors.GenImageToImageGenerateResponseResponseBody | 422 | application/json | | sdkerrors.GenImageToImageGenerateResponse500ResponseBody | 500 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## ImageToVideo @@ -195,14 +194,13 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | | sdkerrors.GenImageToVideoResponseBody | 400 | application/json | | sdkerrors.GenImageToVideoGenerateResponseBody | 401 | application/json | | sdkerrors.GenImageToVideoGenerateResponseResponseBody | 422 | application/json | | sdkerrors.GenImageToVideoGenerateResponse500ResponseBody | 500 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Upscale @@ -262,14 +260,13 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------------------------------------------- | --------------------------------------------------- | --------------------------------------------------- | | sdkerrors.GenUpscaleResponseBody | 400 | application/json | | sdkerrors.GenUpscaleGenerateResponseBody | 401 | application/json | | sdkerrors.GenUpscaleGenerateResponseResponseBody | 422 | application/json | | sdkerrors.GenUpscaleGenerateResponse500ResponseBody | 500 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## AudioToText @@ -328,15 +325,15 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | | sdkerrors.GenAudioToTextResponseBody | 400 | application/json | | sdkerrors.GenAudioToTextGenerateResponseBody | 401 | application/json | | sdkerrors.GenAudioToTextGenerateResponseResponseBody | 413 | application/json | +| sdkerrors.GenAudioToTextGenerateResponse415ResponseBody | 415 | application/json | | sdkerrors.GenAudioToTextGenerateResponse422ResponseBody | 422 | application/json | | sdkerrors.GenAudioToTextGenerateResponse500ResponseBody | 500 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## SegmentAnything2 @@ -395,10 +392,66 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | | sdkerrors.GenSegmentAnything2ResponseBody | 400 | application/json | | sdkerrors.GenSegmentAnything2GenerateResponseBody | 401 | application/json | | sdkerrors.GenSegmentAnything2GenerateResponseResponseBody | 422 | application/json | | sdkerrors.GenSegmentAnything2GenerateResponse500ResponseBody | 500 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | + +## Llm + +Generate text using a language model. + +### Example Usage + +```go +package main + +import( + livepeergo "github.com/livepeer/livepeer-go" + "context" + "github.com/livepeer/livepeer-go/models/components" + "log" +) + +func main() { + s := livepeergo.New( + livepeergo.WithSecurity(""), + ) + + ctx := context.Background() + res, err := s.Generate.Llm(ctx, components.BodyGenLLM{ + Prompt: "", + }) + if err != nil { + log.Fatal(err) + } + if res.LLMResponse != nil { + // handle response + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `ctx` | [context.Context](https://pkg.go.dev/context#Context) | :heavy_check_mark: | The context to use for the request. | +| `request` | [components.BodyGenLLM](../../models/components/bodygenllm.md) | :heavy_check_mark: | The request object to use for the request. | +| `opts` | [][operations.Option](../../models/operations/option.md) | :heavy_minus_sign: | The options for this request. | + +### Response + +**[*operations.GenLLMResponse](../../models/operations/genllmresponse.md), error** + +### Errors + +| Error Type | Status Code | Content Type | +| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- | +| sdkerrors.GenLLMResponseBody | 400 | application/json | +| sdkerrors.GenLLMGenerateResponseBody | 401 | application/json | +| sdkerrors.GenLLMGenerateResponseResponseBody | 422 | application/json | +| sdkerrors.GenLLMGenerateResponse500ResponseBody | 500 | application/json | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/metrics/README.md b/docs/sdks/metrics/README.md index 4682129..c21c7a1 100644 --- a/docs/sdks/metrics/README.md +++ b/docs/sdks/metrics/README.md @@ -61,10 +61,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## GetViewership @@ -113,10 +112,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## GetCreatorViewership @@ -165,10 +163,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## GetPublicViewership @@ -218,10 +215,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## GetUsage @@ -269,6 +265,6 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/multistream/README.md b/docs/sdks/multistream/README.md index e59c424..c3dc267 100644 --- a/docs/sdks/multistream/README.md +++ b/docs/sdks/multistream/README.md @@ -57,10 +57,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Create @@ -110,10 +109,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Get @@ -160,10 +158,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Update @@ -214,10 +211,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Delete @@ -266,6 +262,6 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/playback/README.md b/docs/sdks/playback/README.md index e266b7e..0627670 100644 --- a/docs/sdks/playback/README.md +++ b/docs/sdks/playback/README.md @@ -54,7 +54,7 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | | sdkerrors.Error | 404 | application/json | -| sdkerrors.SDKError | 4xx-5xx | */* | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/room/README.md b/docs/sdks/room/README.md index d04b47a..cea01dd 100644 --- a/docs/sdks/room/README.md +++ b/docs/sdks/room/README.md @@ -64,10 +64,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## ~~Get~~ @@ -116,10 +115,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## ~~Delete~~ @@ -168,10 +166,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## ~~StartEgress~~ @@ -226,10 +223,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## ~~StopEgress~~ @@ -278,10 +274,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## ~~CreateUser~~ @@ -339,10 +334,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## ~~GetUser~~ @@ -392,10 +386,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## ~~UpdateUser~~ @@ -450,10 +443,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## ~~DeleteUser~~ @@ -503,6 +495,6 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/session/README.md b/docs/sdks/session/README.md index 1fa375d..39921e5 100644 --- a/docs/sdks/session/README.md +++ b/docs/sdks/session/README.md @@ -57,10 +57,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## GetAll @@ -106,10 +105,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Get @@ -156,10 +154,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## GetRecorded @@ -209,6 +206,6 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/stream/README.md b/docs/sdks/stream/README.md index de10662..dbd6e16 100644 --- a/docs/sdks/stream/README.md +++ b/docs/sdks/stream/README.md @@ -107,7 +107,7 @@ func main() { Multistream: &components.Multistream{ Targets: []components.Target{ components.Target{ - Profile: "720p", + Profile: "720p0", VideoOnly: livepeergo.Bool(false), ID: livepeergo.String("PUSH123"), Spec: &components.TargetSpec{ @@ -141,10 +141,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## GetAll @@ -191,10 +190,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Get @@ -241,10 +239,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Update @@ -273,7 +270,7 @@ func main() { Multistream: &components.Multistream{ Targets: []components.Target{ components.Target{ - Profile: "720p", + Profile: "720p0", VideoOnly: livepeergo.Bool(false), ID: livepeergo.String("PUSH123"), Spec: &components.TargetSpec{ @@ -320,6 +317,7 @@ func main() { }, }, }, + Name: livepeergo.String("test_stream"), }) if err != nil { log.Fatal(err) @@ -345,10 +343,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Delete @@ -399,10 +396,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Terminate @@ -457,10 +453,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## StartPull @@ -514,10 +509,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## CreateClip @@ -571,10 +565,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## GetClips @@ -621,10 +614,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## AddMultistreamTarget @@ -681,10 +673,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## RemoveMultistreamTarget @@ -732,6 +723,6 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/task/README.md b/docs/sdks/task/README.md index 2aa4483..37a0cc5 100644 --- a/docs/sdks/task/README.md +++ b/docs/sdks/task/README.md @@ -54,10 +54,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Get @@ -104,6 +103,6 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/transcode/README.md b/docs/sdks/transcode/README.md index cfd0e09..4bbeba3 100644 --- a/docs/sdks/transcode/README.md +++ b/docs/sdks/transcode/README.md @@ -218,6 +218,6 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/webhook/README.md b/docs/sdks/webhook/README.md index a6c5fff..0e6c8e9 100644 --- a/docs/sdks/webhook/README.md +++ b/docs/sdks/webhook/README.md @@ -60,10 +60,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Create @@ -122,10 +121,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Get @@ -172,10 +170,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Update @@ -234,10 +231,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## Delete @@ -284,10 +280,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## GetLogs @@ -334,10 +329,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## GetLog @@ -385,10 +379,9 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | - +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | ## ResendLog @@ -439,6 +432,6 @@ func main() { ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | ------------------ | ------------------ | ------------------ | -| sdkerrors.SDKError | 4xx-5xx | */* | +| sdkerrors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/generate.go b/generate.go index a907bf0..6f16a09 100644 --- a/generate.go +++ b/generate.go @@ -12,7 +12,6 @@ import ( "github.com/livepeer/livepeer-go/models/components" "github.com/livepeer/livepeer-go/models/operations" "github.com/livepeer/livepeer-go/models/sdkerrors" - "io" "net/http" "net/url" ) @@ -51,7 +50,7 @@ func (s *Generate) TextToImage(ctx context.Context, request components.TextToIma } baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/api/beta/generate/text-to-image") + opURL, err := url.JoinPath(baseURL, "/api/generate/text-to-image") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -176,21 +175,11 @@ func (s *Generate) TextToImage(ctx context.Context, request components.TextToIma }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -202,17 +191,16 @@ func (s *Generate) TextToImage(ctx context.Context, request components.TextToIma res.ImageResponse = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -224,17 +212,16 @@ func (s *Generate) TextToImage(ctx context.Context, request components.TextToIma return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -246,17 +233,16 @@ func (s *Generate) TextToImage(ctx context.Context, request components.TextToIma return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -268,17 +254,16 @@ func (s *Generate) TextToImage(ctx context.Context, request components.TextToIma return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -290,26 +275,24 @@ func (s *Generate) TextToImage(ctx context.Context, request components.TextToIma return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -321,11 +304,10 @@ func (s *Generate) TextToImage(ctx context.Context, request components.TextToIma res.StudioAPIError = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -357,7 +339,7 @@ func (s *Generate) ImageToImage(ctx context.Context, request components.BodyGenI } baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/api/beta/generate/image-to-image") + opURL, err := url.JoinPath(baseURL, "/api/generate/image-to-image") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -482,21 +464,11 @@ func (s *Generate) ImageToImage(ctx context.Context, request components.BodyGenI }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -508,17 +480,16 @@ func (s *Generate) ImageToImage(ctx context.Context, request components.BodyGenI res.ImageResponse = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -530,17 +501,16 @@ func (s *Generate) ImageToImage(ctx context.Context, request components.BodyGenI return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -552,17 +522,16 @@ func (s *Generate) ImageToImage(ctx context.Context, request components.BodyGenI return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -574,17 +543,16 @@ func (s *Generate) ImageToImage(ctx context.Context, request components.BodyGenI return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -596,26 +564,24 @@ func (s *Generate) ImageToImage(ctx context.Context, request components.BodyGenI return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -627,11 +593,10 @@ func (s *Generate) ImageToImage(ctx context.Context, request components.BodyGenI res.StudioAPIError = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -663,7 +628,7 @@ func (s *Generate) ImageToVideo(ctx context.Context, request components.BodyGenI } baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/api/beta/generate/image-to-video") + opURL, err := url.JoinPath(baseURL, "/api/generate/image-to-video") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -788,21 +753,11 @@ func (s *Generate) ImageToVideo(ctx context.Context, request components.BodyGenI }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -814,17 +769,16 @@ func (s *Generate) ImageToVideo(ctx context.Context, request components.BodyGenI res.VideoResponse = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -836,17 +790,16 @@ func (s *Generate) ImageToVideo(ctx context.Context, request components.BodyGenI return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -858,17 +811,16 @@ func (s *Generate) ImageToVideo(ctx context.Context, request components.BodyGenI return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -880,17 +832,16 @@ func (s *Generate) ImageToVideo(ctx context.Context, request components.BodyGenI return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -902,26 +853,24 @@ func (s *Generate) ImageToVideo(ctx context.Context, request components.BodyGenI return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -933,11 +882,10 @@ func (s *Generate) ImageToVideo(ctx context.Context, request components.BodyGenI res.StudioAPIError = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -969,7 +917,7 @@ func (s *Generate) Upscale(ctx context.Context, request components.BodyGenUpscal } baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/api/beta/generate/upscale") + opURL, err := url.JoinPath(baseURL, "/api/generate/upscale") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -1094,21 +1042,11 @@ func (s *Generate) Upscale(ctx context.Context, request components.BodyGenUpscal }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1120,17 +1058,16 @@ func (s *Generate) Upscale(ctx context.Context, request components.BodyGenUpscal res.ImageResponse = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1142,17 +1079,16 @@ func (s *Generate) Upscale(ctx context.Context, request components.BodyGenUpscal return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1164,17 +1100,16 @@ func (s *Generate) Upscale(ctx context.Context, request components.BodyGenUpscal return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1186,17 +1121,16 @@ func (s *Generate) Upscale(ctx context.Context, request components.BodyGenUpscal return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1208,26 +1142,24 @@ func (s *Generate) Upscale(ctx context.Context, request components.BodyGenUpscal return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1239,11 +1171,10 @@ func (s *Generate) Upscale(ctx context.Context, request components.BodyGenUpscal res.StudioAPIError = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1275,7 +1206,7 @@ func (s *Generate) AudioToText(ctx context.Context, request components.BodyGenAu } baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/api/beta/generate/audio-to-text") + opURL, err := url.JoinPath(baseURL, "/api/generate/audio-to-text") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -1378,7 +1309,7 @@ func (s *Generate) AudioToText(ctx context.Context, request components.BodyGenAu _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) return nil, err - } else if utils.MatchStatusCodes([]string{"400", "401", "413", "422", "4XX", "500", "5XX"}, httpRes.StatusCode) { + } else if utils.MatchStatusCodes([]string{"400", "401", "413", "415", "422", "4XX", "500", "5XX"}, httpRes.StatusCode) { _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) if err != nil { return nil, err @@ -1400,21 +1331,11 @@ func (s *Generate) AudioToText(ctx context.Context, request components.BodyGenAu }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1426,17 +1347,16 @@ func (s *Generate) AudioToText(ctx context.Context, request components.BodyGenAu res.TextResponse = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1448,17 +1368,16 @@ func (s *Generate) AudioToText(ctx context.Context, request components.BodyGenAu return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1470,17 +1389,16 @@ func (s *Generate) AudioToText(ctx context.Context, request components.BodyGenAu return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 413: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1492,17 +1410,37 @@ func (s *Generate) AudioToText(ctx context.Context, request components.BodyGenAu return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 415: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } + var out sdkerrors.GenAudioToTextGenerateResponse415ResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1514,17 +1452,16 @@ func (s *Generate) AudioToText(ctx context.Context, request components.BodyGenAu return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1536,26 +1473,24 @@ func (s *Generate) AudioToText(ctx context.Context, request components.BodyGenAu return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1567,11 +1502,10 @@ func (s *Generate) AudioToText(ctx context.Context, request components.BodyGenAu res.StudioAPIError = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1603,7 +1537,7 @@ func (s *Generate) SegmentAnything2(ctx context.Context, request components.Body } baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) - opURL, err := url.JoinPath(baseURL, "/api/beta/generate/segment-anything-2") + opURL, err := url.JoinPath(baseURL, "/api/generate/segment-anything-2") if err != nil { return nil, fmt.Errorf("error generating URL: %w", err) } @@ -1728,21 +1662,11 @@ func (s *Generate) SegmentAnything2(ctx context.Context, request components.Body }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1754,17 +1678,16 @@ func (s *Generate) SegmentAnything2(ctx context.Context, request components.Body res.MasksResponse = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 400: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1776,17 +1699,16 @@ func (s *Generate) SegmentAnything2(ctx context.Context, request components.Body return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 401: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1798,17 +1720,16 @@ func (s *Generate) SegmentAnything2(ctx context.Context, request components.Body return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 422: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1820,17 +1741,16 @@ func (s *Generate) SegmentAnything2(ctx context.Context, request components.Body return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 500: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1842,26 +1762,24 @@ func (s *Generate) SegmentAnything2(ctx context.Context, request components.Body return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1873,11 +1791,299 @@ func (s *Generate) SegmentAnything2(ctx context.Context, request components.Body res.StudioAPIError = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + } + + return res, nil + +} + +// Llm - LLM +// Generate text using a language model. +func (s *Generate) Llm(ctx context.Context, request components.BodyGenLLM, opts ...operations.Option) (*operations.GenLLMResponse, error) { + hookCtx := hooks.HookContext{ + Context: ctx, + OperationID: "genLLM", + OAuth2Scopes: []string{}, + SecuritySource: s.sdkConfiguration.Security, + } + + o := operations.Options{} + supportedOptions := []string{ + operations.SupportedOptionRetries, + operations.SupportedOptionTimeout, + } + + for _, opt := range opts { + if err := opt(&o, supportedOptions...); err != nil { + return nil, fmt.Errorf("error applying option: %w", err) + } + } + + baseURL := utils.ReplaceParameters(s.sdkConfiguration.GetServerDetails()) + opURL, err := url.JoinPath(baseURL, "/api/generate/llm") + if err != nil { + return nil, fmt.Errorf("error generating URL: %w", err) + } + + bodyReader, reqContentType, err := utils.SerializeRequestBody(ctx, request, false, false, "Request", "form", `request:"mediaType=application/x-www-form-urlencoded"`) + if err != nil { + return nil, err + } + + timeout := o.Timeout + if timeout == nil { + timeout = s.sdkConfiguration.Timeout + } + + if timeout != nil { + var cancel context.CancelFunc + ctx, cancel = context.WithTimeout(ctx, *timeout) + defer cancel() + } + + req, err := http.NewRequestWithContext(ctx, "POST", opURL, bodyReader) + if err != nil { + return nil, fmt.Errorf("error creating request: %w", err) + } + req.Header.Set("Accept", "application/json") + req.Header.Set("User-Agent", s.sdkConfiguration.UserAgent) + req.Header.Set("Content-Type", reqContentType) + + if err := utils.PopulateSecurity(ctx, req, s.sdkConfiguration.Security); err != nil { + return nil, err + } + + globalRetryConfig := s.sdkConfiguration.RetryConfig + retryConfig := o.Retries + if retryConfig == nil { + if globalRetryConfig != nil { + retryConfig = globalRetryConfig + } + } + + var httpRes *http.Response + if retryConfig != nil { + httpRes, err = utils.Retry(ctx, utils.Retries{ + Config: retryConfig, + StatusCodes: []string{ + "429", + "500", + "502", + "503", + "504", + }, + }, func() (*http.Response, error) { + if req.Body != nil { + copyBody, err := req.GetBody() + if err != nil { + return nil, err + } + req.Body = copyBody + } + + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, backoff.Permanent(err) + } + httpRes, err := s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + } + return httpRes, err + }) + + if err != nil { + return nil, err + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } else { + req, err = s.sdkConfiguration.Hooks.BeforeRequest(hooks.BeforeRequestContext{HookContext: hookCtx}, req) + if err != nil { + return nil, err + } + + httpRes, err = s.sdkConfiguration.Client.Do(req) + if err != nil || httpRes == nil { + if err != nil { + err = fmt.Errorf("error sending request: %w", err) + } else { + err = fmt.Errorf("error sending request: no response") + } + + _, err = s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, nil, err) + return nil, err + } else if utils.MatchStatusCodes([]string{"400", "401", "422", "4XX", "500", "5XX"}, httpRes.StatusCode) { + _httpRes, err := s.sdkConfiguration.Hooks.AfterError(hooks.AfterErrorContext{HookContext: hookCtx}, httpRes, nil) + if err != nil { + return nil, err + } else if _httpRes != nil { + httpRes = _httpRes + } + } else { + httpRes, err = s.sdkConfiguration.Hooks.AfterSuccess(hooks.AfterSuccessContext{HookContext: hookCtx}, httpRes) + if err != nil { + return nil, err + } + } + } + + res := &operations.GenLLMResponse{ + HTTPMeta: components.HTTPMetadata{ + Request: req, + Response: httpRes, + }, + } + + switch { + case httpRes.StatusCode == 200: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.LLMResponse + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.LLMResponse = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 400: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.GenLLMResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 401: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.GenLLMGenerateResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 422: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.GenLLMGenerateResponseResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode == 500: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out sdkerrors.GenLLMGenerateResponse500ResponseBody + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + return nil, &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) + } + case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: + fallthrough + case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) + default: + switch { + case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } + + var out components.StudioAPIError + if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { + return nil, err + } + + res.StudioAPIError = &out + default: + rawBody, err := utils.ConsumeRawBody(httpRes) + if err != nil { + return nil, err + } return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/internal/utils/utils.go b/internal/utils/utils.go index adb2f70..f1ff9e0 100644 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -3,10 +3,12 @@ package utils import ( + "bytes" "context" "fmt" "io" "math/big" + "net/http" "reflect" "regexp" "strconv" @@ -228,3 +230,15 @@ func contains(arr []string, str string) bool { } return false } + +func ConsumeRawBody(res *http.Response) ([]byte, error) { + rawBody, err := io.ReadAll(res.Body) + if err != nil { + return nil, fmt.Errorf("error reading response body: %w", err) + } + + res.Body.Close() + res.Body = io.NopCloser(bytes.NewBuffer(rawBody)) + + return rawBody, nil +} diff --git a/livepeer.go b/livepeer.go index 7043a47..d7188bd 100644 --- a/livepeer.go +++ b/livepeer.go @@ -173,9 +173,9 @@ func New(opts ...SDKOption) *Livepeer { sdkConfiguration: sdkConfiguration{ Language: "go", OpenAPIDocVersion: "1.0.0", - SDKVersion: "0.4.0", - GenVersion: "2.415.8", - UserAgent: "speakeasy-sdk/go 0.4.0 2.415.8 1.0.0 github.com/livepeer/livepeer-go", + SDKVersion: "0.5.0", + GenVersion: "2.460.1", + UserAgent: "speakeasy-sdk/go 0.5.0 2.460.1 1.0.0 github.com/livepeer/livepeer-go", Hooks: hooks.New(), }, } diff --git a/metrics.go b/metrics.go index da53da1..879851c 100644 --- a/metrics.go +++ b/metrics.go @@ -12,7 +12,6 @@ import ( "github.com/livepeer/livepeer-go/models/components" "github.com/livepeer/livepeer-go/models/operations" "github.com/livepeer/livepeer-go/models/sdkerrors" - "io" "net/http" "net/url" ) @@ -180,21 +179,11 @@ func (s *Metrics) GetRealtimeViewership(ctx context.Context, playbackID *string, }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -206,42 +195,39 @@ func (s *Metrics) GetRealtimeViewership(ctx context.Context, playbackID *string, res.Data = out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -396,21 +382,11 @@ func (s *Metrics) GetViewership(ctx context.Context, request operations.GetViewe }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -422,42 +398,39 @@ func (s *Metrics) GetViewership(ctx context.Context, request operations.GetViewe res.Data = out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -612,21 +585,11 @@ func (s *Metrics) GetCreatorViewership(ctx context.Context, request operations.G }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -638,42 +601,39 @@ func (s *Metrics) GetCreatorViewership(ctx context.Context, request operations.G res.Data = out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -830,21 +790,11 @@ func (s *Metrics) GetPublicViewership(ctx context.Context, playbackID string, op }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -856,42 +806,39 @@ func (s *Metrics) GetPublicViewership(ctx context.Context, playbackID string, op res.Data = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1045,21 +992,11 @@ func (s *Metrics) GetUsage(ctx context.Context, request operations.GetUsageMetri }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1071,42 +1008,39 @@ func (s *Metrics) GetUsage(ctx context.Context, request operations.GetUsageMetri res.UsageMetric = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/models/components/bodygenaudiototext.go b/models/components/bodygenaudiototext.go index 670a740..be89d5c 100644 --- a/models/components/bodygenaudiototext.go +++ b/models/components/bodygenaudiototext.go @@ -31,6 +31,8 @@ type BodyGenAudioToText struct { Audio Audio `multipartForm:"file"` // Hugging Face model ID used for transcription. ModelID *string `default:"openai/whisper-large-v3" multipartForm:"name=model_id"` + // Return timestamps for the transcribed text. Supported values: 'sentence', 'word', or a string boolean ('true' or 'false'). Default is 'true' ('sentence'). 'false' means no timestamps. 'word' means word-based timestamps. + ReturnTimestamps *string `default:"true" multipartForm:"name=return_timestamps"` } func (b BodyGenAudioToText) MarshalJSON() ([]byte, error) { @@ -57,3 +59,10 @@ func (o *BodyGenAudioToText) GetModelID() *string { } return o.ModelID } + +func (o *BodyGenAudioToText) GetReturnTimestamps() *string { + if o == nil { + return nil + } + return o.ReturnTimestamps +} diff --git a/models/components/bodygenimagetoimage.go b/models/components/bodygenimagetoimage.go index 743cffe..6da3162 100644 --- a/models/components/bodygenimagetoimage.go +++ b/models/components/bodygenimagetoimage.go @@ -33,6 +33,8 @@ type BodyGenImageToImage struct { Image Image `multipartForm:"file"` // Hugging Face model ID used for image generation. ModelID *string `default:"timbrooks/instruct-pix2pix" multipartForm:"name=model_id"` + // A LoRA (Low-Rank Adaptation) model and its corresponding weight for image generation. Example: { "latent-consistency/lcm-lora-sdxl": 1.0, "nerijs/pixel-art-xl": 1.2}. + Loras *string `default:"" multipartForm:"name=loras"` // Degree of transformation applied to the reference image (0 to 1). Strength *float64 `default:"0.8" multipartForm:"name=strength"` // Encourages model to generate images closely linked to the text prompt (higher values may reduce image quality). @@ -83,6 +85,13 @@ func (o *BodyGenImageToImage) GetModelID() *string { return o.ModelID } +func (o *BodyGenImageToImage) GetLoras() *string { + if o == nil { + return nil + } + return o.Loras +} + func (o *BodyGenImageToImage) GetStrength() *float64 { if o == nil { return nil diff --git a/models/components/bodygenllm.go b/models/components/bodygenllm.go new file mode 100644 index 0000000..d6728da --- /dev/null +++ b/models/components/bodygenllm.go @@ -0,0 +1,77 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +import ( + "github.com/livepeer/livepeer-go/internal/utils" +) + +type BodyGenLLM struct { + Prompt string `form:"name=prompt"` + ModelID *string `default:"meta-llama/Meta-Llama-3.1-8B-Instruct" form:"name=model_id"` + SystemMsg *string `default:"" form:"name=system_msg"` + Temperature *float64 `default:"0.7" form:"name=temperature"` + MaxTokens *int64 `default:"256" form:"name=max_tokens"` + History *string `default:"[]" form:"name=history"` + Stream *bool `default:"false" form:"name=stream"` +} + +func (b BodyGenLLM) MarshalJSON() ([]byte, error) { + return utils.MarshalJSON(b, "", false) +} + +func (b *BodyGenLLM) UnmarshalJSON(data []byte) error { + if err := utils.UnmarshalJSON(data, &b, "", false, false); err != nil { + return err + } + return nil +} + +func (o *BodyGenLLM) GetPrompt() string { + if o == nil { + return "" + } + return o.Prompt +} + +func (o *BodyGenLLM) GetModelID() *string { + if o == nil { + return nil + } + return o.ModelID +} + +func (o *BodyGenLLM) GetSystemMsg() *string { + if o == nil { + return nil + } + return o.SystemMsg +} + +func (o *BodyGenLLM) GetTemperature() *float64 { + if o == nil { + return nil + } + return o.Temperature +} + +func (o *BodyGenLLM) GetMaxTokens() *int64 { + if o == nil { + return nil + } + return o.MaxTokens +} + +func (o *BodyGenLLM) GetHistory() *string { + if o == nil { + return nil + } + return o.History +} + +func (o *BodyGenLLM) GetStream() *bool { + if o == nil { + return nil + } + return o.Stream +} diff --git a/models/components/bodygensegmentanything2.go b/models/components/bodygensegmentanything2.go index 02d9334..4084139 100644 --- a/models/components/bodygensegmentanything2.go +++ b/models/components/bodygensegmentanything2.go @@ -30,7 +30,7 @@ type BodyGenSegmentAnything2 struct { // Image to segment. Image BodyGenSegmentAnything2Image `multipartForm:"file"` // Hugging Face model ID used for image generation. - ModelID *string `default:"facebook/sam2-hiera-large:" multipartForm:"name=model_id"` + ModelID *string `default:"facebook/sam2-hiera-large" multipartForm:"name=model_id"` // Nx2 array of point prompts to the model, where each point is in (X,Y) in pixels. PointCoords *string `multipartForm:"name=point_coords"` // Labels for the point prompts, where 1 indicates a foreground point and 0 indicates a background point. diff --git a/models/components/error.go b/models/components/error.go new file mode 100644 index 0000000..e88a632 --- /dev/null +++ b/models/components/error.go @@ -0,0 +1,14 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type Error struct { + Errors []string `json:"errors,omitempty"` +} + +func (o *Error) GetErrors() []string { + if o == nil { + return nil + } + return o.Errors +} diff --git a/models/components/llmresponse.go b/models/components/llmresponse.go new file mode 100644 index 0000000..7b5b217 --- /dev/null +++ b/models/components/llmresponse.go @@ -0,0 +1,22 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package components + +type LLMResponse struct { + Response string `json:"response"` + TokensUsed int64 `json:"tokens_used"` +} + +func (o *LLMResponse) GetResponse() string { + if o == nil { + return "" + } + return o.Response +} + +func (o *LLMResponse) GetTokensUsed() int64 { + if o == nil { + return 0 + } + return o.TokensUsed +} diff --git a/models/components/streampatchpayload.go b/models/components/streampatchpayload.go index 2672434..4863a25 100644 --- a/models/components/streampatchpayload.go +++ b/models/components/streampatchpayload.go @@ -17,6 +17,7 @@ type StreamPatchPayload struct { RecordingSpec *RecordingSpec `json:"recordingSpec,omitempty"` // User input tags associated with the stream UserTags map[string]UserTags `json:"userTags,omitempty"` + Name *string `json:"name,omitempty"` } func (o *StreamPatchPayload) GetCreatorID() *InputCreatorID { @@ -74,3 +75,10 @@ func (o *StreamPatchPayload) GetUserTags() map[string]UserTags { } return o.UserTags } + +func (o *StreamPatchPayload) GetName() *string { + if o == nil { + return nil + } + return o.Name +} diff --git a/models/components/texttoimageparams.go b/models/components/texttoimageparams.go index 6078067..bd1fed9 100644 --- a/models/components/texttoimageparams.go +++ b/models/components/texttoimageparams.go @@ -9,6 +9,8 @@ import ( type TextToImageParams struct { // Hugging Face model ID used for image generation. ModelID *string `default:"SG161222/RealVisXL_V4.0_Lightning" json:"model_id"` + // A LoRA (Low-Rank Adaptation) model and its corresponding weight for image generation. Example: { "latent-consistency/lcm-lora-sdxl": 1.0, "nerijs/pixel-art-xl": 1.2}. + Loras *string `default:"" json:"loras"` // Text prompt(s) to guide image generation. Separate multiple prompts with '|' if supported by the model. Prompt string `json:"prompt"` // The height in pixels of the generated image. @@ -47,6 +49,13 @@ func (o *TextToImageParams) GetModelID() *string { return o.ModelID } +func (o *TextToImageParams) GetLoras() *string { + if o == nil { + return nil + } + return o.Loras +} + func (o *TextToImageParams) GetPrompt() string { if o == nil { return "" diff --git a/models/operations/addmultistreamtarget.go b/models/operations/addmultistreamtarget.go index 71c29b0..d75193b 100644 --- a/models/operations/addmultistreamtarget.go +++ b/models/operations/addmultistreamtarget.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type AddMultistreamTargetRequest struct { @@ -30,7 +29,7 @@ func (o *AddMultistreamTargetRequest) GetTargetAddPayload() components.TargetAdd type AddMultistreamTargetResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *AddMultistreamTargetResponse) GetHTTPMeta() components.HTTPMetadata { @@ -40,7 +39,7 @@ func (o *AddMultistreamTargetResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *AddMultistreamTargetResponse) GetError() *sdkerrors.Error { +func (o *AddMultistreamTargetResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/createclip.go b/models/operations/createclip.go index 8a7479f..2f942d3 100644 --- a/models/operations/createclip.go +++ b/models/operations/createclip.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type CreateClipTask struct { @@ -43,7 +42,7 @@ type CreateClipResponse struct { // Success Data *CreateClipData // Error - Error *sdkerrors.Error + Error *components.Error } func (o *CreateClipResponse) GetHTTPMeta() components.HTTPMetadata { @@ -60,7 +59,7 @@ func (o *CreateClipResponse) GetData() *CreateClipData { return o.Data } -func (o *CreateClipResponse) GetError() *sdkerrors.Error { +func (o *CreateClipResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/createmultistreamtarget.go b/models/operations/createmultistreamtarget.go index a433244..0eaad58 100644 --- a/models/operations/createmultistreamtarget.go +++ b/models/operations/createmultistreamtarget.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type CreateMultistreamTargetResponse struct { @@ -12,7 +11,7 @@ type CreateMultistreamTargetResponse struct { // Success MultistreamTarget *components.MultistreamTarget // Error - Error *sdkerrors.Error + Error *components.Error } func (o *CreateMultistreamTargetResponse) GetHTTPMeta() components.HTTPMetadata { @@ -29,7 +28,7 @@ func (o *CreateMultistreamTargetResponse) GetMultistreamTarget() *components.Mul return o.MultistreamTarget } -func (o *CreateMultistreamTargetResponse) GetError() *sdkerrors.Error { +func (o *CreateMultistreamTargetResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/createroom.go b/models/operations/createroom.go index 54febcc..4cbca0d 100644 --- a/models/operations/createroom.go +++ b/models/operations/createroom.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type CreateRoomResponse struct { @@ -12,7 +11,7 @@ type CreateRoomResponse struct { // Success CreateRoomResponse *components.CreateRoomResponse // Error - Error *sdkerrors.Error + Error *components.Error } func (o *CreateRoomResponse) GetHTTPMeta() components.HTTPMetadata { @@ -29,7 +28,7 @@ func (o *CreateRoomResponse) GetCreateRoomResponse() *components.CreateRoomRespo return o.CreateRoomResponse } -func (o *CreateRoomResponse) GetError() *sdkerrors.Error { +func (o *CreateRoomResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/createroomuser.go b/models/operations/createroomuser.go index 97b9e06..da16d6c 100644 --- a/models/operations/createroomuser.go +++ b/models/operations/createroomuser.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type CreateRoomUserRequest struct { @@ -31,7 +30,7 @@ type CreateRoomUserResponse struct { // Success RoomUserResponse *components.RoomUserResponse // Error - Error *sdkerrors.Error + Error *components.Error } func (o *CreateRoomUserResponse) GetHTTPMeta() components.HTTPMetadata { @@ -48,7 +47,7 @@ func (o *CreateRoomUserResponse) GetRoomUserResponse() *components.RoomUserRespo return o.RoomUserResponse } -func (o *CreateRoomUserResponse) GetError() *sdkerrors.Error { +func (o *CreateRoomUserResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/createsigningkey.go b/models/operations/createsigningkey.go index c4034de..db7f6e7 100644 --- a/models/operations/createsigningkey.go +++ b/models/operations/createsigningkey.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type CreateSigningKeyResponse struct { @@ -12,7 +11,7 @@ type CreateSigningKeyResponse struct { // Success SigningKey *components.SigningKey // Error - Error *sdkerrors.Error + Error *components.Error } func (o *CreateSigningKeyResponse) GetHTTPMeta() components.HTTPMetadata { @@ -29,7 +28,7 @@ func (o *CreateSigningKeyResponse) GetSigningKey() *components.SigningKey { return o.SigningKey } -func (o *CreateSigningKeyResponse) GetError() *sdkerrors.Error { +func (o *CreateSigningKeyResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/createstream.go b/models/operations/createstream.go index 990f1ce..6c168cf 100644 --- a/models/operations/createstream.go +++ b/models/operations/createstream.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type CreateStreamResponse struct { @@ -12,7 +11,7 @@ type CreateStreamResponse struct { // Success Stream *components.Stream // Error - Error *sdkerrors.Error + Error *components.Error } func (o *CreateStreamResponse) GetHTTPMeta() components.HTTPMetadata { @@ -29,7 +28,7 @@ func (o *CreateStreamResponse) GetStream() *components.Stream { return o.Stream } -func (o *CreateStreamResponse) GetError() *sdkerrors.Error { +func (o *CreateStreamResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/createwebhook.go b/models/operations/createwebhook.go index fc30762..d4d74f1 100644 --- a/models/operations/createwebhook.go +++ b/models/operations/createwebhook.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type CreateWebhookResponse struct { @@ -12,7 +11,7 @@ type CreateWebhookResponse struct { // Success Webhook *components.Webhook // Error - Error *sdkerrors.Error + Error *components.Error } func (o *CreateWebhookResponse) GetHTTPMeta() components.HTTPMetadata { @@ -29,7 +28,7 @@ func (o *CreateWebhookResponse) GetWebhook() *components.Webhook { return o.Webhook } -func (o *CreateWebhookResponse) GetError() *sdkerrors.Error { +func (o *CreateWebhookResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/deleteasset.go b/models/operations/deleteasset.go index 321d124..33998ab 100644 --- a/models/operations/deleteasset.go +++ b/models/operations/deleteasset.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type DeleteAssetRequest struct { @@ -22,7 +21,7 @@ func (o *DeleteAssetRequest) GetAssetID() string { type DeleteAssetResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *DeleteAssetResponse) GetHTTPMeta() components.HTTPMetadata { @@ -32,7 +31,7 @@ func (o *DeleteAssetResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *DeleteAssetResponse) GetError() *sdkerrors.Error { +func (o *DeleteAssetResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/deletemultistreamtarget.go b/models/operations/deletemultistreamtarget.go index a6835d4..48b2521 100644 --- a/models/operations/deletemultistreamtarget.go +++ b/models/operations/deletemultistreamtarget.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type DeleteMultistreamTargetRequest struct { @@ -22,7 +21,7 @@ func (o *DeleteMultistreamTargetRequest) GetID() string { type DeleteMultistreamTargetResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *DeleteMultistreamTargetResponse) GetHTTPMeta() components.HTTPMetadata { @@ -32,7 +31,7 @@ func (o *DeleteMultistreamTargetResponse) GetHTTPMeta() components.HTTPMetadata return o.HTTPMeta } -func (o *DeleteMultistreamTargetResponse) GetError() *sdkerrors.Error { +func (o *DeleteMultistreamTargetResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/deleteroom.go b/models/operations/deleteroom.go index a6699b5..3943bf9 100644 --- a/models/operations/deleteroom.go +++ b/models/operations/deleteroom.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type DeleteRoomRequest struct { @@ -21,7 +20,7 @@ func (o *DeleteRoomRequest) GetID() string { type DeleteRoomResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *DeleteRoomResponse) GetHTTPMeta() components.HTTPMetadata { @@ -31,7 +30,7 @@ func (o *DeleteRoomResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *DeleteRoomResponse) GetError() *sdkerrors.Error { +func (o *DeleteRoomResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/deleteroomuser.go b/models/operations/deleteroomuser.go index 83bc512..5adaa52 100644 --- a/models/operations/deleteroomuser.go +++ b/models/operations/deleteroomuser.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type DeleteRoomUserRequest struct { @@ -29,7 +28,7 @@ func (o *DeleteRoomUserRequest) GetUserID() string { type DeleteRoomUserResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *DeleteRoomUserResponse) GetHTTPMeta() components.HTTPMetadata { @@ -39,7 +38,7 @@ func (o *DeleteRoomUserResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *DeleteRoomUserResponse) GetError() *sdkerrors.Error { +func (o *DeleteRoomUserResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/deletesigningkey.go b/models/operations/deletesigningkey.go index 3544f4f..25167f8 100644 --- a/models/operations/deletesigningkey.go +++ b/models/operations/deletesigningkey.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type DeleteSigningKeyRequest struct { @@ -22,7 +21,7 @@ func (o *DeleteSigningKeyRequest) GetKeyID() string { type DeleteSigningKeyResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *DeleteSigningKeyResponse) GetHTTPMeta() components.HTTPMetadata { @@ -32,7 +31,7 @@ func (o *DeleteSigningKeyResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *DeleteSigningKeyResponse) GetError() *sdkerrors.Error { +func (o *DeleteSigningKeyResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/deletestream.go b/models/operations/deletestream.go index 2c1b86d..eee3cc6 100644 --- a/models/operations/deletestream.go +++ b/models/operations/deletestream.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type DeleteStreamRequest struct { @@ -22,7 +21,7 @@ func (o *DeleteStreamRequest) GetID() string { type DeleteStreamResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *DeleteStreamResponse) GetHTTPMeta() components.HTTPMetadata { @@ -32,7 +31,7 @@ func (o *DeleteStreamResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *DeleteStreamResponse) GetError() *sdkerrors.Error { +func (o *DeleteStreamResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/deletewebhook.go b/models/operations/deletewebhook.go index 382e418..18438b3 100644 --- a/models/operations/deletewebhook.go +++ b/models/operations/deletewebhook.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type DeleteWebhookRequest struct { @@ -23,7 +22,7 @@ type DeleteWebhookResponse struct { // Success Webhook *components.Webhook // Error - Error *sdkerrors.Error + Error *components.Error } func (o *DeleteWebhookResponse) GetHTTPMeta() components.HTTPMetadata { @@ -40,7 +39,7 @@ func (o *DeleteWebhookResponse) GetWebhook() *components.Webhook { return o.Webhook } -func (o *DeleteWebhookResponse) GetError() *sdkerrors.Error { +func (o *DeleteWebhookResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/genllm.go b/models/operations/genllm.go new file mode 100644 index 0000000..26bf99e --- /dev/null +++ b/models/operations/genllm.go @@ -0,0 +1,36 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package operations + +import ( + "github.com/livepeer/livepeer-go/models/components" +) + +type GenLLMResponse struct { + HTTPMeta components.HTTPMetadata `json:"-"` + // Successful Response + LLMResponse *components.LLMResponse + // Error + StudioAPIError *components.StudioAPIError +} + +func (o *GenLLMResponse) GetHTTPMeta() components.HTTPMetadata { + if o == nil { + return components.HTTPMetadata{} + } + return o.HTTPMeta +} + +func (o *GenLLMResponse) GetLLMResponse() *components.LLMResponse { + if o == nil { + return nil + } + return o.LLMResponse +} + +func (o *GenLLMResponse) GetStudioAPIError() *components.StudioAPIError { + if o == nil { + return nil + } + return o.StudioAPIError +} diff --git a/models/operations/getasset.go b/models/operations/getasset.go index 4c7578d..30b89b1 100644 --- a/models/operations/getasset.go +++ b/models/operations/getasset.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetAssetRequest struct { @@ -24,7 +23,7 @@ type GetAssetResponse struct { // Success Asset *components.Asset // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetAssetResponse) GetHTTPMeta() components.HTTPMetadata { @@ -41,7 +40,7 @@ func (o *GetAssetResponse) GetAsset() *components.Asset { return o.Asset } -func (o *GetAssetResponse) GetError() *sdkerrors.Error { +func (o *GetAssetResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getassets.go b/models/operations/getassets.go index b61a9f3..9af0c81 100644 --- a/models/operations/getassets.go +++ b/models/operations/getassets.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetAssetsResponse struct { @@ -12,7 +11,7 @@ type GetAssetsResponse struct { // Success Data []components.Asset // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetAssetsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -29,7 +28,7 @@ func (o *GetAssetsResponse) GetData() []components.Asset { return o.Data } -func (o *GetAssetsResponse) GetError() *sdkerrors.Error { +func (o *GetAssetsResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getclips.go b/models/operations/getclips.go index 91e2f38..63857b6 100644 --- a/models/operations/getclips.go +++ b/models/operations/getclips.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetClipsRequest struct { @@ -24,7 +23,7 @@ type GetClipsResponse struct { // Success Data []components.Asset // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetClipsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -41,7 +40,7 @@ func (o *GetClipsResponse) GetData() []components.Asset { return o.Data } -func (o *GetClipsResponse) GetError() *sdkerrors.Error { +func (o *GetClipsResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getcreatorviewershipmetrics.go b/models/operations/getcreatorviewershipmetrics.go index 23acd8f..af2fff0 100644 --- a/models/operations/getcreatorviewershipmetrics.go +++ b/models/operations/getcreatorviewershipmetrics.go @@ -8,7 +8,6 @@ import ( "fmt" "github.com/livepeer/livepeer-go/internal/utils" "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" "time" ) @@ -302,7 +301,7 @@ type GetCreatorViewershipMetricsResponse struct { // A list of Metric objects Data []components.ViewershipMetric // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetCreatorViewershipMetricsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -319,7 +318,7 @@ func (o *GetCreatorViewershipMetricsResponse) GetData() []components.ViewershipM return o.Data } -func (o *GetCreatorViewershipMetricsResponse) GetError() *sdkerrors.Error { +func (o *GetCreatorViewershipMetricsResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getmultistreamtarget.go b/models/operations/getmultistreamtarget.go index 74a6885..c96fa1d 100644 --- a/models/operations/getmultistreamtarget.go +++ b/models/operations/getmultistreamtarget.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetMultistreamTargetRequest struct { @@ -24,7 +23,7 @@ type GetMultistreamTargetResponse struct { // Success MultistreamTarget *components.MultistreamTarget // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetMultistreamTargetResponse) GetHTTPMeta() components.HTTPMetadata { @@ -41,7 +40,7 @@ func (o *GetMultistreamTargetResponse) GetMultistreamTarget() *components.Multis return o.MultistreamTarget } -func (o *GetMultistreamTargetResponse) GetError() *sdkerrors.Error { +func (o *GetMultistreamTargetResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getmultistreamtargets.go b/models/operations/getmultistreamtargets.go index 08cf24d..867d6e9 100644 --- a/models/operations/getmultistreamtargets.go +++ b/models/operations/getmultistreamtargets.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetMultistreamTargetsResponse struct { @@ -12,7 +11,7 @@ type GetMultistreamTargetsResponse struct { // Success Data []components.MultistreamTarget // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetMultistreamTargetsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -29,7 +28,7 @@ func (o *GetMultistreamTargetsResponse) GetData() []components.MultistreamTarget return o.Data } -func (o *GetMultistreamTargetsResponse) GetError() *sdkerrors.Error { +func (o *GetMultistreamTargetsResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getplaybackinfo.go b/models/operations/getplaybackinfo.go index cf96aec..473a456 100644 --- a/models/operations/getplaybackinfo.go +++ b/models/operations/getplaybackinfo.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetPlaybackInfoRequest struct { @@ -24,7 +23,7 @@ type GetPlaybackInfoResponse struct { // Successful response PlaybackInfo *components.PlaybackInfo // Playback not found - Error *sdkerrors.Error + Error *components.Error } func (o *GetPlaybackInfoResponse) GetHTTPMeta() components.HTTPMetadata { @@ -41,7 +40,7 @@ func (o *GetPlaybackInfoResponse) GetPlaybackInfo() *components.PlaybackInfo { return o.PlaybackInfo } -func (o *GetPlaybackInfoResponse) GetError() *sdkerrors.Error { +func (o *GetPlaybackInfoResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getpublicviewershipmetrics.go b/models/operations/getpublicviewershipmetrics.go index 44337ef..e5d4d90 100644 --- a/models/operations/getpublicviewershipmetrics.go +++ b/models/operations/getpublicviewershipmetrics.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetPublicViewershipMetricsRequest struct { @@ -68,7 +67,7 @@ type GetPublicViewershipMetricsResponse struct { // A single Metric object with the viewCount and playtimeMins metrics. Data *GetPublicViewershipMetricsData // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetPublicViewershipMetricsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -85,7 +84,7 @@ func (o *GetPublicViewershipMetricsResponse) GetData() *GetPublicViewershipMetri return o.Data } -func (o *GetPublicViewershipMetricsResponse) GetError() *sdkerrors.Error { +func (o *GetPublicViewershipMetricsResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getrealtimeviewershipnow.go b/models/operations/getrealtimeviewershipnow.go index 853e212..5b1358c 100644 --- a/models/operations/getrealtimeviewershipnow.go +++ b/models/operations/getrealtimeviewershipnow.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type BreakdownBy string @@ -81,7 +80,7 @@ type GetRealtimeViewershipNowResponse struct { // A list of Metric objects Data []components.RealtimeViewershipMetric // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetRealtimeViewershipNowResponse) GetHTTPMeta() components.HTTPMetadata { @@ -98,7 +97,7 @@ func (o *GetRealtimeViewershipNowResponse) GetData() []components.RealtimeViewer return o.Data } -func (o *GetRealtimeViewershipNowResponse) GetError() *sdkerrors.Error { +func (o *GetRealtimeViewershipNowResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getrecordedsessions.go b/models/operations/getrecordedsessions.go index 39c76d5..25bcb31 100644 --- a/models/operations/getrecordedsessions.go +++ b/models/operations/getrecordedsessions.go @@ -7,7 +7,6 @@ import ( "fmt" "github.com/livepeer/livepeer-go/internal/utils" "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type RecordType string @@ -103,7 +102,7 @@ type GetRecordedSessionsResponse struct { // Success Data []components.Session // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetRecordedSessionsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -120,7 +119,7 @@ func (o *GetRecordedSessionsResponse) GetData() []components.Session { return o.Data } -func (o *GetRecordedSessionsResponse) GetError() *sdkerrors.Error { +func (o *GetRecordedSessionsResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getroom.go b/models/operations/getroom.go index c61479f..0690974 100644 --- a/models/operations/getroom.go +++ b/models/operations/getroom.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetRoomRequest struct { @@ -23,7 +22,7 @@ type GetRoomResponse struct { // Success Room *components.Room // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetRoomResponse) GetHTTPMeta() components.HTTPMetadata { @@ -40,7 +39,7 @@ func (o *GetRoomResponse) GetRoom() *components.Room { return o.Room } -func (o *GetRoomResponse) GetError() *sdkerrors.Error { +func (o *GetRoomResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getroomuser.go b/models/operations/getroomuser.go index db354a1..1bd88d1 100644 --- a/models/operations/getroomuser.go +++ b/models/operations/getroomuser.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetRoomUserRequest struct { @@ -31,7 +30,7 @@ type GetRoomUserResponse struct { // Success GetRoomUserResponse *components.GetRoomUserResponse // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetRoomUserResponse) GetHTTPMeta() components.HTTPMetadata { @@ -48,7 +47,7 @@ func (o *GetRoomUserResponse) GetGetRoomUserResponse() *components.GetRoomUserRe return o.GetRoomUserResponse } -func (o *GetRoomUserResponse) GetError() *sdkerrors.Error { +func (o *GetRoomUserResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getsession.go b/models/operations/getsession.go index 8b9018f..110f5c5 100644 --- a/models/operations/getsession.go +++ b/models/operations/getsession.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetSessionRequest struct { @@ -24,7 +23,7 @@ type GetSessionResponse struct { // Success Session *components.Session // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetSessionResponse) GetHTTPMeta() components.HTTPMetadata { @@ -41,7 +40,7 @@ func (o *GetSessionResponse) GetSession() *components.Session { return o.Session } -func (o *GetSessionResponse) GetError() *sdkerrors.Error { +func (o *GetSessionResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getsessionclips.go b/models/operations/getsessionclips.go index 1be690f..591e723 100644 --- a/models/operations/getsessionclips.go +++ b/models/operations/getsessionclips.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetSessionClipsRequest struct { @@ -24,7 +23,7 @@ type GetSessionClipsResponse struct { // Success Data []components.Asset // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetSessionClipsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -41,7 +40,7 @@ func (o *GetSessionClipsResponse) GetData() []components.Asset { return o.Data } -func (o *GetSessionClipsResponse) GetError() *sdkerrors.Error { +func (o *GetSessionClipsResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getsessions.go b/models/operations/getsessions.go index 619fecf..5e7de35 100644 --- a/models/operations/getsessions.go +++ b/models/operations/getsessions.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetSessionsResponse struct { @@ -12,7 +11,7 @@ type GetSessionsResponse struct { // Success Data []components.Session // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetSessionsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -29,7 +28,7 @@ func (o *GetSessionsResponse) GetData() []components.Session { return o.Data } -func (o *GetSessionsResponse) GetError() *sdkerrors.Error { +func (o *GetSessionsResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getsigningkey.go b/models/operations/getsigningkey.go index cce5842..7896b52 100644 --- a/models/operations/getsigningkey.go +++ b/models/operations/getsigningkey.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetSigningKeyRequest struct { @@ -24,7 +23,7 @@ type GetSigningKeyResponse struct { // Success SigningKey *components.SigningKey // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetSigningKeyResponse) GetHTTPMeta() components.HTTPMetadata { @@ -41,7 +40,7 @@ func (o *GetSigningKeyResponse) GetSigningKey() *components.SigningKey { return o.SigningKey } -func (o *GetSigningKeyResponse) GetError() *sdkerrors.Error { +func (o *GetSigningKeyResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getsigningkeys.go b/models/operations/getsigningkeys.go index f3b57b5..14f4b09 100644 --- a/models/operations/getsigningkeys.go +++ b/models/operations/getsigningkeys.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetSigningKeysResponse struct { @@ -12,7 +11,7 @@ type GetSigningKeysResponse struct { // Success Data []components.SigningKey // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetSigningKeysResponse) GetHTTPMeta() components.HTTPMetadata { @@ -29,7 +28,7 @@ func (o *GetSigningKeysResponse) GetData() []components.SigningKey { return o.Data } -func (o *GetSigningKeysResponse) GetError() *sdkerrors.Error { +func (o *GetSigningKeysResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getstream.go b/models/operations/getstream.go index ffc558d..b0162e0 100644 --- a/models/operations/getstream.go +++ b/models/operations/getstream.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetStreamRequest struct { @@ -24,7 +23,7 @@ type GetStreamResponse struct { // Success Stream *components.Stream // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetStreamResponse) GetHTTPMeta() components.HTTPMetadata { @@ -41,7 +40,7 @@ func (o *GetStreamResponse) GetStream() *components.Stream { return o.Stream } -func (o *GetStreamResponse) GetError() *sdkerrors.Error { +func (o *GetStreamResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getstreams.go b/models/operations/getstreams.go index 9dcd483..20e496d 100644 --- a/models/operations/getstreams.go +++ b/models/operations/getstreams.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetStreamsRequest struct { @@ -23,7 +22,7 @@ type GetStreamsResponse struct { // Success Data []components.Stream // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetStreamsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -40,7 +39,7 @@ func (o *GetStreamsResponse) GetData() []components.Stream { return o.Data } -func (o *GetStreamsResponse) GetError() *sdkerrors.Error { +func (o *GetStreamsResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/gettasks.go b/models/operations/gettasks.go index bb8f347..ea5e576 100644 --- a/models/operations/gettasks.go +++ b/models/operations/gettasks.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetTasksResponse struct { @@ -12,7 +11,7 @@ type GetTasksResponse struct { // Success Data []components.Task // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetTasksResponse) GetHTTPMeta() components.HTTPMetadata { @@ -29,7 +28,7 @@ func (o *GetTasksResponse) GetData() []components.Task { return o.Data } -func (o *GetTasksResponse) GetError() *sdkerrors.Error { +func (o *GetTasksResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getusagemetrics.go b/models/operations/getusagemetrics.go index a66ca0c..e3721ec 100644 --- a/models/operations/getusagemetrics.go +++ b/models/operations/getusagemetrics.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) // GetUsageMetricsQueryParamTimeStep - The time step to aggregate viewership metrics by @@ -118,7 +117,7 @@ type GetUsageMetricsResponse struct { // A Usage Metric object UsageMetric *components.UsageMetric // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetUsageMetricsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -135,7 +134,7 @@ func (o *GetUsageMetricsResponse) GetUsageMetric() *components.UsageMetric { return o.UsageMetric } -func (o *GetUsageMetricsResponse) GetError() *sdkerrors.Error { +func (o *GetUsageMetricsResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getviewershipmetrics.go b/models/operations/getviewershipmetrics.go index 469e11d..3233274 100644 --- a/models/operations/getviewershipmetrics.go +++ b/models/operations/getviewershipmetrics.go @@ -8,7 +8,6 @@ import ( "fmt" "github.com/livepeer/livepeer-go/internal/utils" "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" "time" ) @@ -323,7 +322,7 @@ type GetViewershipMetricsResponse struct { // A list of Metric objects Data []components.ViewershipMetric // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetViewershipMetricsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -340,7 +339,7 @@ func (o *GetViewershipMetricsResponse) GetData() []components.ViewershipMetric { return o.Data } -func (o *GetViewershipMetricsResponse) GetError() *sdkerrors.Error { +func (o *GetViewershipMetricsResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getwebhook.go b/models/operations/getwebhook.go index 716f6ae..4b42163 100644 --- a/models/operations/getwebhook.go +++ b/models/operations/getwebhook.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetWebhookRequest struct { @@ -23,7 +22,7 @@ type GetWebhookResponse struct { // Success Webhook *components.Webhook // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetWebhookResponse) GetHTTPMeta() components.HTTPMetadata { @@ -40,7 +39,7 @@ func (o *GetWebhookResponse) GetWebhook() *components.Webhook { return o.Webhook } -func (o *GetWebhookResponse) GetError() *sdkerrors.Error { +func (o *GetWebhookResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getwebhooklog.go b/models/operations/getwebhooklog.go index fd547f2..04f33a9 100644 --- a/models/operations/getwebhooklog.go +++ b/models/operations/getwebhooklog.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetWebhookLogRequest struct { @@ -31,7 +30,7 @@ type GetWebhookLogResponse struct { // Success WebhookLog *components.WebhookLog // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetWebhookLogResponse) GetHTTPMeta() components.HTTPMetadata { @@ -48,7 +47,7 @@ func (o *GetWebhookLogResponse) GetWebhookLog() *components.WebhookLog { return o.WebhookLog } -func (o *GetWebhookLogResponse) GetError() *sdkerrors.Error { +func (o *GetWebhookLogResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getwebhooklogs.go b/models/operations/getwebhooklogs.go index d5a2d10..64ffd91 100644 --- a/models/operations/getwebhooklogs.go +++ b/models/operations/getwebhooklogs.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetWebhookLogsRequest struct { @@ -23,7 +22,7 @@ type GetWebhookLogsResponse struct { // Success Data []components.WebhookLog // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetWebhookLogsResponse) GetHTTPMeta() components.HTTPMetadata { @@ -40,7 +39,7 @@ func (o *GetWebhookLogsResponse) GetData() []components.WebhookLog { return o.Data } -func (o *GetWebhookLogsResponse) GetError() *sdkerrors.Error { +func (o *GetWebhookLogsResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/getwebhooks.go b/models/operations/getwebhooks.go index 5cdde40..8969c0c 100644 --- a/models/operations/getwebhooks.go +++ b/models/operations/getwebhooks.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type GetWebhooksResponse struct { @@ -12,7 +11,7 @@ type GetWebhooksResponse struct { // Success Data []components.Webhook // Error - Error *sdkerrors.Error + Error *components.Error } func (o *GetWebhooksResponse) GetHTTPMeta() components.HTTPMetadata { @@ -29,7 +28,7 @@ func (o *GetWebhooksResponse) GetData() []components.Webhook { return o.Data } -func (o *GetWebhooksResponse) GetError() *sdkerrors.Error { +func (o *GetWebhooksResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/removemultistreamtarget.go b/models/operations/removemultistreamtarget.go index eee79b8..ad4e9cf 100644 --- a/models/operations/removemultistreamtarget.go +++ b/models/operations/removemultistreamtarget.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type RemoveMultistreamTargetRequest struct { @@ -31,7 +30,7 @@ func (o *RemoveMultistreamTargetRequest) GetTargetID() string { type RemoveMultistreamTargetResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *RemoveMultistreamTargetResponse) GetHTTPMeta() components.HTTPMetadata { @@ -41,7 +40,7 @@ func (o *RemoveMultistreamTargetResponse) GetHTTPMeta() components.HTTPMetadata return o.HTTPMeta } -func (o *RemoveMultistreamTargetResponse) GetError() *sdkerrors.Error { +func (o *RemoveMultistreamTargetResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/requestupload.go b/models/operations/requestupload.go index a50da6c..c8c9a89 100644 --- a/models/operations/requestupload.go +++ b/models/operations/requestupload.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type Task struct { @@ -61,7 +60,7 @@ type RequestUploadResponse struct { // Success Data *RequestUploadData // Error - Error *sdkerrors.Error + Error *components.Error } func (o *RequestUploadResponse) GetHTTPMeta() components.HTTPMetadata { @@ -78,7 +77,7 @@ func (o *RequestUploadResponse) GetData() *RequestUploadData { return o.Data } -func (o *RequestUploadResponse) GetError() *sdkerrors.Error { +func (o *RequestUploadResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/resendwebhook.go b/models/operations/resendwebhook.go index 5fb19c6..cd9e539 100644 --- a/models/operations/resendwebhook.go +++ b/models/operations/resendwebhook.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type ResendWebhookRequest struct { @@ -31,7 +30,7 @@ type ResendWebhookResponse struct { // Success WebhookLog *components.WebhookLog // Error - Error *sdkerrors.Error + Error *components.Error } func (o *ResendWebhookResponse) GetHTTPMeta() components.HTTPMetadata { @@ -48,7 +47,7 @@ func (o *ResendWebhookResponse) GetWebhookLog() *components.WebhookLog { return o.WebhookLog } -func (o *ResendWebhookResponse) GetError() *sdkerrors.Error { +func (o *ResendWebhookResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/startpullstream.go b/models/operations/startpullstream.go index 4fc592c..96fd794 100644 --- a/models/operations/startpullstream.go +++ b/models/operations/startpullstream.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type StartPullStreamRequest struct { @@ -22,7 +21,7 @@ func (o *StartPullStreamRequest) GetID() string { type StartPullStreamResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *StartPullStreamResponse) GetHTTPMeta() components.HTTPMetadata { @@ -32,7 +31,7 @@ func (o *StartPullStreamResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *StartPullStreamResponse) GetError() *sdkerrors.Error { +func (o *StartPullStreamResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/startroomegress.go b/models/operations/startroomegress.go index 39aab07..21a99cf 100644 --- a/models/operations/startroomegress.go +++ b/models/operations/startroomegress.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type StartRoomEgressRequest struct { @@ -29,7 +28,7 @@ func (o *StartRoomEgressRequest) GetRoomEgressPayload() components.RoomEgressPay type StartRoomEgressResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *StartRoomEgressResponse) GetHTTPMeta() components.HTTPMetadata { @@ -39,7 +38,7 @@ func (o *StartRoomEgressResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *StartRoomEgressResponse) GetError() *sdkerrors.Error { +func (o *StartRoomEgressResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/stoproomegress.go b/models/operations/stoproomegress.go index dd01d29..94f4705 100644 --- a/models/operations/stoproomegress.go +++ b/models/operations/stoproomegress.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type StopRoomEgressRequest struct { @@ -21,7 +20,7 @@ func (o *StopRoomEgressRequest) GetID() string { type StopRoomEgressResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *StopRoomEgressResponse) GetHTTPMeta() components.HTTPMetadata { @@ -31,7 +30,7 @@ func (o *StopRoomEgressResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *StopRoomEgressResponse) GetError() *sdkerrors.Error { +func (o *StopRoomEgressResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/terminatestream.go b/models/operations/terminatestream.go index c46a7c6..a2e1c7a 100644 --- a/models/operations/terminatestream.go +++ b/models/operations/terminatestream.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type TerminateStreamRequest struct { @@ -22,7 +21,7 @@ func (o *TerminateStreamRequest) GetID() string { type TerminateStreamResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *TerminateStreamResponse) GetHTTPMeta() components.HTTPMetadata { @@ -32,7 +31,7 @@ func (o *TerminateStreamResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *TerminateStreamResponse) GetError() *sdkerrors.Error { +func (o *TerminateStreamResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/transcodevideo.go b/models/operations/transcodevideo.go index 957573e..350ad05 100644 --- a/models/operations/transcodevideo.go +++ b/models/operations/transcodevideo.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type TranscodeVideoResponse struct { @@ -12,7 +11,7 @@ type TranscodeVideoResponse struct { // Success Task *components.Task // Error - Error *sdkerrors.Error + Error *components.Error } func (o *TranscodeVideoResponse) GetHTTPMeta() components.HTTPMetadata { @@ -29,7 +28,7 @@ func (o *TranscodeVideoResponse) GetTask() *components.Task { return o.Task } -func (o *TranscodeVideoResponse) GetError() *sdkerrors.Error { +func (o *TranscodeVideoResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/updateasset.go b/models/operations/updateasset.go index 4f83836..eb8965a 100644 --- a/models/operations/updateasset.go +++ b/models/operations/updateasset.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type UpdateAssetRequest struct { @@ -32,7 +31,7 @@ type UpdateAssetResponse struct { // Success Asset *components.Asset // Error - Error *sdkerrors.Error + Error *components.Error } func (o *UpdateAssetResponse) GetHTTPMeta() components.HTTPMetadata { @@ -49,7 +48,7 @@ func (o *UpdateAssetResponse) GetAsset() *components.Asset { return o.Asset } -func (o *UpdateAssetResponse) GetError() *sdkerrors.Error { +func (o *UpdateAssetResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/updatemultistreamtarget.go b/models/operations/updatemultistreamtarget.go index 72e8d96..25dda2e 100644 --- a/models/operations/updatemultistreamtarget.go +++ b/models/operations/updatemultistreamtarget.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type UpdateMultistreamTargetRequest struct { @@ -30,7 +29,7 @@ func (o *UpdateMultistreamTargetRequest) GetMultistreamTargetPatchPayload() comp type UpdateMultistreamTargetResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *UpdateMultistreamTargetResponse) GetHTTPMeta() components.HTTPMetadata { @@ -40,7 +39,7 @@ func (o *UpdateMultistreamTargetResponse) GetHTTPMeta() components.HTTPMetadata return o.HTTPMeta } -func (o *UpdateMultistreamTargetResponse) GetError() *sdkerrors.Error { +func (o *UpdateMultistreamTargetResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/updateroomuser.go b/models/operations/updateroomuser.go index 06e1bad..b643b4c 100644 --- a/models/operations/updateroomuser.go +++ b/models/operations/updateroomuser.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type UpdateRoomUserRequest struct { @@ -37,7 +36,7 @@ func (o *UpdateRoomUserRequest) GetRoomUserUpdatePayload() components.RoomUserUp type UpdateRoomUserResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *UpdateRoomUserResponse) GetHTTPMeta() components.HTTPMetadata { @@ -47,7 +46,7 @@ func (o *UpdateRoomUserResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *UpdateRoomUserResponse) GetError() *sdkerrors.Error { +func (o *UpdateRoomUserResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/updatesigningkey.go b/models/operations/updatesigningkey.go index 0bd0bed..a99e0ba 100644 --- a/models/operations/updatesigningkey.go +++ b/models/operations/updatesigningkey.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type UpdateSigningKeyRequestBody struct { @@ -49,7 +48,7 @@ func (o *UpdateSigningKeyRequest) GetRequestBody() UpdateSigningKeyRequestBody { type UpdateSigningKeyResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *UpdateSigningKeyResponse) GetHTTPMeta() components.HTTPMetadata { @@ -59,7 +58,7 @@ func (o *UpdateSigningKeyResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *UpdateSigningKeyResponse) GetError() *sdkerrors.Error { +func (o *UpdateSigningKeyResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/updatestream.go b/models/operations/updatestream.go index fb2f050..257e067 100644 --- a/models/operations/updatestream.go +++ b/models/operations/updatestream.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type UpdateStreamRequest struct { @@ -30,7 +29,7 @@ func (o *UpdateStreamRequest) GetStreamPatchPayload() components.StreamPatchPayl type UpdateStreamResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // Error - Error *sdkerrors.Error + Error *components.Error } func (o *UpdateStreamResponse) GetHTTPMeta() components.HTTPMetadata { @@ -40,7 +39,7 @@ func (o *UpdateStreamResponse) GetHTTPMeta() components.HTTPMetadata { return o.HTTPMeta } -func (o *UpdateStreamResponse) GetError() *sdkerrors.Error { +func (o *UpdateStreamResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/updatewebhook.go b/models/operations/updatewebhook.go index c4876ca..3a5506d 100644 --- a/models/operations/updatewebhook.go +++ b/models/operations/updatewebhook.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type UpdateWebhookRequest struct { @@ -31,7 +30,7 @@ type UpdateWebhookResponse struct { // Success Webhook *components.Webhook // Error - Error *sdkerrors.Error + Error *components.Error } func (o *UpdateWebhookResponse) GetHTTPMeta() components.HTTPMetadata { @@ -48,7 +47,7 @@ func (o *UpdateWebhookResponse) GetWebhook() *components.Webhook { return o.Webhook } -func (o *UpdateWebhookResponse) GetError() *sdkerrors.Error { +func (o *UpdateWebhookResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/operations/uploadasset.go b/models/operations/uploadasset.go index 8e195f7..cf3da5c 100644 --- a/models/operations/uploadasset.go +++ b/models/operations/uploadasset.go @@ -4,7 +4,6 @@ package operations import ( "github.com/livepeer/livepeer-go/models/components" - "github.com/livepeer/livepeer-go/models/sdkerrors" ) type UploadAssetAssetTask struct { @@ -76,7 +75,7 @@ type UploadAssetResponse struct { // Upload started TwoHundredAndOneApplicationJSONData *UploadAssetDataOutput // Error - Error *sdkerrors.Error + Error *components.Error } func (o *UploadAssetResponse) GetHTTPMeta() components.HTTPMetadata { @@ -100,7 +99,7 @@ func (o *UploadAssetResponse) GetTwoHundredAndOneApplicationJSONData() *UploadAs return o.TwoHundredAndOneApplicationJSONData } -func (o *UploadAssetResponse) GetError() *sdkerrors.Error { +func (o *UploadAssetResponse) GetError() *components.Error { if o == nil { return nil } diff --git a/models/sdkerrors/genaudiototext.go b/models/sdkerrors/genaudiototext.go index 9da668e..5ab37d4 100644 --- a/models/sdkerrors/genaudiototext.go +++ b/models/sdkerrors/genaudiototext.go @@ -172,6 +172,87 @@ func (u GenAudioToTextGenerateResponse422ResponseBody) Error() string { } } +type GenAudioToTextGenerateResponse415ResponseBodyType string + +const ( + GenAudioToTextGenerateResponse415ResponseBodyTypeHTTPError GenAudioToTextGenerateResponse415ResponseBodyType = "HTTPError" + GenAudioToTextGenerateResponse415ResponseBodyTypeStudioAPIError GenAudioToTextGenerateResponse415ResponseBodyType = "studio-api-error" +) + +// GenAudioToTextGenerateResponse415ResponseBody - Unsupported Media Type +type GenAudioToTextGenerateResponse415ResponseBody struct { + HTTPError *components.HTTPError + StudioAPIError *components.StudioAPIError + + Type GenAudioToTextGenerateResponse415ResponseBodyType + + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GenAudioToTextGenerateResponse415ResponseBody{} + +func CreateGenAudioToTextGenerateResponse415ResponseBodyHTTPError(httpError components.HTTPError) GenAudioToTextGenerateResponse415ResponseBody { + typ := GenAudioToTextGenerateResponse415ResponseBodyTypeHTTPError + + return GenAudioToTextGenerateResponse415ResponseBody{ + HTTPError: &httpError, + Type: typ, + } +} + +func CreateGenAudioToTextGenerateResponse415ResponseBodyStudioAPIError(studioAPIError components.StudioAPIError) GenAudioToTextGenerateResponse415ResponseBody { + typ := GenAudioToTextGenerateResponse415ResponseBodyTypeStudioAPIError + + return GenAudioToTextGenerateResponse415ResponseBody{ + StudioAPIError: &studioAPIError, + Type: typ, + } +} + +func (u *GenAudioToTextGenerateResponse415ResponseBody) UnmarshalJSON(data []byte) error { + + var httpError components.HTTPError = components.HTTPError{} + if err := utils.UnmarshalJSON(data, &httpError, "", true, true); err == nil { + u.HTTPError = &httpError + u.Type = GenAudioToTextGenerateResponse415ResponseBodyTypeHTTPError + return nil + } + + var studioAPIError components.StudioAPIError = components.StudioAPIError{} + if err := utils.UnmarshalJSON(data, &studioAPIError, "", true, true); err == nil { + u.StudioAPIError = &studioAPIError + u.Type = GenAudioToTextGenerateResponse415ResponseBodyTypeStudioAPIError + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for GenAudioToTextGenerateResponse415ResponseBody", string(data)) +} + +func (u GenAudioToTextGenerateResponse415ResponseBody) MarshalJSON() ([]byte, error) { + if u.HTTPError != nil { + return utils.MarshalJSON(u.HTTPError, "", true) + } + + if u.StudioAPIError != nil { + return utils.MarshalJSON(u.StudioAPIError, "", true) + } + + return nil, errors.New("could not marshal union type GenAudioToTextGenerateResponse415ResponseBody: all fields are null") +} + +func (u GenAudioToTextGenerateResponse415ResponseBody) Error() string { + switch u.Type { + case GenAudioToTextGenerateResponse415ResponseBodyTypeHTTPError: + data, _ := json.Marshal(u.HTTPError) + return string(data) + case GenAudioToTextGenerateResponse415ResponseBodyTypeStudioAPIError: + data, _ := json.Marshal(u.StudioAPIError) + return string(data) + default: + return "unknown error" + } +} + type GenAudioToTextGenerateResponseResponseBodyType string const ( diff --git a/models/sdkerrors/genllm.go b/models/sdkerrors/genllm.go new file mode 100644 index 0000000..39b699c --- /dev/null +++ b/models/sdkerrors/genllm.go @@ -0,0 +1,335 @@ +// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + +package sdkerrors + +import ( + "encoding/json" + "errors" + "fmt" + "github.com/livepeer/livepeer-go/internal/utils" + "github.com/livepeer/livepeer-go/models/components" +) + +type GenLLMGenerateResponse500ResponseBodyType string + +const ( + GenLLMGenerateResponse500ResponseBodyTypeHTTPError GenLLMGenerateResponse500ResponseBodyType = "HTTPError" + GenLLMGenerateResponse500ResponseBodyTypeStudioAPIError GenLLMGenerateResponse500ResponseBodyType = "studio-api-error" +) + +// GenLLMGenerateResponse500ResponseBody - Internal Server Error +type GenLLMGenerateResponse500ResponseBody struct { + HTTPError *components.HTTPError + StudioAPIError *components.StudioAPIError + + Type GenLLMGenerateResponse500ResponseBodyType + + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GenLLMGenerateResponse500ResponseBody{} + +func CreateGenLLMGenerateResponse500ResponseBodyHTTPError(httpError components.HTTPError) GenLLMGenerateResponse500ResponseBody { + typ := GenLLMGenerateResponse500ResponseBodyTypeHTTPError + + return GenLLMGenerateResponse500ResponseBody{ + HTTPError: &httpError, + Type: typ, + } +} + +func CreateGenLLMGenerateResponse500ResponseBodyStudioAPIError(studioAPIError components.StudioAPIError) GenLLMGenerateResponse500ResponseBody { + typ := GenLLMGenerateResponse500ResponseBodyTypeStudioAPIError + + return GenLLMGenerateResponse500ResponseBody{ + StudioAPIError: &studioAPIError, + Type: typ, + } +} + +func (u *GenLLMGenerateResponse500ResponseBody) UnmarshalJSON(data []byte) error { + + var httpError components.HTTPError = components.HTTPError{} + if err := utils.UnmarshalJSON(data, &httpError, "", true, true); err == nil { + u.HTTPError = &httpError + u.Type = GenLLMGenerateResponse500ResponseBodyTypeHTTPError + return nil + } + + var studioAPIError components.StudioAPIError = components.StudioAPIError{} + if err := utils.UnmarshalJSON(data, &studioAPIError, "", true, true); err == nil { + u.StudioAPIError = &studioAPIError + u.Type = GenLLMGenerateResponse500ResponseBodyTypeStudioAPIError + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for GenLLMGenerateResponse500ResponseBody", string(data)) +} + +func (u GenLLMGenerateResponse500ResponseBody) MarshalJSON() ([]byte, error) { + if u.HTTPError != nil { + return utils.MarshalJSON(u.HTTPError, "", true) + } + + if u.StudioAPIError != nil { + return utils.MarshalJSON(u.StudioAPIError, "", true) + } + + return nil, errors.New("could not marshal union type GenLLMGenerateResponse500ResponseBody: all fields are null") +} + +func (u GenLLMGenerateResponse500ResponseBody) Error() string { + switch u.Type { + case GenLLMGenerateResponse500ResponseBodyTypeHTTPError: + data, _ := json.Marshal(u.HTTPError) + return string(data) + case GenLLMGenerateResponse500ResponseBodyTypeStudioAPIError: + data, _ := json.Marshal(u.StudioAPIError) + return string(data) + default: + return "unknown error" + } +} + +type GenLLMGenerateResponseResponseBodyType string + +const ( + GenLLMGenerateResponseResponseBodyTypeHTTPValidationError GenLLMGenerateResponseResponseBodyType = "HTTPValidationError" + GenLLMGenerateResponseResponseBodyTypeStudioAPIError GenLLMGenerateResponseResponseBodyType = "studio-api-error" +) + +// GenLLMGenerateResponseResponseBody - Validation Error +type GenLLMGenerateResponseResponseBody struct { + HTTPValidationError *components.HTTPValidationError + StudioAPIError *components.StudioAPIError + + Type GenLLMGenerateResponseResponseBodyType + + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GenLLMGenerateResponseResponseBody{} + +func CreateGenLLMGenerateResponseResponseBodyHTTPValidationError(httpValidationError components.HTTPValidationError) GenLLMGenerateResponseResponseBody { + typ := GenLLMGenerateResponseResponseBodyTypeHTTPValidationError + + return GenLLMGenerateResponseResponseBody{ + HTTPValidationError: &httpValidationError, + Type: typ, + } +} + +func CreateGenLLMGenerateResponseResponseBodyStudioAPIError(studioAPIError components.StudioAPIError) GenLLMGenerateResponseResponseBody { + typ := GenLLMGenerateResponseResponseBodyTypeStudioAPIError + + return GenLLMGenerateResponseResponseBody{ + StudioAPIError: &studioAPIError, + Type: typ, + } +} + +func (u *GenLLMGenerateResponseResponseBody) UnmarshalJSON(data []byte) error { + + var httpValidationError components.HTTPValidationError = components.HTTPValidationError{} + if err := utils.UnmarshalJSON(data, &httpValidationError, "", true, true); err == nil { + u.HTTPValidationError = &httpValidationError + u.Type = GenLLMGenerateResponseResponseBodyTypeHTTPValidationError + return nil + } + + var studioAPIError components.StudioAPIError = components.StudioAPIError{} + if err := utils.UnmarshalJSON(data, &studioAPIError, "", true, true); err == nil { + u.StudioAPIError = &studioAPIError + u.Type = GenLLMGenerateResponseResponseBodyTypeStudioAPIError + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for GenLLMGenerateResponseResponseBody", string(data)) +} + +func (u GenLLMGenerateResponseResponseBody) MarshalJSON() ([]byte, error) { + if u.HTTPValidationError != nil { + return utils.MarshalJSON(u.HTTPValidationError, "", true) + } + + if u.StudioAPIError != nil { + return utils.MarshalJSON(u.StudioAPIError, "", true) + } + + return nil, errors.New("could not marshal union type GenLLMGenerateResponseResponseBody: all fields are null") +} + +func (u GenLLMGenerateResponseResponseBody) Error() string { + switch u.Type { + case GenLLMGenerateResponseResponseBodyTypeHTTPValidationError: + data, _ := json.Marshal(u.HTTPValidationError) + return string(data) + case GenLLMGenerateResponseResponseBodyTypeStudioAPIError: + data, _ := json.Marshal(u.StudioAPIError) + return string(data) + default: + return "unknown error" + } +} + +type GenLLMGenerateResponseBodyType string + +const ( + GenLLMGenerateResponseBodyTypeHTTPError GenLLMGenerateResponseBodyType = "HTTPError" + GenLLMGenerateResponseBodyTypeStudioAPIError GenLLMGenerateResponseBodyType = "studio-api-error" +) + +// GenLLMGenerateResponseBody - Unauthorized +type GenLLMGenerateResponseBody struct { + HTTPError *components.HTTPError + StudioAPIError *components.StudioAPIError + + Type GenLLMGenerateResponseBodyType + + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GenLLMGenerateResponseBody{} + +func CreateGenLLMGenerateResponseBodyHTTPError(httpError components.HTTPError) GenLLMGenerateResponseBody { + typ := GenLLMGenerateResponseBodyTypeHTTPError + + return GenLLMGenerateResponseBody{ + HTTPError: &httpError, + Type: typ, + } +} + +func CreateGenLLMGenerateResponseBodyStudioAPIError(studioAPIError components.StudioAPIError) GenLLMGenerateResponseBody { + typ := GenLLMGenerateResponseBodyTypeStudioAPIError + + return GenLLMGenerateResponseBody{ + StudioAPIError: &studioAPIError, + Type: typ, + } +} + +func (u *GenLLMGenerateResponseBody) UnmarshalJSON(data []byte) error { + + var httpError components.HTTPError = components.HTTPError{} + if err := utils.UnmarshalJSON(data, &httpError, "", true, true); err == nil { + u.HTTPError = &httpError + u.Type = GenLLMGenerateResponseBodyTypeHTTPError + return nil + } + + var studioAPIError components.StudioAPIError = components.StudioAPIError{} + if err := utils.UnmarshalJSON(data, &studioAPIError, "", true, true); err == nil { + u.StudioAPIError = &studioAPIError + u.Type = GenLLMGenerateResponseBodyTypeStudioAPIError + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for GenLLMGenerateResponseBody", string(data)) +} + +func (u GenLLMGenerateResponseBody) MarshalJSON() ([]byte, error) { + if u.HTTPError != nil { + return utils.MarshalJSON(u.HTTPError, "", true) + } + + if u.StudioAPIError != nil { + return utils.MarshalJSON(u.StudioAPIError, "", true) + } + + return nil, errors.New("could not marshal union type GenLLMGenerateResponseBody: all fields are null") +} + +func (u GenLLMGenerateResponseBody) Error() string { + switch u.Type { + case GenLLMGenerateResponseBodyTypeHTTPError: + data, _ := json.Marshal(u.HTTPError) + return string(data) + case GenLLMGenerateResponseBodyTypeStudioAPIError: + data, _ := json.Marshal(u.StudioAPIError) + return string(data) + default: + return "unknown error" + } +} + +type GenLLMResponseBodyType string + +const ( + GenLLMResponseBodyTypeHTTPError GenLLMResponseBodyType = "HTTPError" + GenLLMResponseBodyTypeStudioAPIError GenLLMResponseBodyType = "studio-api-error" +) + +// GenLLMResponseBody - Bad Request +type GenLLMResponseBody struct { + HTTPError *components.HTTPError + StudioAPIError *components.StudioAPIError + + Type GenLLMResponseBodyType + + HTTPMeta components.HTTPMetadata `json:"-"` +} + +var _ error = &GenLLMResponseBody{} + +func CreateGenLLMResponseBodyHTTPError(httpError components.HTTPError) GenLLMResponseBody { + typ := GenLLMResponseBodyTypeHTTPError + + return GenLLMResponseBody{ + HTTPError: &httpError, + Type: typ, + } +} + +func CreateGenLLMResponseBodyStudioAPIError(studioAPIError components.StudioAPIError) GenLLMResponseBody { + typ := GenLLMResponseBodyTypeStudioAPIError + + return GenLLMResponseBody{ + StudioAPIError: &studioAPIError, + Type: typ, + } +} + +func (u *GenLLMResponseBody) UnmarshalJSON(data []byte) error { + + var httpError components.HTTPError = components.HTTPError{} + if err := utils.UnmarshalJSON(data, &httpError, "", true, true); err == nil { + u.HTTPError = &httpError + u.Type = GenLLMResponseBodyTypeHTTPError + return nil + } + + var studioAPIError components.StudioAPIError = components.StudioAPIError{} + if err := utils.UnmarshalJSON(data, &studioAPIError, "", true, true); err == nil { + u.StudioAPIError = &studioAPIError + u.Type = GenLLMResponseBodyTypeStudioAPIError + return nil + } + + return fmt.Errorf("could not unmarshal `%s` into any supported union types for GenLLMResponseBody", string(data)) +} + +func (u GenLLMResponseBody) MarshalJSON() ([]byte, error) { + if u.HTTPError != nil { + return utils.MarshalJSON(u.HTTPError, "", true) + } + + if u.StudioAPIError != nil { + return utils.MarshalJSON(u.StudioAPIError, "", true) + } + + return nil, errors.New("could not marshal union type GenLLMResponseBody: all fields are null") +} + +func (u GenLLMResponseBody) Error() string { + switch u.Type { + case GenLLMResponseBodyTypeHTTPError: + data, _ := json.Marshal(u.HTTPError) + return string(data) + case GenLLMResponseBodyTypeStudioAPIError: + data, _ := json.Marshal(u.StudioAPIError) + return string(data) + default: + return "unknown error" + } +} diff --git a/multistream.go b/multistream.go index ba5b924..38286e3 100644 --- a/multistream.go +++ b/multistream.go @@ -12,7 +12,6 @@ import ( "github.com/livepeer/livepeer-go/models/components" "github.com/livepeer/livepeer-go/models/operations" "github.com/livepeer/livepeer-go/models/sdkerrors" - "io" "net/http" "net/url" ) @@ -169,21 +168,11 @@ func (s *Multistream) GetAll(ctx context.Context, opts ...operations.Option) (*o }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -195,42 +184,39 @@ func (s *Multistream) GetAll(ctx context.Context, opts ...operations.Option) (*o res.Data = out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -386,21 +372,11 @@ func (s *Multistream) Create(ctx context.Context, request components.Multistream }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 201: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -412,42 +388,39 @@ func (s *Multistream) Create(ctx context.Context, request components.Multistream res.MultistreamTarget = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -601,21 +574,11 @@ func (s *Multistream) Get(ctx context.Context, id string, opts ...operations.Opt }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -627,42 +590,39 @@ func (s *Multistream) Get(ctx context.Context, id string, opts ...operations.Opt res.MultistreamTarget = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -823,47 +783,35 @@ func (s *Multistream) Update(ctx context.Context, id string, multistreamTargetPa }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1019,47 +967,35 @@ func (s *Multistream) Delete(ctx context.Context, id string, opts ...operations. }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/playback.go b/playback.go index b6b3938..df3e1c1 100644 --- a/playback.go +++ b/playback.go @@ -12,7 +12,6 @@ import ( "github.com/livepeer/livepeer-go/models/components" "github.com/livepeer/livepeer-go/models/operations" "github.com/livepeer/livepeer-go/models/sdkerrors" - "io" "net/http" ) @@ -172,21 +171,11 @@ func (s *Playback) Get(ctx context.Context, id string, opts ...operations.Option }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -198,17 +187,16 @@ func (s *Playback) Get(ctx context.Context, id string, opts ...operations.Option res.PlaybackInfo = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode == 404: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -220,42 +208,39 @@ func (s *Playback) Get(ctx context.Context, id string, opts ...operations.Option return nil, &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/room.go b/room.go index 5ad9da1..b267334 100644 --- a/room.go +++ b/room.go @@ -12,7 +12,6 @@ import ( "github.com/livepeer/livepeer-go/models/components" "github.com/livepeer/livepeer-go/models/operations" "github.com/livepeer/livepeer-go/models/sdkerrors" - "io" "net/http" "net/url" ) @@ -172,21 +171,11 @@ func (s *Room) Create(ctx context.Context, opts ...operations.Option) (*operatio }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -198,42 +187,39 @@ func (s *Room) Create(ctx context.Context, opts ...operations.Option) (*operatio res.CreateRoomResponse = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -389,21 +375,11 @@ func (s *Room) Get(ctx context.Context, id string, opts ...operations.Option) (* }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -415,42 +391,39 @@ func (s *Room) Get(ctx context.Context, id string, opts ...operations.Option) (* res.Room = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -606,47 +579,35 @@ func (s *Room) Delete(ctx context.Context, id string, opts ...operations.Option) }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -811,47 +772,35 @@ func (s *Room) StartEgress(ctx context.Context, id string, roomEgressPayload com }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1007,47 +956,35 @@ func (s *Room) StopEgress(ctx context.Context, id string, opts ...operations.Opt }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1213,21 +1150,11 @@ func (s *Room) CreateUser(ctx context.Context, id string, roomUserPayload compon }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 201: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1239,42 +1166,39 @@ func (s *Room) CreateUser(ctx context.Context, id string, roomUserPayload compon res.RoomUserResponse = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1431,21 +1355,11 @@ func (s *Room) GetUser(ctx context.Context, id string, userID string, opts ...op }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1457,42 +1371,39 @@ func (s *Room) GetUser(ctx context.Context, id string, userID string, opts ...op res.GetRoomUserResponse = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1657,47 +1568,35 @@ func (s *Room) UpdateUser(ctx context.Context, id string, userID string, roomUse }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1854,47 +1753,35 @@ func (s *Room) DeleteUser(ctx context.Context, id string, userID string, opts .. }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/session.go b/session.go index bfc9acd..ec35afd 100644 --- a/session.go +++ b/session.go @@ -12,7 +12,6 @@ import ( "github.com/livepeer/livepeer-go/models/components" "github.com/livepeer/livepeer-go/models/operations" "github.com/livepeer/livepeer-go/models/sdkerrors" - "io" "net/http" "net/url" ) @@ -173,21 +172,11 @@ func (s *Session) GetClips(ctx context.Context, id string, opts ...operations.Op }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -199,42 +188,39 @@ func (s *Session) GetClips(ctx context.Context, id string, opts ...operations.Op res.Data = out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -384,21 +370,11 @@ func (s *Session) GetAll(ctx context.Context, opts ...operations.Option) (*opera }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -410,42 +386,39 @@ func (s *Session) GetAll(ctx context.Context, opts ...operations.Option) (*opera res.Data = out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -599,21 +572,11 @@ func (s *Session) Get(ctx context.Context, id string, opts ...operations.Option) }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -625,42 +588,39 @@ func (s *Session) Get(ctx context.Context, id string, opts ...operations.Option) res.Session = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -819,21 +779,11 @@ func (s *Session) GetRecorded(ctx context.Context, parentID string, record *oper }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -845,42 +795,39 @@ func (s *Session) GetRecorded(ctx context.Context, parentID string, record *oper res.Data = out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/stream.go b/stream.go index 5bde925..741d809 100644 --- a/stream.go +++ b/stream.go @@ -12,7 +12,6 @@ import ( "github.com/livepeer/livepeer-go/models/components" "github.com/livepeer/livepeer-go/models/operations" "github.com/livepeer/livepeer-go/models/sdkerrors" - "io" "net/http" "net/url" ) @@ -188,21 +187,11 @@ func (s *Stream) Create(ctx context.Context, request components.NewStreamPayload }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 201: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -214,42 +203,39 @@ func (s *Stream) Create(ctx context.Context, request components.NewStreamPayload res.Stream = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -407,21 +393,11 @@ func (s *Stream) GetAll(ctx context.Context, streamsonly *string, opts ...operat }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -433,42 +409,39 @@ func (s *Stream) GetAll(ctx context.Context, streamsonly *string, opts ...operat res.Data = out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -622,21 +595,11 @@ func (s *Stream) Get(ctx context.Context, id string, opts ...operations.Option) }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -648,42 +611,39 @@ func (s *Stream) Get(ctx context.Context, id string, opts ...operations.Option) res.Stream = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -844,47 +804,35 @@ func (s *Stream) Update(ctx context.Context, id string, streamPatchPayload compo }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1042,47 +990,35 @@ func (s *Stream) Delete(ctx context.Context, id string, opts ...operations.Optio }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1244,47 +1180,35 @@ func (s *Stream) Terminate(ctx context.Context, id string, opts ...operations.Op }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1445,47 +1369,35 @@ func (s *Stream) StartPull(ctx context.Context, id string, opts ...operations.Op }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1641,21 +1553,11 @@ func (s *Stream) CreateClip(ctx context.Context, request components.ClipPayload, }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1667,42 +1569,39 @@ func (s *Stream) CreateClip(ctx context.Context, request components.ClipPayload, res.Data = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1856,21 +1755,11 @@ func (s *Stream) GetClips(ctx context.Context, id string, opts ...operations.Opt }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1882,42 +1771,39 @@ func (s *Stream) GetClips(ctx context.Context, id string, opts ...operations.Opt res.Data = out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -2078,47 +1964,35 @@ func (s *Stream) AddMultistreamTarget(ctx context.Context, id string, targetAddP }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -2273,47 +2147,35 @@ func (s *Stream) RemoveMultistreamTarget(ctx context.Context, id string, targetI }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 204: case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/task.go b/task.go index f992671..adb0b21 100644 --- a/task.go +++ b/task.go @@ -12,7 +12,6 @@ import ( "github.com/livepeer/livepeer-go/models/components" "github.com/livepeer/livepeer-go/models/operations" "github.com/livepeer/livepeer-go/models/sdkerrors" - "io" "net/http" "net/url" ) @@ -169,21 +168,11 @@ func (s *Task) GetAll(ctx context.Context, opts ...operations.Option) (*operatio }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -195,42 +184,39 @@ func (s *Task) GetAll(ctx context.Context, opts ...operations.Option) (*operatio res.Data = out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -384,21 +370,11 @@ func (s *Task) Get(ctx context.Context, taskID string, opts ...operations.Option }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -410,21 +386,19 @@ func (s *Task) Get(ctx context.Context, taskID string, opts ...operations.Option res.Task = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: } diff --git a/transcode.go b/transcode.go index 045470e..8a47445 100644 --- a/transcode.go +++ b/transcode.go @@ -12,7 +12,6 @@ import ( "github.com/livepeer/livepeer-go/models/components" "github.com/livepeer/livepeer-go/models/operations" "github.com/livepeer/livepeer-go/models/sdkerrors" - "io" "net/http" "net/url" ) @@ -304,21 +303,11 @@ func (s *Transcode) Create(ctx context.Context, request components.TranscodePayl }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -330,42 +319,39 @@ func (s *Transcode) Create(ctx context.Context, request components.TranscodePayl res.Task = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } diff --git a/webhook.go b/webhook.go index a675382..2011edf 100644 --- a/webhook.go +++ b/webhook.go @@ -12,7 +12,6 @@ import ( "github.com/livepeer/livepeer-go/models/components" "github.com/livepeer/livepeer-go/models/operations" "github.com/livepeer/livepeer-go/models/sdkerrors" - "io" "net/http" "net/url" ) @@ -169,21 +168,11 @@ func (s *Webhook) GetAll(ctx context.Context, opts ...operations.Option) (*opera }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -195,42 +184,39 @@ func (s *Webhook) GetAll(ctx context.Context, opts ...operations.Option) (*opera res.Data = out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -387,21 +373,11 @@ func (s *Webhook) Create(ctx context.Context, request components.WebhookInput, o }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -413,42 +389,39 @@ func (s *Webhook) Create(ctx context.Context, request components.WebhookInput, o res.Webhook = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -602,21 +575,11 @@ func (s *Webhook) Get(ctx context.Context, id string, opts ...operations.Option) }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -628,42 +591,39 @@ func (s *Webhook) Get(ctx context.Context, id string, opts ...operations.Option) res.Webhook = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -824,21 +784,11 @@ func (s *Webhook) Update(ctx context.Context, id string, webhook components.Webh }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -850,42 +800,39 @@ func (s *Webhook) Update(ctx context.Context, id string, webhook components.Webh res.Webhook = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1039,21 +986,11 @@ func (s *Webhook) Delete(ctx context.Context, id string, opts ...operations.Opti }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1065,42 +1002,39 @@ func (s *Webhook) Delete(ctx context.Context, id string, opts ...operations.Opti res.Webhook = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1254,21 +1188,11 @@ func (s *Webhook) GetLogs(ctx context.Context, id string, opts ...operations.Opt }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1280,42 +1204,39 @@ func (s *Webhook) GetLogs(ctx context.Context, id string, opts ...operations.Opt res.Data = out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1470,21 +1391,11 @@ func (s *Webhook) GetLog(ctx context.Context, id string, logID string, opts ...o }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1496,42 +1407,39 @@ func (s *Webhook) GetLog(ctx context.Context, id string, logID string, opts ...o res.WebhookLog = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } } @@ -1689,21 +1597,11 @@ func (s *Webhook) ResendLog(ctx context.Context, id string, logID string, opts . }, } - getRawBody := func() ([]byte, error) { - rawBody, err := io.ReadAll(httpRes.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %w", err) - } - httpRes.Body.Close() - httpRes.Body = io.NopCloser(bytes.NewBuffer(rawBody)) - return rawBody, nil - } - switch { case httpRes.StatusCode == 200: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } @@ -1715,42 +1613,39 @@ func (s *Webhook) ResendLog(ctx context.Context, id string, logID string, opts . res.WebhookLog = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } case httpRes.StatusCode >= 400 && httpRes.StatusCode < 500: fallthrough case httpRes.StatusCode >= 500 && httpRes.StatusCode < 600: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError("API error occurred", httpRes.StatusCode, string(rawBody), httpRes) default: switch { case utils.MatchContentType(httpRes.Header.Get("Content-Type"), `application/json`): - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - var out sdkerrors.Error + var out components.Error if err := utils.UnmarshalJsonFromResponseBody(bytes.NewBuffer(rawBody), &out, ""); err != nil { return nil, err } res.Error = &out default: - rawBody, err := getRawBody() + rawBody, err := utils.ConsumeRawBody(httpRes) if err != nil { return nil, err } - return nil, sdkerrors.NewSDKError(fmt.Sprintf("unknown content-type received: %s", httpRes.Header.Get("Content-Type")), httpRes.StatusCode, string(rawBody), httpRes) } }